Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- LICENSES/Biopython.rst +68 -0
- LICENSES/COGNI-CC0-1.0.txt +121 -0
- LICENSES/CoolProp-MIT.txt +21 -0
- LICENSES/KiMoPack-GPL-3.0.txt +674 -0
- LICENSES/OPERA-MIT.txt +21 -0
- LICENSES/XrayDB.txt +18 -0
- LICENSES/chemicals-MIT.txt +21 -0
- LICENSES/openpoly-MIT.txt +21 -0
- LICENSES/srsinst-rga-MIT.txt +21 -0
- LICENSES/teMatDb-MIT.txt +20 -0
- catalog/catalog.csv +199 -0
- catalog/catalog.json +0 -0
- examples/quickstart_fume_hood.py +48 -0
- outputs/expansion_batch03/t4_measure/antonpaar_litesizerdia/example_setup.py +14 -0
- outputs/expansion_batch03/t4_measure/antonpaar_litesizerdls/example_setup.py +19 -0
- outputs/expansion_batch03/t4_measure/antonpaar_poremaster60/example_setup.py +37 -0
- outputs/expansion_batch03/t4_measure/antonpaar_psa1190/example_setup.py +26 -0
- outputs/expansion_batch03/t4_measure/biolin_sigma700/example_setup.py +10 -0
- outputs/expansion_batch03/t4_measure/biolin_thetaflex/example_setup.py +25 -0
- outputs/expansion_batch03/t4_measure/biorad_miniprotean/migration_chart_digitized.json +741 -0
- outputs/expansion_batch04/t1_thermal/ametek_oxtran/independent_permeation_source_validation.json +79 -0
- outputs/expansion_batch04/t1_thermal/ametek_oxtran/interface_definition.py +161 -0
- outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/interface_definition.py +177 -0
- outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/rc1e_curves_digitized.json +0 -0
- outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/template_validation.json +0 -0
- outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/thermal_calibration.json +213 -0
- outputs/expansion_batch04/t1_thermal/netzsch_mmc315/interface_definition.py +92 -0
- outputs/expansion_batch04/t1_thermal/netzsch_mmc315/template_validation.json +3201 -0
- outputs/expansion_batch04/t1_thermal/zwick_mflow/interface_definition.py +142 -0
- outputs/expansion_batch04/t3_analytical/evident_bx53p/source_cache/cvrl_ciexyz31_1.csv +471 -0
- outputs/expansion_batch04/t3_analytical/jeol_jsmit200/optics_fit.json +87 -0
- scripts/asset_runtime/ametek_oxtran.py +0 -0
- scripts/asset_runtime/lakeshore_8604vsm.py +518 -0
- scripts/asset_runtime/lakeshore_measurereadym91.py +495 -0
- scripts/asset_runtime/novocontrol_alphat.py +431 -0
- scripts/asset_runtime/shimadzu_ags10knxd.py +494 -0
- scripts/asset_runtime/signatone_quadpro2.py +543 -0
- scripts/asset_runtime/zwick_hit5p.py +418 -0
- scripts/asset_runtime/zwick_mflow.py +1350 -0
- tests/conftest.py +24 -0
- tests/test_asset_ametek_oxtran.py +916 -0
- tests/test_asset_antonpaar_hit300.py +179 -0
- tests/test_asset_antonpaar_mcr503.py +161 -0
- tests/test_asset_antonpaar_rst300.py +209 -0
- tests/test_asset_antonpaar_saxspace.py +1547 -0
- tests/test_asset_antonpaar_trb.py +168 -0
- tests/test_asset_bd_facsariaiii.py +1220 -0
- tests/test_asset_binder_fd056.py +657 -0
- tests/test_asset_binder_kbf115.py +646 -0
- tests/test_asset_biolin_mediuml.py +178 -0
LICENSES/Biopython.rst
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Biopython is currently released under the "Biopython License Agreement"
|
| 2 |
+
(given in full below). Unless stated otherwise in individual file headers,
|
| 3 |
+
all Biopython's files are under the "Biopython License Agreement".
|
| 4 |
+
|
| 5 |
+
Some files are explicitly dual licensed under your choice of the
|
| 6 |
+
"Biopython License Agreement" or the "BSD 3-Clause License" (both given
|
| 7 |
+
in full below). This is with the intention of later offering all of
|
| 8 |
+
Biopython under this dual licensing approach.
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
------------------------------------------------------------------------------
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
Biopython License Agreement
|
| 15 |
+
---------------------------
|
| 16 |
+
|
| 17 |
+
Permission to use, copy, modify, and distribute this software and its
|
| 18 |
+
documentation with or without modifications and for any purpose and
|
| 19 |
+
without fee is hereby granted, provided that any copyright notices
|
| 20 |
+
appear in all copies and that both those copyright notices and this
|
| 21 |
+
permission notice appear in supporting documentation, and that the
|
| 22 |
+
names of the contributors or copyright holders not be used in
|
| 23 |
+
advertising or publicity pertaining to distribution of the software
|
| 24 |
+
without specific prior permission.
|
| 25 |
+
|
| 26 |
+
THE CONTRIBUTORS AND COPYRIGHT HOLDERS OF THIS SOFTWARE DISCLAIM ALL
|
| 27 |
+
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
|
| 28 |
+
WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE
|
| 29 |
+
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT
|
| 30 |
+
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
| 31 |
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
| 32 |
+
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
|
| 33 |
+
OR PERFORMANCE OF THIS SOFTWARE.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
------------------------------------------------------------------------------
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
BSD 3-Clause License
|
| 40 |
+
--------------------
|
| 41 |
+
|
| 42 |
+
Copyright (c) 1999-2024, The Biopython Contributors
|
| 43 |
+
All rights reserved.
|
| 44 |
+
|
| 45 |
+
Redistribution and use in source and binary forms, with or without
|
| 46 |
+
modification, are permitted provided that the following conditions are met:
|
| 47 |
+
|
| 48 |
+
1. Redistributions of source code must retain the above copyright notice,
|
| 49 |
+
this list of conditions and the following disclaimer.
|
| 50 |
+
|
| 51 |
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
| 52 |
+
this list of conditions and the following disclaimer in the documentation
|
| 53 |
+
and/or other materials provided with the distribution.
|
| 54 |
+
|
| 55 |
+
3. Neither the name of the copyright holder nor the names of its contributors
|
| 56 |
+
may be used to endorse or promote products derived from this software
|
| 57 |
+
without specific prior written permission.
|
| 58 |
+
|
| 59 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 60 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 61 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 62 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 63 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 64 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 65 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 66 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 67 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 68 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
LICENSES/COGNI-CC0-1.0.txt
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Creative Commons Legal Code
|
| 2 |
+
|
| 3 |
+
CC0 1.0 Universal
|
| 4 |
+
|
| 5 |
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
| 6 |
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
| 7 |
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
| 8 |
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
| 9 |
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
| 10 |
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
| 11 |
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
| 12 |
+
HEREUNDER.
|
| 13 |
+
|
| 14 |
+
Statement of Purpose
|
| 15 |
+
|
| 16 |
+
The laws of most jurisdictions throughout the world automatically confer
|
| 17 |
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
| 18 |
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
| 19 |
+
authorship and/or a database (each, a "Work").
|
| 20 |
+
|
| 21 |
+
Certain owners wish to permanently relinquish those rights to a Work for
|
| 22 |
+
the purpose of contributing to a commons of creative, cultural and
|
| 23 |
+
scientific works ("Commons") that the public can reliably and without fear
|
| 24 |
+
of later claims of infringement build upon, modify, incorporate in other
|
| 25 |
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
| 26 |
+
and for any purposes, including without limitation commercial purposes.
|
| 27 |
+
These owners may contribute to the Commons to promote the ideal of a free
|
| 28 |
+
culture and the further production of creative, cultural and scientific
|
| 29 |
+
works, or to gain reputation or greater distribution for their Work in
|
| 30 |
+
part through the use and efforts of others.
|
| 31 |
+
|
| 32 |
+
For these and/or other purposes and motivations, and without any
|
| 33 |
+
expectation of additional consideration or compensation, the person
|
| 34 |
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
| 35 |
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
| 36 |
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
| 37 |
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
| 38 |
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
| 39 |
+
|
| 40 |
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
| 41 |
+
protected by copyright and related or neighboring rights ("Copyright and
|
| 42 |
+
Related Rights"). Copyright and Related Rights include, but are not
|
| 43 |
+
limited to, the following:
|
| 44 |
+
|
| 45 |
+
i. the right to reproduce, adapt, distribute, perform, display,
|
| 46 |
+
communicate, and translate a Work;
|
| 47 |
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
| 48 |
+
iii. publicity and privacy rights pertaining to a person's image or
|
| 49 |
+
likeness depicted in a Work;
|
| 50 |
+
iv. rights protecting against unfair competition in regards to a Work,
|
| 51 |
+
subject to the limitations in paragraph 4(a), below;
|
| 52 |
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
| 53 |
+
in a Work;
|
| 54 |
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
| 55 |
+
European Parliament and of the Council of 11 March 1996 on the legal
|
| 56 |
+
protection of databases, and under any national implementation
|
| 57 |
+
thereof, including any amended or successor version of such
|
| 58 |
+
directive); and
|
| 59 |
+
vii. other similar, equivalent or corresponding rights throughout the
|
| 60 |
+
world based on applicable law or treaty, and any national
|
| 61 |
+
implementations thereof.
|
| 62 |
+
|
| 63 |
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
| 64 |
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
| 65 |
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
| 66 |
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
| 67 |
+
of action, whether now known or unknown (including existing as well as
|
| 68 |
+
future claims and causes of action), in the Work (i) in all territories
|
| 69 |
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
| 70 |
+
treaty (including future time extensions), (iii) in any current or future
|
| 71 |
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
| 72 |
+
including without limitation commercial, advertising or promotional
|
| 73 |
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
| 74 |
+
member of the public at large and to the detriment of Affirmer's heirs and
|
| 75 |
+
successors, fully intending that such Waiver shall not be subject to
|
| 76 |
+
revocation, rescission, cancellation, termination, or any other legal or
|
| 77 |
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
| 78 |
+
as contemplated by Affirmer's express Statement of Purpose.
|
| 79 |
+
|
| 80 |
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
| 81 |
+
be judged legally invalid or ineffective under applicable law, then the
|
| 82 |
+
Waiver shall be preserved to the maximum extent permitted taking into
|
| 83 |
+
account Affirmer's express Statement of Purpose. In addition, to the
|
| 84 |
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
| 85 |
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
| 86 |
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
| 87 |
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
| 88 |
+
maximum duration provided by applicable law or treaty (including future
|
| 89 |
+
time extensions), (iii) in any current or future medium and for any number
|
| 90 |
+
of copies, and (iv) for any purpose whatsoever, including without
|
| 91 |
+
limitation commercial, advertising or promotional purposes (the
|
| 92 |
+
"License"). The License shall be deemed effective as of the date CC0 was
|
| 93 |
+
applied by Affirmer to the Work. Should any part of the License for any
|
| 94 |
+
reason be judged legally invalid or ineffective under applicable law, such
|
| 95 |
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
| 96 |
+
of the License, and in such case Affirmer hereby affirms that he or she
|
| 97 |
+
will not (i) exercise any of his or her remaining Copyright and Related
|
| 98 |
+
Rights in the Work or (ii) assert any associated claims and causes of
|
| 99 |
+
action with respect to the Work, in either case contrary to Affirmer's
|
| 100 |
+
express Statement of Purpose.
|
| 101 |
+
|
| 102 |
+
4. Limitations and Disclaimers.
|
| 103 |
+
|
| 104 |
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
| 105 |
+
surrendered, licensed or otherwise affected by this document.
|
| 106 |
+
b. Affirmer offers the Work as-is and makes no representations or
|
| 107 |
+
warranties of any kind concerning the Work, express, implied,
|
| 108 |
+
statutory or otherwise, including without limitation warranties of
|
| 109 |
+
title, merchantability, fitness for a particular purpose, non
|
| 110 |
+
infringement, or the absence of latent or other defects, accuracy, or
|
| 111 |
+
the present or absence of errors, whether or not discoverable, all to
|
| 112 |
+
the greatest extent permissible under applicable law.
|
| 113 |
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
| 114 |
+
that may apply to the Work or any use thereof, including without
|
| 115 |
+
limitation any person's Copyright and Related Rights in the Work.
|
| 116 |
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
| 117 |
+
consents, permissions or other rights required for any use of the
|
| 118 |
+
Work.
|
| 119 |
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
| 120 |
+
party to this document and has no duty or obligation with respect to
|
| 121 |
+
this CC0 or use of the Work.
|
LICENSES/CoolProp-MIT.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2012-2018 Ian H. Bell and other CoolProp developers
|
| 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.
|
LICENSES/KiMoPack-GPL-3.0.txt
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
GNU GENERAL PUBLIC LICENSE
|
| 2 |
+
Version 3, 29 June 2007
|
| 3 |
+
|
| 4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
| 5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
| 6 |
+
of this license document, but changing it is not allowed.
|
| 7 |
+
|
| 8 |
+
Preamble
|
| 9 |
+
|
| 10 |
+
The GNU General Public License is a free, copyleft license for
|
| 11 |
+
software and other kinds of works.
|
| 12 |
+
|
| 13 |
+
The licenses for most software and other practical works are designed
|
| 14 |
+
to take away your freedom to share and change the works. By contrast,
|
| 15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
| 16 |
+
share and change all versions of a program--to make sure it remains free
|
| 17 |
+
software for all its users. We, the Free Software Foundation, use the
|
| 18 |
+
GNU General Public License for most of our software; it applies also to
|
| 19 |
+
any other work released this way by its authors. You can apply it to
|
| 20 |
+
your programs, too.
|
| 21 |
+
|
| 22 |
+
When we speak of free software, we are referring to freedom, not
|
| 23 |
+
price. Our General Public Licenses are designed to make sure that you
|
| 24 |
+
have the freedom to distribute copies of free software (and charge for
|
| 25 |
+
them if you wish), that you receive source code or can get it if you
|
| 26 |
+
want it, that you can change the software or use pieces of it in new
|
| 27 |
+
free programs, and that you know you can do these things.
|
| 28 |
+
|
| 29 |
+
To protect your rights, we need to prevent others from denying you
|
| 30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
| 31 |
+
certain responsibilities if you distribute copies of the software, or if
|
| 32 |
+
you modify it: responsibilities to respect the freedom of others.
|
| 33 |
+
|
| 34 |
+
For example, if you distribute copies of such a program, whether
|
| 35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
| 36 |
+
freedoms that you received. You must make sure that they, too, receive
|
| 37 |
+
or can get the source code. And you must show them these terms so they
|
| 38 |
+
know their rights.
|
| 39 |
+
|
| 40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
| 41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
| 42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
| 43 |
+
|
| 44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
| 45 |
+
that there is no warranty for this free software. For both users' and
|
| 46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
| 47 |
+
changed, so that their problems will not be attributed erroneously to
|
| 48 |
+
authors of previous versions.
|
| 49 |
+
|
| 50 |
+
Some devices are designed to deny users access to install or run
|
| 51 |
+
modified versions of the software inside them, although the manufacturer
|
| 52 |
+
can do so. This is fundamentally incompatible with the aim of
|
| 53 |
+
protecting users' freedom to change the software. The systematic
|
| 54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
| 55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
| 56 |
+
have designed this version of the GPL to prohibit the practice for those
|
| 57 |
+
products. If such problems arise substantially in other domains, we
|
| 58 |
+
stand ready to extend this provision to those domains in future versions
|
| 59 |
+
of the GPL, as needed to protect the freedom of users.
|
| 60 |
+
|
| 61 |
+
Finally, every program is threatened constantly by software patents.
|
| 62 |
+
States should not allow patents to restrict development and use of
|
| 63 |
+
software on general-purpose computers, but in those that do, we wish to
|
| 64 |
+
avoid the special danger that patents applied to a free program could
|
| 65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
| 66 |
+
patents cannot be used to render the program non-free.
|
| 67 |
+
|
| 68 |
+
The precise terms and conditions for copying, distribution and
|
| 69 |
+
modification follow.
|
| 70 |
+
|
| 71 |
+
TERMS AND CONDITIONS
|
| 72 |
+
|
| 73 |
+
0. Definitions.
|
| 74 |
+
|
| 75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
| 76 |
+
|
| 77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
| 78 |
+
works, such as semiconductor masks.
|
| 79 |
+
|
| 80 |
+
"The Program" refers to any copyrightable work licensed under this
|
| 81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
| 82 |
+
"recipients" may be individuals or organizations.
|
| 83 |
+
|
| 84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
| 85 |
+
in a fashion requiring copyright permission, other than the making of an
|
| 86 |
+
exact copy. The resulting work is called a "modified version" of the
|
| 87 |
+
earlier work or a work "based on" the earlier work.
|
| 88 |
+
|
| 89 |
+
A "covered work" means either the unmodified Program or a work based
|
| 90 |
+
on the Program.
|
| 91 |
+
|
| 92 |
+
To "propagate" a work means to do anything with it that, without
|
| 93 |
+
permission, would make you directly or secondarily liable for
|
| 94 |
+
infringement under applicable copyright law, except executing it on a
|
| 95 |
+
computer or modifying a private copy. Propagation includes copying,
|
| 96 |
+
distribution (with or without modification), making available to the
|
| 97 |
+
public, and in some countries other activities as well.
|
| 98 |
+
|
| 99 |
+
To "convey" a work means any kind of propagation that enables other
|
| 100 |
+
parties to make or receive copies. Mere interaction with a user through
|
| 101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
| 102 |
+
|
| 103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
| 104 |
+
to the extent that it includes a convenient and prominently visible
|
| 105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
| 106 |
+
tells the user that there is no warranty for the work (except to the
|
| 107 |
+
extent that warranties are provided), that licensees may convey the
|
| 108 |
+
work under this License, and how to view a copy of this License. If
|
| 109 |
+
the interface presents a list of user commands or options, such as a
|
| 110 |
+
menu, a prominent item in the list meets this criterion.
|
| 111 |
+
|
| 112 |
+
1. Source Code.
|
| 113 |
+
|
| 114 |
+
The "source code" for a work means the preferred form of the work
|
| 115 |
+
for making modifications to it. "Object code" means any non-source
|
| 116 |
+
form of a work.
|
| 117 |
+
|
| 118 |
+
A "Standard Interface" means an interface that either is an official
|
| 119 |
+
standard defined by a recognized standards body, or, in the case of
|
| 120 |
+
interfaces specified for a particular programming language, one that
|
| 121 |
+
is widely used among developers working in that language.
|
| 122 |
+
|
| 123 |
+
The "System Libraries" of an executable work include anything, other
|
| 124 |
+
than the work as a whole, that (a) is included in the normal form of
|
| 125 |
+
packaging a Major Component, but which is not part of that Major
|
| 126 |
+
Component, and (b) serves only to enable use of the work with that
|
| 127 |
+
Major Component, or to implement a Standard Interface for which an
|
| 128 |
+
implementation is available to the public in source code form. A
|
| 129 |
+
"Major Component", in this context, means a major essential component
|
| 130 |
+
(kernel, window system, and so on) of the specific operating system
|
| 131 |
+
(if any) on which the executable work runs, or a compiler used to
|
| 132 |
+
produce the work, or an object code interpreter used to run it.
|
| 133 |
+
|
| 134 |
+
The "Corresponding Source" for a work in object code form means all
|
| 135 |
+
the source code needed to generate, install, and (for an executable
|
| 136 |
+
work) run the object code and to modify the work, including scripts to
|
| 137 |
+
control those activities. However, it does not include the work's
|
| 138 |
+
System Libraries, or general-purpose tools or generally available free
|
| 139 |
+
programs which are used unmodified in performing those activities but
|
| 140 |
+
which are not part of the work. For example, Corresponding Source
|
| 141 |
+
includes interface definition files associated with source files for
|
| 142 |
+
the work, and the source code for shared libraries and dynamically
|
| 143 |
+
linked subprograms that the work is specifically designed to require,
|
| 144 |
+
such as by intimate data communication or control flow between those
|
| 145 |
+
subprograms and other parts of the work.
|
| 146 |
+
|
| 147 |
+
The Corresponding Source need not include anything that users
|
| 148 |
+
can regenerate automatically from other parts of the Corresponding
|
| 149 |
+
Source.
|
| 150 |
+
|
| 151 |
+
The Corresponding Source for a work in source code form is that
|
| 152 |
+
same work.
|
| 153 |
+
|
| 154 |
+
2. Basic Permissions.
|
| 155 |
+
|
| 156 |
+
All rights granted under this License are granted for the term of
|
| 157 |
+
copyright on the Program, and are irrevocable provided the stated
|
| 158 |
+
conditions are met. This License explicitly affirms your unlimited
|
| 159 |
+
permission to run the unmodified Program. The output from running a
|
| 160 |
+
covered work is covered by this License only if the output, given its
|
| 161 |
+
content, constitutes a covered work. This License acknowledges your
|
| 162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
| 163 |
+
|
| 164 |
+
You may make, run and propagate covered works that you do not
|
| 165 |
+
convey, without conditions so long as your license otherwise remains
|
| 166 |
+
in force. You may convey covered works to others for the sole purpose
|
| 167 |
+
of having them make modifications exclusively for you, or provide you
|
| 168 |
+
with facilities for running those works, provided that you comply with
|
| 169 |
+
the terms of this License in conveying all material for which you do
|
| 170 |
+
not control copyright. Those thus making or running the covered works
|
| 171 |
+
for you must do so exclusively on your behalf, under your direction
|
| 172 |
+
and control, on terms that prohibit them from making any copies of
|
| 173 |
+
your copyrighted material outside their relationship with you.
|
| 174 |
+
|
| 175 |
+
Conveying under any other circumstances is permitted solely under
|
| 176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
| 177 |
+
makes it unnecessary.
|
| 178 |
+
|
| 179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
| 180 |
+
|
| 181 |
+
No covered work shall be deemed part of an effective technological
|
| 182 |
+
measure under any applicable law fulfilling obligations under article
|
| 183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
| 184 |
+
similar laws prohibiting or restricting circumvention of such
|
| 185 |
+
measures.
|
| 186 |
+
|
| 187 |
+
When you convey a covered work, you waive any legal power to forbid
|
| 188 |
+
circumvention of technological measures to the extent such circumvention
|
| 189 |
+
is effected by exercising rights under this License with respect to
|
| 190 |
+
the covered work, and you disclaim any intention to limit operation or
|
| 191 |
+
modification of the work as a means of enforcing, against the work's
|
| 192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
| 193 |
+
technological measures.
|
| 194 |
+
|
| 195 |
+
4. Conveying Verbatim Copies.
|
| 196 |
+
|
| 197 |
+
You may convey verbatim copies of the Program's source code as you
|
| 198 |
+
receive it, in any medium, provided that you conspicuously and
|
| 199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
| 200 |
+
keep intact all notices stating that this License and any
|
| 201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
| 202 |
+
keep intact all notices of the absence of any warranty; and give all
|
| 203 |
+
recipients a copy of this License along with the Program.
|
| 204 |
+
|
| 205 |
+
You may charge any price or no price for each copy that you convey,
|
| 206 |
+
and you may offer support or warranty protection for a fee.
|
| 207 |
+
|
| 208 |
+
5. Conveying Modified Source Versions.
|
| 209 |
+
|
| 210 |
+
You may convey a work based on the Program, or the modifications to
|
| 211 |
+
produce it from the Program, in the form of source code under the
|
| 212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
| 213 |
+
|
| 214 |
+
a) The work must carry prominent notices stating that you modified
|
| 215 |
+
it, and giving a relevant date.
|
| 216 |
+
|
| 217 |
+
b) The work must carry prominent notices stating that it is
|
| 218 |
+
released under this License and any conditions added under section
|
| 219 |
+
7. This requirement modifies the requirement in section 4 to
|
| 220 |
+
"keep intact all notices".
|
| 221 |
+
|
| 222 |
+
c) You must license the entire work, as a whole, under this
|
| 223 |
+
License to anyone who comes into possession of a copy. This
|
| 224 |
+
License will therefore apply, along with any applicable section 7
|
| 225 |
+
additional terms, to the whole of the work, and all its parts,
|
| 226 |
+
regardless of how they are packaged. This License gives no
|
| 227 |
+
permission to license the work in any other way, but it does not
|
| 228 |
+
invalidate such permission if you have separately received it.
|
| 229 |
+
|
| 230 |
+
d) If the work has interactive user interfaces, each must display
|
| 231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
| 232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
| 233 |
+
work need not make them do so.
|
| 234 |
+
|
| 235 |
+
A compilation of a covered work with other separate and independent
|
| 236 |
+
works, which are not by their nature extensions of the covered work,
|
| 237 |
+
and which are not combined with it such as to form a larger program,
|
| 238 |
+
in or on a volume of a storage or distribution medium, is called an
|
| 239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
| 240 |
+
used to limit the access or legal rights of the compilation's users
|
| 241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
| 242 |
+
in an aggregate does not cause this License to apply to the other
|
| 243 |
+
parts of the aggregate.
|
| 244 |
+
|
| 245 |
+
6. Conveying Non-Source Forms.
|
| 246 |
+
|
| 247 |
+
You may convey a covered work in object code form under the terms
|
| 248 |
+
of sections 4 and 5, provided that you also convey the
|
| 249 |
+
machine-readable Corresponding Source under the terms of this License,
|
| 250 |
+
in one of these ways:
|
| 251 |
+
|
| 252 |
+
a) Convey the object code in, or embodied in, a physical product
|
| 253 |
+
(including a physical distribution medium), accompanied by the
|
| 254 |
+
Corresponding Source fixed on a durable physical medium
|
| 255 |
+
customarily used for software interchange.
|
| 256 |
+
|
| 257 |
+
b) Convey the object code in, or embodied in, a physical product
|
| 258 |
+
(including a physical distribution medium), accompanied by a
|
| 259 |
+
written offer, valid for at least three years and valid for as
|
| 260 |
+
long as you offer spare parts or customer support for that product
|
| 261 |
+
model, to give anyone who possesses the object code either (1) a
|
| 262 |
+
copy of the Corresponding Source for all the software in the
|
| 263 |
+
product that is covered by this License, on a durable physical
|
| 264 |
+
medium customarily used for software interchange, for a price no
|
| 265 |
+
more than your reasonable cost of physically performing this
|
| 266 |
+
conveying of source, or (2) access to copy the
|
| 267 |
+
Corresponding Source from a network server at no charge.
|
| 268 |
+
|
| 269 |
+
c) Convey individual copies of the object code with a copy of the
|
| 270 |
+
written offer to provide the Corresponding Source. This
|
| 271 |
+
alternative is allowed only occasionally and noncommercially, and
|
| 272 |
+
only if you received the object code with such an offer, in accord
|
| 273 |
+
with subsection 6b.
|
| 274 |
+
|
| 275 |
+
d) Convey the object code by offering access from a designated
|
| 276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
| 277 |
+
Corresponding Source in the same way through the same place at no
|
| 278 |
+
further charge. You need not require recipients to copy the
|
| 279 |
+
Corresponding Source along with the object code. If the place to
|
| 280 |
+
copy the object code is a network server, the Corresponding Source
|
| 281 |
+
may be on a different server (operated by you or a third party)
|
| 282 |
+
that supports equivalent copying facilities, provided you maintain
|
| 283 |
+
clear directions next to the object code saying where to find the
|
| 284 |
+
Corresponding Source. Regardless of what server hosts the
|
| 285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
| 286 |
+
available for as long as needed to satisfy these requirements.
|
| 287 |
+
|
| 288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
| 289 |
+
you inform other peers where the object code and Corresponding
|
| 290 |
+
Source of the work are being offered to the general public at no
|
| 291 |
+
charge under subsection 6d.
|
| 292 |
+
|
| 293 |
+
A separable portion of the object code, whose source code is excluded
|
| 294 |
+
from the Corresponding Source as a System Library, need not be
|
| 295 |
+
included in conveying the object code work.
|
| 296 |
+
|
| 297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
| 298 |
+
tangible personal property which is normally used for personal, family,
|
| 299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
| 300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
| 301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
| 302 |
+
product received by a particular user, "normally used" refers to a
|
| 303 |
+
typical or common use of that class of product, regardless of the status
|
| 304 |
+
of the particular user or of the way in which the particular user
|
| 305 |
+
actually uses, or expects or is expected to use, the product. A product
|
| 306 |
+
is a consumer product regardless of whether the product has substantial
|
| 307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
| 308 |
+
the only significant mode of use of the product.
|
| 309 |
+
|
| 310 |
+
"Installation Information" for a User Product means any methods,
|
| 311 |
+
procedures, authorization keys, or other information required to install
|
| 312 |
+
and execute modified versions of a covered work in that User Product from
|
| 313 |
+
a modified version of its Corresponding Source. The information must
|
| 314 |
+
suffice to ensure that the continued functioning of the modified object
|
| 315 |
+
code is in no case prevented or interfered with solely because
|
| 316 |
+
modification has been made.
|
| 317 |
+
|
| 318 |
+
If you convey an object code work under this section in, or with, or
|
| 319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
| 320 |
+
part of a transaction in which the right of possession and use of the
|
| 321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
| 322 |
+
fixed term (regardless of how the transaction is characterized), the
|
| 323 |
+
Corresponding Source conveyed under this section must be accompanied
|
| 324 |
+
by the Installation Information. But this requirement does not apply
|
| 325 |
+
if neither you nor any third party retains the ability to install
|
| 326 |
+
modified object code on the User Product (for example, the work has
|
| 327 |
+
been installed in ROM).
|
| 328 |
+
|
| 329 |
+
The requirement to provide Installation Information does not include a
|
| 330 |
+
requirement to continue to provide support service, warranty, or updates
|
| 331 |
+
for a work that has been modified or installed by the recipient, or for
|
| 332 |
+
the User Product in which it has been modified or installed. Access to a
|
| 333 |
+
network may be denied when the modification itself materially and
|
| 334 |
+
adversely affects the operation of the network or violates the rules and
|
| 335 |
+
protocols for communication across the network.
|
| 336 |
+
|
| 337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
| 338 |
+
in accord with this section must be in a format that is publicly
|
| 339 |
+
documented (and with an implementation available to the public in
|
| 340 |
+
source code form), and must require no special password or key for
|
| 341 |
+
unpacking, reading or copying.
|
| 342 |
+
|
| 343 |
+
7. Additional Terms.
|
| 344 |
+
|
| 345 |
+
"Additional permissions" are terms that supplement the terms of this
|
| 346 |
+
License by making exceptions from one or more of its conditions.
|
| 347 |
+
Additional permissions that are applicable to the entire Program shall
|
| 348 |
+
be treated as though they were included in this License, to the extent
|
| 349 |
+
that they are valid under applicable law. If additional permissions
|
| 350 |
+
apply only to part of the Program, that part may be used separately
|
| 351 |
+
under those permissions, but the entire Program remains governed by
|
| 352 |
+
this License without regard to the additional permissions.
|
| 353 |
+
|
| 354 |
+
When you convey a copy of a covered work, you may at your option
|
| 355 |
+
remove any additional permissions from that copy, or from any part of
|
| 356 |
+
it. (Additional permissions may be written to require their own
|
| 357 |
+
removal in certain cases when you modify the work.) You may place
|
| 358 |
+
additional permissions on material, added by you to a covered work,
|
| 359 |
+
for which you have or can give appropriate copyright permission.
|
| 360 |
+
|
| 361 |
+
Notwithstanding any other provision of this License, for material you
|
| 362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
| 363 |
+
that material) supplement the terms of this License with terms:
|
| 364 |
+
|
| 365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
| 366 |
+
terms of sections 15 and 16 of this License; or
|
| 367 |
+
|
| 368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
| 369 |
+
author attributions in that material or in the Appropriate Legal
|
| 370 |
+
Notices displayed by works containing it; or
|
| 371 |
+
|
| 372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
| 373 |
+
requiring that modified versions of such material be marked in
|
| 374 |
+
reasonable ways as different from the original version; or
|
| 375 |
+
|
| 376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
| 377 |
+
authors of the material; or
|
| 378 |
+
|
| 379 |
+
e) Declining to grant rights under trademark law for use of some
|
| 380 |
+
trade names, trademarks, or service marks; or
|
| 381 |
+
|
| 382 |
+
f) Requiring indemnification of licensors and authors of that
|
| 383 |
+
material by anyone who conveys the material (or modified versions of
|
| 384 |
+
it) with contractual assumptions of liability to the recipient, for
|
| 385 |
+
any liability that these contractual assumptions directly impose on
|
| 386 |
+
those licensors and authors.
|
| 387 |
+
|
| 388 |
+
All other non-permissive additional terms are considered "further
|
| 389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
| 390 |
+
received it, or any part of it, contains a notice stating that it is
|
| 391 |
+
governed by this License along with a term that is a further
|
| 392 |
+
restriction, you may remove that term. If a license document contains
|
| 393 |
+
a further restriction but permits relicensing or conveying under this
|
| 394 |
+
License, you may add to a covered work material governed by the terms
|
| 395 |
+
of that license document, provided that the further restriction does
|
| 396 |
+
not survive such relicensing or conveying.
|
| 397 |
+
|
| 398 |
+
If you add terms to a covered work in accord with this section, you
|
| 399 |
+
must place, in the relevant source files, a statement of the
|
| 400 |
+
additional terms that apply to those files, or a notice indicating
|
| 401 |
+
where to find the applicable terms.
|
| 402 |
+
|
| 403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
| 404 |
+
form of a separately written license, or stated as exceptions;
|
| 405 |
+
the above requirements apply either way.
|
| 406 |
+
|
| 407 |
+
8. Termination.
|
| 408 |
+
|
| 409 |
+
You may not propagate or modify a covered work except as expressly
|
| 410 |
+
provided under this License. Any attempt otherwise to propagate or
|
| 411 |
+
modify it is void, and will automatically terminate your rights under
|
| 412 |
+
this License (including any patent licenses granted under the third
|
| 413 |
+
paragraph of section 11).
|
| 414 |
+
|
| 415 |
+
However, if you cease all violation of this License, then your
|
| 416 |
+
license from a particular copyright holder is reinstated (a)
|
| 417 |
+
provisionally, unless and until the copyright holder explicitly and
|
| 418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
| 419 |
+
holder fails to notify you of the violation by some reasonable means
|
| 420 |
+
prior to 60 days after the cessation.
|
| 421 |
+
|
| 422 |
+
Moreover, your license from a particular copyright holder is
|
| 423 |
+
reinstated permanently if the copyright holder notifies you of the
|
| 424 |
+
violation by some reasonable means, this is the first time you have
|
| 425 |
+
received notice of violation of this License (for any work) from that
|
| 426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
| 427 |
+
your receipt of the notice.
|
| 428 |
+
|
| 429 |
+
Termination of your rights under this section does not terminate the
|
| 430 |
+
licenses of parties who have received copies or rights from you under
|
| 431 |
+
this License. If your rights have been terminated and not permanently
|
| 432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
| 433 |
+
material under section 10.
|
| 434 |
+
|
| 435 |
+
9. Acceptance Not Required for Having Copies.
|
| 436 |
+
|
| 437 |
+
You are not required to accept this License in order to receive or
|
| 438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
| 439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
| 440 |
+
to receive a copy likewise does not require acceptance. However,
|
| 441 |
+
nothing other than this License grants you permission to propagate or
|
| 442 |
+
modify any covered work. These actions infringe copyright if you do
|
| 443 |
+
not accept this License. Therefore, by modifying or propagating a
|
| 444 |
+
covered work, you indicate your acceptance of this License to do so.
|
| 445 |
+
|
| 446 |
+
10. Automatic Licensing of Downstream Recipients.
|
| 447 |
+
|
| 448 |
+
Each time you convey a covered work, the recipient automatically
|
| 449 |
+
receives a license from the original licensors, to run, modify and
|
| 450 |
+
propagate that work, subject to this License. You are not responsible
|
| 451 |
+
for enforcing compliance by third parties with this License.
|
| 452 |
+
|
| 453 |
+
An "entity transaction" is a transaction transferring control of an
|
| 454 |
+
organization, or substantially all assets of one, or subdividing an
|
| 455 |
+
organization, or merging organizations. If propagation of a covered
|
| 456 |
+
work results from an entity transaction, each party to that
|
| 457 |
+
transaction who receives a copy of the work also receives whatever
|
| 458 |
+
licenses to the work the party's predecessor in interest had or could
|
| 459 |
+
give under the previous paragraph, plus a right to possession of the
|
| 460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
| 461 |
+
the predecessor has it or can get it with reasonable efforts.
|
| 462 |
+
|
| 463 |
+
You may not impose any further restrictions on the exercise of the
|
| 464 |
+
rights granted or affirmed under this License. For example, you may
|
| 465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
| 466 |
+
rights granted under this License, and you may not initiate litigation
|
| 467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
| 468 |
+
any patent claim is infringed by making, using, selling, offering for
|
| 469 |
+
sale, or importing the Program or any portion of it.
|
| 470 |
+
|
| 471 |
+
11. Patents.
|
| 472 |
+
|
| 473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
| 474 |
+
License of the Program or a work on which the Program is based. The
|
| 475 |
+
work thus licensed is called the contributor's "contributor version".
|
| 476 |
+
|
| 477 |
+
A contributor's "essential patent claims" are all patent claims
|
| 478 |
+
owned or controlled by the contributor, whether already acquired or
|
| 479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
| 480 |
+
by this License, of making, using, or selling its contributor version,
|
| 481 |
+
but do not include claims that would be infringed only as a
|
| 482 |
+
consequence of further modification of the contributor version. For
|
| 483 |
+
purposes of this definition, "control" includes the right to grant
|
| 484 |
+
patent sublicenses in a manner consistent with the requirements of
|
| 485 |
+
this License.
|
| 486 |
+
|
| 487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
| 488 |
+
patent license under the contributor's essential patent claims, to
|
| 489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
| 490 |
+
propagate the contents of its contributor version.
|
| 491 |
+
|
| 492 |
+
In the following three paragraphs, a "patent license" is any express
|
| 493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
| 494 |
+
(such as an express permission to practice a patent or covenant not to
|
| 495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
| 496 |
+
party means to make such an agreement or commitment not to enforce a
|
| 497 |
+
patent against the party.
|
| 498 |
+
|
| 499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
| 500 |
+
and the Corresponding Source of the work is not available for anyone
|
| 501 |
+
to copy, free of charge and under the terms of this License, through a
|
| 502 |
+
publicly available network server or other readily accessible means,
|
| 503 |
+
then you must either (1) cause the Corresponding Source to be so
|
| 504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
| 505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
| 506 |
+
consistent with the requirements of this License, to extend the patent
|
| 507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
| 508 |
+
actual knowledge that, but for the patent license, your conveying the
|
| 509 |
+
covered work in a country, or your recipient's use of the covered work
|
| 510 |
+
in a country, would infringe one or more identifiable patents in that
|
| 511 |
+
country that you have reason to believe are valid.
|
| 512 |
+
|
| 513 |
+
If, pursuant to or in connection with a single transaction or
|
| 514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
| 515 |
+
covered work, and grant a patent license to some of the parties
|
| 516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
| 517 |
+
or convey a specific copy of the covered work, then the patent license
|
| 518 |
+
you grant is automatically extended to all recipients of the covered
|
| 519 |
+
work and works based on it.
|
| 520 |
+
|
| 521 |
+
A patent license is "discriminatory" if it does not include within
|
| 522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
| 523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
| 524 |
+
specifically granted under this License. You may not convey a covered
|
| 525 |
+
work if you are a party to an arrangement with a third party that is
|
| 526 |
+
in the business of distributing software, under which you make payment
|
| 527 |
+
to the third party based on the extent of your activity of conveying
|
| 528 |
+
the work, and under which the third party grants, to any of the
|
| 529 |
+
parties who would receive the covered work from you, a discriminatory
|
| 530 |
+
patent license (a) in connection with copies of the covered work
|
| 531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
| 532 |
+
for and in connection with specific products or compilations that
|
| 533 |
+
contain the covered work, unless you entered into that arrangement,
|
| 534 |
+
or that patent license was granted, prior to 28 March 2007.
|
| 535 |
+
|
| 536 |
+
Nothing in this License shall be construed as excluding or limiting
|
| 537 |
+
any implied license or other defenses to infringement that may
|
| 538 |
+
otherwise be available to you under applicable patent law.
|
| 539 |
+
|
| 540 |
+
12. No Surrender of Others' Freedom.
|
| 541 |
+
|
| 542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
| 543 |
+
otherwise) that contradict the conditions of this License, they do not
|
| 544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
| 545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
| 546 |
+
License and any other pertinent obligations, then as a consequence you may
|
| 547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
| 548 |
+
to collect a royalty for further conveying from those to whom you convey
|
| 549 |
+
the Program, the only way you could satisfy both those terms and this
|
| 550 |
+
License would be to refrain entirely from conveying the Program.
|
| 551 |
+
|
| 552 |
+
13. Use with the GNU Affero General Public License.
|
| 553 |
+
|
| 554 |
+
Notwithstanding any other provision of this License, you have
|
| 555 |
+
permission to link or combine any covered work with a work licensed
|
| 556 |
+
under version 3 of the GNU Affero General Public License into a single
|
| 557 |
+
combined work, and to convey the resulting work. The terms of this
|
| 558 |
+
License will continue to apply to the part which is the covered work,
|
| 559 |
+
but the special requirements of the GNU Affero General Public License,
|
| 560 |
+
section 13, concerning interaction through a network will apply to the
|
| 561 |
+
combination as such.
|
| 562 |
+
|
| 563 |
+
14. Revised Versions of this License.
|
| 564 |
+
|
| 565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
| 566 |
+
the GNU General Public License from time to time. Such new versions will
|
| 567 |
+
be similar in spirit to the present version, but may differ in detail to
|
| 568 |
+
address new problems or concerns.
|
| 569 |
+
|
| 570 |
+
Each version is given a distinguishing version number. If the
|
| 571 |
+
Program specifies that a certain numbered version of the GNU General
|
| 572 |
+
Public License "or any later version" applies to it, you have the
|
| 573 |
+
option of following the terms and conditions either of that numbered
|
| 574 |
+
version or of any later version published by the Free Software
|
| 575 |
+
Foundation. If the Program does not specify a version number of the
|
| 576 |
+
GNU General Public License, you may choose any version ever published
|
| 577 |
+
by the Free Software Foundation.
|
| 578 |
+
|
| 579 |
+
If the Program specifies that a proxy can decide which future
|
| 580 |
+
versions of the GNU General Public License can be used, that proxy's
|
| 581 |
+
public statement of acceptance of a version permanently authorizes you
|
| 582 |
+
to choose that version for the Program.
|
| 583 |
+
|
| 584 |
+
Later license versions may give you additional or different
|
| 585 |
+
permissions. However, no additional obligations are imposed on any
|
| 586 |
+
author or copyright holder as a result of your choosing to follow a
|
| 587 |
+
later version.
|
| 588 |
+
|
| 589 |
+
15. Disclaimer of Warranty.
|
| 590 |
+
|
| 591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
| 592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
| 593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
| 594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
| 595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| 596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
| 597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
| 598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
| 599 |
+
|
| 600 |
+
16. Limitation of Liability.
|
| 601 |
+
|
| 602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
| 603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
| 604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
| 605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
| 606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
| 607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
| 608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
| 609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
| 610 |
+
SUCH DAMAGES.
|
| 611 |
+
|
| 612 |
+
17. Interpretation of Sections 15 and 16.
|
| 613 |
+
|
| 614 |
+
If the disclaimer of warranty and limitation of liability provided
|
| 615 |
+
above cannot be given local legal effect according to their terms,
|
| 616 |
+
reviewing courts shall apply local law that most closely approximates
|
| 617 |
+
an absolute waiver of all civil liability in connection with the
|
| 618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
| 619 |
+
copy of the Program in return for a fee.
|
| 620 |
+
|
| 621 |
+
END OF TERMS AND CONDITIONS
|
| 622 |
+
|
| 623 |
+
How to Apply These Terms to Your New Programs
|
| 624 |
+
|
| 625 |
+
If you develop a new program, and you want it to be of the greatest
|
| 626 |
+
possible use to the public, the best way to achieve this is to make it
|
| 627 |
+
free software which everyone can redistribute and change under these terms.
|
| 628 |
+
|
| 629 |
+
To do so, attach the following notices to the program. It is safest
|
| 630 |
+
to attach them to the start of each source file to most effectively
|
| 631 |
+
state the exclusion of warranty; and each file should have at least
|
| 632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
| 633 |
+
|
| 634 |
+
<one line to give the program's name and a brief idea of what it does.>
|
| 635 |
+
Copyright (C) <year> <name of author>
|
| 636 |
+
|
| 637 |
+
This program is free software: you can redistribute it and/or modify
|
| 638 |
+
it under the terms of the GNU General Public License as published by
|
| 639 |
+
the Free Software Foundation, either version 3 of the License, or
|
| 640 |
+
(at your option) any later version.
|
| 641 |
+
|
| 642 |
+
This program is distributed in the hope that it will be useful,
|
| 643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 645 |
+
GNU General Public License for more details.
|
| 646 |
+
|
| 647 |
+
You should have received a copy of the GNU General Public License
|
| 648 |
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 649 |
+
|
| 650 |
+
Also add information on how to contact you by electronic and paper mail.
|
| 651 |
+
|
| 652 |
+
If the program does terminal interaction, make it output a short
|
| 653 |
+
notice like this when it starts in an interactive mode:
|
| 654 |
+
|
| 655 |
+
<program> Copyright (C) <year> <name of author>
|
| 656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
| 657 |
+
This is free software, and you are welcome to redistribute it
|
| 658 |
+
under certain conditions; type `show c' for details.
|
| 659 |
+
|
| 660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
| 661 |
+
parts of the General Public License. Of course, your program's commands
|
| 662 |
+
might be different; for a GUI interface, you would use an "about box".
|
| 663 |
+
|
| 664 |
+
You should also get your employer (if you work as a programmer) or school,
|
| 665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
| 666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
| 667 |
+
<https://www.gnu.org/licenses/>.
|
| 668 |
+
|
| 669 |
+
The GNU General Public License does not permit incorporating your program
|
| 670 |
+
into proprietary programs. If your program is a subroutine library, you
|
| 671 |
+
may consider it more useful to permit linking proprietary applications with
|
| 672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
| 673 |
+
Public License instead of this License. But first, please read
|
| 674 |
+
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
LICENSES/OPERA-MIT.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2016 kmansouri
|
| 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.
|
LICENSES/XrayDB.txt
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT Licene
|
| 2 |
+
|
| 3 |
+
Copyright 2025 Matthew Newville, The University of Chicago, newville@cars.uchicago.edu
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
| 6 |
+
associated documentation files (the "Software"), to deal in the Software without restriction,
|
| 7 |
+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
| 8 |
+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
| 9 |
+
furnished to do so, subject to the following conditions:
|
| 10 |
+
|
| 11 |
+
The above copyright notice and this permission notice shall be included in all copies or
|
| 12 |
+
substantial portions of the Software.
|
| 13 |
+
|
| 14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
| 15 |
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 16 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
| 17 |
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
| 18 |
+
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
LICENSES/chemicals-MIT.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021 Caleb Bell <Caleb.Andrew.Bell@gmail.com>
|
| 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.
|
LICENSES/openpoly-MIT.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2025 WangGroupFDU
|
| 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.
|
LICENSES/srsinst-rga-MIT.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2022, 2023 Stanford Research Systems
|
| 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.
|
LICENSES/teMatDb-MIT.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
> ⚠️ Note: This repository depends on [`pykeri`](https://github.com/byungkiryu/teMatDb/tree/main/pykeri), which is developed and licensed separately. See the pykeri repository for more details.
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
MIT License
|
| 5 |
+
|
| 6 |
+
Copyright (c) 2025 Byungki Ryu
|
| 7 |
+
|
| 8 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 9 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 10 |
+
in the Software without restriction, including without limitation the rights
|
| 11 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 12 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 13 |
+
furnished to do so, subject to the following conditions:
|
| 14 |
+
|
| 15 |
+
The above copyright notice and this permission notice shall be included in
|
| 16 |
+
all copies or substantial portions of the Software.
|
| 17 |
+
|
| 18 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 19 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 20 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
catalog/catalog.csv
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
id,chem_id,name,maker,model,name_zh,domain_name,path,n_components,n_joints,n_state_slots,n_capabilities,n_readouts,n_interface_points,n_sources,output_templates,size_x_m,size_y_m,size_z_m,glb,urdf,contract
|
| 2 |
+
instrument.mt_xpr204e,CHEM-001,Analytical balance,METTLER TOLEDO,XPR204E,CHEM-001 分析天平(METTLER TOLEDO XPR204E目标;PX224E功能族几何),Basic Metrology & Sample Handling,assets/basic40_batch02/t4_measure/mt_xpr204e,25,16,22,9,1,1,14,False,0.209,0.3286,0.309,assets/basic40_batch02/t4_measure/mt_xpr204e/model.glb,assets/basic40_batch02/t4_measure/mt_xpr204e/model.urdf,assets/basic40_batch02/t4_measure/mt_xpr204e/asset.contract.json
|
| 3 |
+
instrument.mt_hx204,CHEM-002,Halogen moisture analyzer,METTLER TOLEDO,HX204,METTLER TOLEDO HX204 卤素水分测定仪,Basic Metrology & Sample Handling,assets/expansion_batch04/t4_measure/mt_hx204,56,5,14,8,2,1,6,False,0.2309,0.597,0.1437,assets/expansion_batch04/t4_measure/mt_hx204/model.glb,assets/expansion_batch04/t4_measure/mt_hx204/model.urdf,assets/expansion_batch04/t4_measure/mt_hx204/asset.contract.json
|
| 4 |
+
instrument.antonpaar_dma5002,CHEM-003,Oscillating U-tube density meter,Anton Paar,DMA 5002,Anton Paar DMA 5002振动管液体密度计,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/antonpaar_dma5002,39,4,17,9,2,2,5,False,0.3607,0.5298,0.252,assets/expansion_batch03/t4_measure/antonpaar_dma5002/model.glb,assets/expansion_batch03/t4_measure/antonpaar_dma5002/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_dma5002/asset.contract.json
|
| 5 |
+
instrument.antonpaar_abbematadvanced,CHEM-004,Digital refractometer,Anton Paar,Abbemat Advanced 5201,Anton Paar Abbemat Advanced 5201数字折射仪,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced,38,5,19,10,3,1,5,False,0.2261,0.3338,0.1242,assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/model.glb,assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_abbematadvanced/asset.contract.json
|
| 6 |
+
instrument.metrohm_914,CHEM-005,pH / DO / conductivity meter,Metrohm,914 pH/DO/Conductometer,CHEM-005 多参数电化学水质测定仪 — Metrohm 914 pH/DO/Conductometer,Basic Metrology & Sample Handling,assets/basic40_batch02/t4_measure/metrohm_914,11,3,44,11,0,0,7,False,0.2062,0.208,0.0551,assets/basic40_batch02/t4_measure/metrohm_914/model.glb,assets/basic40_batch02/t4_measure/metrohm_914/model.urdf,assets/basic40_batch02/t4_measure/metrohm_914/asset.contract.json
|
| 7 |
+
instrument.mt_mp70,CHEM-006,Automatic melting-point system,METTLER TOLEDO,MP70,METTLER TOLEDO MP70自动熔点仪,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/mt_mp70,51,4,26,10,3,4,6,False,0.1806,0.3519,0.19,assets/expansion_batch03/t4_measure/mt_mp70/model.glb,assets/expansion_batch03/t4_measure/mt_mp70/model.urdf,assets/expansion_batch03/t4_measure/mt_mp70/asset.contract.json
|
| 8 |
+
instrument.aqualab_4te,CHEM-007,Water-activity meter,AQUALAB,4TE,AQUALAB 4TE水活度仪,Basic Metrology & Sample Handling,assets/expansion_batch04/t4_measure/aqualab_4te,39,10,27,13,2,1,6,False,0.267,0.184,0.129,assets/expansion_batch04/t4_measure/aqualab_4te/model.glb,assets/expansion_batch04/t4_measure/aqualab_4te/model.urdf,assets/expansion_batch04/t4_measure/aqualab_4te/asset.contract.json
|
| 9 |
+
instrument.ika_plate_rctdigital,CHEM-008,Magnetic hotplate stirrer,IKA,Plate RCT digital,磁力加热搅拌器IKA Plate (RCT digital)(25004601,附PT1000),Basic Metrology & Sample Handling,assets/expansion_batch05/t4_measure/ika_plate_rctdigital,31,8,33,33,13,7,14,True,0.16,0.27,0.0849,assets/expansion_batch05/t4_measure/ika_plate_rctdigital/model.glb,assets/expansion_batch05/t4_measure/ika_plate_rctdigital/model.urdf,assets/expansion_batch05/t4_measure/ika_plate_rctdigital/asset.contract.json
|
| 10 |
+
instrument.ika_ks4000,CHEM-009,Incubated orbital shaker,IKA,KS 4000 i control,IKA KS 4000 i control恒温轨道摇床,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/ika_ks4000,48,14,33,14,3,9,7,False,0.58,0.75,0.52,assets/expansion_batch03/t4_measure/ika_ks4000/model.glb,assets/expansion_batch03/t4_measure/ika_ks4000/model.urdf,assets/expansion_batch03/t4_measure/ika_ks4000/asset.contract.json
|
| 11 |
+
instrument.eppendorf_5910ri,CHEM-010,Refrigerated multipurpose centrifuge,Eppendorf,5910 Ri,CHEM-010 冷冻多用途离心机 Eppendorf 5910 Ri,Basic Metrology & Sample Handling,assets/basic40_batch02/t3_analytical/eppendorf_5910ri,16,2,23,13,2,24,11,False,0.72,0.68,0.37,assets/basic40_batch02/t3_analytical/eppendorf_5910ri/model.glb,assets/basic40_batch02/t3_analytical/eppendorf_5910ri/model.urdf,assets/basic40_batch02/t3_analytical/eppendorf_5910ri/asset.contract.json
|
| 12 |
+
instrument.binder_fd056,CHEM-011,Forced-convection drying oven,BINDER,FD 56,强制对流干燥箱BINDER FD 56(FD056-230V,标准配置),Basic Metrology & Sample Handling,assets/expansion_batch05/t4_measure/binder_fd056,34,7,25,32,6,8,15,True,0.564,0.6425,0.625,assets/expansion_batch05/t4_measure/binder_fd056/model.glb,assets/expansion_batch05/t4_measure/binder_fd056/model.urdf,assets/expansion_batch05/t4_measure/binder_fd056/asset.contract.json
|
| 13 |
+
instrument.binder_vd56,CHEM-012,Vacuum drying oven,BINDER,VD 56,BINDER VD 56 真空干燥箱(标准单铝搁板配置),Basic Metrology & Sample Handling,assets/basic40_batch02/t1_thermal/binder_vd56,24,7,10,6,1,6,14,False,0.638,0.538,0.815,assets/basic40_batch02/t1_thermal/binder_vd56/model.glb,assets/basic40_batch02/t1_thermal/binder_vd56/model.urdf,assets/basic40_batch02/t1_thermal/binder_vd56/asset.contract.json
|
| 14 |
+
instrument.elma_elmasonics60h,CHEM-013,Ultrasonic cleaning bath,Elma,Elmasonic S60H,Elma Elmasonic S60H原版超声清洗槽,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/elma_elmasonics60h,38,8,56,15,26,2,5,False,0.365,0.2104,0.2727,assets/expansion_batch03/t4_measure/elma_elmasonics60h/model.glb,assets/expansion_batch03/t4_measure/elma_elmasonics60h/model.urdf,assets/expansion_batch03/t4_measure/elma_elmasonics60h/asset.contract.json
|
| 15 |
+
instrument.hach_tl2300epa,CHEM-014,Benchtop turbidimeter,Hach,TL2300 EPA,Hach TL2300 EPA钨灯台式浊度仪,Basic Metrology & Sample Handling,assets/expansion_batch03/t4_measure/hach_tl2300epa,33,2,26,11,3,2,7,False,0.3956,0.309,0.1534,assets/expansion_batch03/t4_measure/hach_tl2300epa/model.glb,assets/expansion_batch03/t4_measure/hach_tl2300epa/model.urdf,assets/expansion_batch03/t4_measure/hach_tl2300epa/asset.contract.json
|
| 16 |
+
instrument.antonpaar_monowave400,CHEM-015,Microwave synthesis reactor,Anton Paar,Monowave 400,Anton Paar Monowave 400微波合成反应器,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/antonpaar_monowave400,40,3,32,12,3,2,11,False,0.4204,0.5594,0.3102,assets/expansion_batch03/t5_automation/antonpaar_monowave400/model.glb,assets/expansion_batch03/t5_automation/antonpaar_monowave400/model.urdf,assets/expansion_batch03/t5_automation/antonpaar_monowave400/asset.contract.json
|
| 17 |
+
instrument.ika_electrasyn2,CHEM-016,Electro-organic synthesis system,IKA,ElectraSyn 2.0,IKA ElectraSyn 2.0 Package电有机合成仪,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/ika_electrasyn2,36,2,40,12,4,1,10,False,0.13,0.2509,0.15,assets/expansion_batch03/t5_automation/ika_electrasyn2/model.glb,assets/expansion_batch03/t5_automation/ika_electrasyn2/model.urdf,assets/expansion_batch03/t5_automation/ika_electrasyn2/asset.contract.json
|
| 18 |
+
instrument.hepatochem_photoredoxbox,CHEM-017,Photochemical reactor,HepatoChem,PhotoRedOx Box UV-Vis,HepatoChem PhotoRedOx Box UV-Vis HCK1022-01-001受控光反应器,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox,62,3,36,15,3,8,7,False,0.3556,0.3556,0.3048,assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/model.glb,assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/model.urdf,assets/expansion_batch03/t5_automation/hepatochem_photoredoxbox/asset.contract.json
|
| 19 |
+
instrument.parr_4591,CHEM-018,Micro high-pressure stirred reactor,Parr Instrument,4591,微型高压搅拌反应釜 Parr Instrument 4591(标准FKM密封),Reaction & Molecular Synthesis,assets/basic40_batch02/t1_thermal/parr_4591,30,9,22,10,1,1,10,False,0.3048,0.4572,0.6858,assets/basic40_batch02/t1_thermal/parr_4591/model.glb,assets/basic40_batch02/t1_thermal/parr_4591/model.urdf,assets/basic40_batch02/t1_thermal/parr_4591/asset.contract.json
|
| 20 |
+
instrument.syrris_asiadiscovery,CHEM-019,Continuous-flow chemistry system,Syrris,Asia Discovery,Syrris Asia Discovery Regular 连续流化学合成系统,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/syrris_asiadiscovery,66,4,38,13,3,11,16,False,1.23,0.3103,0.48,assets/expansion_batch03/t5_automation/syrris_asiadiscovery/model.glb,assets/expansion_batch03/t5_automation/syrris_asiadiscovery/model.urdf,assets/expansion_batch03/t5_automation/syrris_asiadiscovery/asset.contract.json
|
| 21 |
+
instrument.thalesnano_hcube,CHEM-020,Continuous-flow hydrogenation reactor,ThalesNano,H-Cube Pro,ThalesNano H-Cube Pro 连续流催化加氢仪,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/thalesnano_hcube,70,5,41,17,3,6,11,False,0.4962,0.5095,0.2745,assets/expansion_batch03/t5_automation/thalesnano_hcube/model.glb,assets/expansion_batch03/t5_automation/thalesnano_hcube/model.urdf,assets/expansion_batch03/t5_automation/thalesnano_hcube/asset.contract.json
|
| 22 |
+
instrument.radleys_mya4,CHEM-021,Parallel reaction station (4 independent zones),Radleys,Mya 4,独立温区并行反应工作站 Radleys Mya 4,Reaction & Molecular Synthesis,assets/basic40_batch02/t1_thermal/radleys_mya4,33,4,92,15,4,4,12,False,0.6,0.611,0.4992,assets/basic40_batch02/t1_thermal/radleys_mya4/model.glb,assets/basic40_batch02/t1_thermal/radleys_mya4/model.urdf,assets/basic40_batch02/t1_thermal/radleys_mya4/asset.contract.json
|
| 23 |
+
instrument.cem_libertyblue,CHEM-022,Automated microwave peptide synthesizer,CEM,Liberty Blue 2.0,CEM Liberty Blue 2.0 自动固相多肽合成仪,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/cem_libertyblue,103,2,34,13,3,47,15,False,1.15,0.52,0.78,assets/expansion_batch03/t5_automation/cem_libertyblue/model.glb,assets/expansion_batch03/t5_automation/cem_libertyblue/model.urdf,assets/expansion_batch03/t5_automation/cem_libertyblue/asset.contract.json
|
| 24 |
+
instrument.cytiva_ktaoligosynt,CHEM-023,Oligonucleotide synthesizer,Cytiva,ÄKTA oligosynt,Cytiva ÄKTA oligosynt 寡核苷酸合成仪,Reaction & Molecular Synthesis,assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt,116,3,31,12,3,53,15,False,0.7,0.54,0.63,assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/model.glb,assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/model.urdf,assets/expansion_batch03/t5_automation/cytiva_ktaoligosynt/asset.contract.json
|
| 25 |
+
instrument.ika_rv10_digital_v,CHEM-024,Rotary evaporator,IKA,RV 10 digital V,IKA RV 10 digital V 旋转蒸发仪,"Extraction, Purification & Drying",assets/basic40_batch02/t2_vacuum/ika_rv10,23,5,26,10,2,2,13,False,0.5,0.44,0.6822,assets/basic40_batch02/t2_vacuum/ika_rv10/model.glb,assets/basic40_batch02/t2_vacuum/ika_rv10/model.urdf,assets/basic40_batch02/t2_vacuum/ika_rv10/asset.contract.json
|
| 26 |
+
instrument.buchi_lyovapor_l250_pro,CHEM-025,Freeze dryer,BUCHI,Lyovapor L-250 Pro,冷冻干燥机 BUCHI Lyovapor L-250 Pro,"Extraction, Purification & Drying",assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250,14,3,34,13,3,4,8,False,0.503,0.645,0.9275,assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/model.glb,assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/model.urdf,assets/basic40_batch02/t2_vacuum/buchi_lyovapor_l250/asset.contract.json
|
| 27 |
+
instrument.buchi_minispray,CHEM-026,Lab spray dryer,BUCHI,Mini Spray Dryer S-300,BUCHI Mini Spray Dryer S-300 实验室喷雾干燥机,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/buchi_minispray,62,2,26,16,3,13,11,False,0.62,0.64,1.052,assets/expansion_batch03/t2_vacuum/buchi_minispray/model.glb,assets/expansion_batch03/t2_vacuum/buchi_minispray/model.urdf,assets/expansion_batch03/t2_vacuum/buchi_minispray/asset.contract.json
|
| 28 |
+
instrument.tousimis_autosamdri815,CHEM-027,Critical point dryer,Tousimis,Autosamdri-815 Series B,Tousimis Autosamdri-815 Series B 8779C 临界点干燥仪,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815,66,2,30,13,3,8,12,False,0.598,0.546,0.32,assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/model.glb,assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/model.urdf,assets/expansion_batch03/t2_vacuum/tousimis_autosamdri815/asset.contract.json
|
| 29 |
+
instrument.buchi_speedextractore,CHEM-028,Pressurized solvent extractor,BUCHI,SpeedExtractor E-916,BUCHI SpeedExtractor E-916 六位四溶剂加压萃取仪,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/buchi_speedextractore,138,4,33,14,3,24,14,False,0.67,0.5,0.725,assets/expansion_batch03/t2_vacuum/buchi_speedextractore/model.glb,assets/expansion_batch03/t2_vacuum/buchi_speedextractore/model.urdf,assets/expansion_batch03/t2_vacuum/buchi_speedextractore/asset.contract.json
|
| 30 |
+
instrument.gilson_cpc250,CHEM-029,Centrifugal partition chromatograph,Gilson,CPC 250,Gilson CPC250与PLC2050液液分配纯化系统,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/gilson_cpc250,256,3,28,10,3,202,11,False,1.39,0.59,0.66,assets/expansion_batch03/t2_vacuum/gilson_cpc250/model.glb,assets/expansion_batch03/t2_vacuum/gilson_cpc250/model.urdf,assets/expansion_batch03/t2_vacuum/gilson_cpc250/asset.contract.json
|
| 31 |
+
instrument.sartorius_vivaflow200,CHEM-030,Tangential-flow ultrafiltration module,Sartorius,Vivaflow 200,Sartorius Vivaflow200单盒切向流超滤组件,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200,48,1,33,10,0,4,14,False,0.1808,0.038,0.2025,assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/model.glb,assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/model.urdf,assets/expansion_batch03/t2_vacuum/sartorius_vivaflow200/asset.contract.json
|
| 32 |
+
instrument.biotage_extrahera_classic,CHEM-031,Automated solid-phase extraction workstation,Biotage,Extrahera Classic,Biotage Extrahera Classic 自动固相萃取工作站,"Extraction, Purification & Drying",assets/basic40_batch02/t2_vacuum/biotage_extrahera,24,0,30,10,0,3,14,False,0.86,0.57,0.73,assets/basic40_batch02/t2_vacuum/biotage_extrahera/model.glb,assets/basic40_batch02/t2_vacuum/biotage_extrahera/model.urdf,assets/basic40_batch02/t2_vacuum/biotage_extrahera/asset.contract.json
|
| 33 |
+
instrument.sft_sft110,CHEM-032,Supercritical fluid extractor,Supercritical Fluid Technologies,SFT-110,SFT110超临界流体萃取仪100mL配置,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/sft_sft110,64,3,30,13,3,6,11,False,0.29,0.57,0.76,assets/expansion_batch03/t2_vacuum/sft_sft110/model.glb,assets/expansion_batch03/t2_vacuum/sft_sft110/model.urdf,assets/expansion_batch03/t2_vacuum/sft_sft110/asset.contract.json
|
| 34 |
+
instrument.syrris_asiafllex,CHEM-033,Flow liquid–liquid extraction module,Syrris,Asia FLLEX,Asia FLLEX连续流液液萃取模块,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/syrris_asiafllex,58,2,42,15,1,6,14,False,0.16,0.3032,0.13,assets/expansion_batch03/t2_vacuum/syrris_asiafllex/model.glb,assets/expansion_batch03/t2_vacuum/syrris_asiafllex/model.urdf,assets/expansion_batch03/t2_vacuum/syrris_asiafllex/asset.contract.json
|
| 35 |
+
instrument.biotage_selekt,CHEM-034,Automated flash chromatography system,Biotage,"Selekt (UV, single bed)",Biotage Selekt双通道单床UV快速制备色谱仪,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/biotage_selekt,200,3,55,15,4,151,12,False,0.335,0.393,0.545,assets/expansion_batch03/t2_vacuum/biotage_selekt/model.glb,assets/expansion_batch03/t2_vacuum/biotage_selekt/model.urdf,assets/expansion_batch03/t2_vacuum/biotage_selekt/asset.contract.json
|
| 36 |
+
instrument.pccell_ed64002,CHEM-035,Lab electrodialysis stack,PCCell,ED 64002 + BED1-2 Basic,PCCell ED64002 / BED1-2 Basic实验室电渗析组件,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/pccell_ed64002,112,3,28,14,2,10,11,False,0.8,0.36,0.3412,assets/expansion_batch03/t2_vacuum/pccell_ed64002/model.glb,assets/expansion_batch03/t2_vacuum/pccell_ed64002/model.urdf,assets/expansion_batch03/t2_vacuum/pccell_ed64002/asset.contract.json
|
| 37 |
+
instrument.genevac_mivac2,CHEM-036,Centrifugal vacuum concentrator,Genevac / SP Industries,miVac 2 Duo,Genevac miVac 2 Duo离心真空浓缩仪 Rev00101/25,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/genevac_mivac2,52,9,22,13,2,8,12,False,0.3605,0.4567,0.3002,assets/expansion_batch03/t2_vacuum/genevac_mivac2/model.glb,assets/expansion_batch03/t2_vacuum/genevac_mivac2/model.urdf,assets/expansion_batch03/t2_vacuum/genevac_mivac2/asset.contract.json
|
| 38 |
+
instrument.pilodist_pilodist104,CHEM-037,High-efficiency lab fractional distillation unit,PILODIST,PILODIST 104,PILODIST104高效实验室精馏装置6L90板规格,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/pilodist_pilodist104,95,4,24,15,2,12,14,False,1.6,0.5,2.7,assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/model.glb,assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/model.urdf,assets/expansion_batch03/t2_vacuum/pilodist_pilodist104/asset.contract.json
|
| 39 |
+
instrument.uic_kdl1basic,CHEM-038,Short-path wiped-film molecular still,UIC,KDL1 Basic,UIC KDL1 Basic 刮膜短程分子蒸馏装置,"Extraction, Purification & Drying",assets/expansion_batch03/t2_vacuum/uic_kdl1basic,74,5,30,17,1,13,23,False,0.8,0.4,1.2,assets/expansion_batch03/t2_vacuum/uic_kdl1basic/model.glb,assets/expansion_batch03/t2_vacuum/uic_kdl1basic/model.urdf,assets/expansion_batch03/t2_vacuum/uic_kdl1basic/asset.contract.json
|
| 40 |
+
instrument.scp_digiprepms,CHEM-039,Graphite block digestion system,SCP SCIENCE,DigiPREP MS,SCP SCIENCE DigiPREP MS 010-500-205 石墨块消解仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/scp_digiprepms,112,2,24,13,0,50,13,False,0.49,0.4006,0.18,assets/expansion_batch03/t1_thermal/scp_digiprepms/model.glb,assets/expansion_batch03/t1_thermal/scp_digiprepms/model.urdf,assets/expansion_batch03/t1_thermal/scp_digiprepms/asset.contract.json
|
| 41 |
+
instrument.retsch_pm100,CHEM-040,Planetary ball mill,RETSCH,PM 100,RETSCH PM 100 单工位行星式球磨仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/retsch_pm100,72,8,24,13,1,3,5,False,0.64,0.432,0.48,assets/expansion_batch03/t1_thermal/retsch_pm100/model.glb,assets/expansion_batch03/t1_thermal/retsch_pm100/model.urdf,assets/expansion_batch03/t1_thermal/retsch_pm100/asset.contract.json
|
| 42 |
+
instrument.retsch_as200,CHEM-041,Vibratory sieve shaker,RETSCH,AS 200 control,RETSCH AS 200 control 振动筛分仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/retsch_as200,61,16,24,20,3,4,7,False,0.417,0.3895,0.842,assets/expansion_batch03/t1_thermal/retsch_as200/model.glb,assets/expansion_batch03/t1_thermal/retsch_as200/model.urdf,assets/expansion_batch03/t1_thermal/retsch_as200/asset.contract.json
|
| 43 |
+
instrument.retsch_pt100,CHEM-042,Rotary sample divider,RETSCH,PT 100,RETSCH PT100旋转缩分仪与DR100,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/retsch_pt100,74,15,25,21,2,5,9,False,0.582,0.42,0.9115,assets/expansion_batch03/t1_thermal/retsch_pt100/model.glb,assets/expansion_batch03/t1_thermal/retsch_pt100/model.urdf,assets/expansion_batch03/t1_thermal/retsch_pt100/asset.contract.json
|
| 44 |
+
instrument.ika_t25,CHEM-043,Rotor–stator disperser,IKA,T 25 digital ULTRA-TURRAX,IKA T25digital转子定子分散机,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/ika_t25,34,4,30,16,1,4,8,False,0.32,0.3,0.628,assets/expansion_batch03/t1_thermal/ika_t25/model.glb,assets/expansion_batch03/t1_thermal/ika_t25/model.urdf,assets/expansion_batch03/t1_thermal/ika_t25/asset.contract.json
|
| 45 |
+
instrument.sonics_vcx750,CHEM-044,Probe ultrasonic processor,Sonics,VCX 750,Sonics VCX750探头式超声处理器,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/sonics_vcx750,66,25,34,19,4,5,7,False,0.52,0.3679,0.49,assets/expansion_batch03/t1_thermal/sonics_vcx750/model.glb,assets/expansion_batch03/t1_thermal/sonics_vcx750/model.urdf,assets/expansion_batch03/t1_thermal/sonics_vcx750/asset.contract.json
|
| 46 |
+
instrument.thinky_are310s,CHEM-045,Planetary centrifugal mixer,THINKY,ARE-310,THINKY ARE-310S-UL行星离心混合脱泡机,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/thinky_are310s,40,10,33,14,2,5,9,False,0.4279,0.336,0.3808,assets/expansion_batch03/t1_thermal/thinky_are310s/model.glb,assets/expansion_batch03/t1_thermal/thinky_are310s/model.urdf,assets/expansion_batch03/t1_thermal/thinky_are310s/asset.contract.json
|
| 47 |
+
instrument.metrohm_909uv,CHEM-046,UV digester,Metrohm,909 UV Digester,Metrohm909UV紫外消解仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/metrohm_909uv,72,10,31,17,3,14,6,False,0.33,0.31,0.5,assets/expansion_batch03/t1_thermal/metrohm_909uv/model.glb,assets/expansion_batch03/t1_thermal/metrohm_909uv/model.urdf,assets/expansion_batch03/t1_thermal/metrohm_909uv/asset.contract.json
|
| 48 |
+
instrument.multiwave_7101,CHEM-047,Microwave acid digestion system,Anton Paar,Multiwave 7101,微波酸消解仪 Anton Paar Multiwave 7101(24×8 mL架),Digestion & Solid Sample Prep,assets/basic40_batch02/t1_thermal/multiwave_7101,44,1,16,11,1,0,13,False,0.497,0.742,0.47,assets/basic40_batch02/t1_thermal/multiwave_7101/model.glb,assets/basic40_batch02/t1_thermal/multiwave_7101/model.urdf,assets/basic40_batch02/t1_thermal/multiwave_7101/asset.contract.json
|
| 49 |
+
instrument.velp_udk159,CHEM-048,Automatic Kjeldahl distillation & titration unit,VELP,UDK 159,VELP UDK159自动蒸汽蒸馏滴定仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/velp_udk159,57,6,34,18,3,9,10,False,0.385,0.416,0.78,assets/expansion_batch03/t1_thermal/velp_udk159/model.glb,assets/expansion_batch03/t1_thermal/velp_udk159/model.urdf,assets/expansion_batch03/t1_thermal/velp_udk159/asset.contract.json
|
| 50 |
+
instrument.buchi_hydrolexh,CHEM-049,Acid hydrolysis unit,BUCHI,HydrolEx H-506,BUCHI HydrolEx H-506酸水解前处理仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/buchi_hydrolexh,92,10,25,19,0,16,12,False,0.312,0.614,0.47,assets/expansion_batch03/t1_thermal/buchi_hydrolexh/model.glb,assets/expansion_batch03/t1_thermal/buchi_hydrolexh/model.urdf,assets/expansion_batch03/t1_thermal/buchi_hydrolexh/asset.contract.json
|
| 51 |
+
instrument.malvern_leneo,CHEM-050,Automated fusion bead maker,Malvern Panalytical / Claisse,LeNeo,Malvern Panalytical Claisse LeNeo自动熔融制样仪,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/malvern_leneo,70,6,20,15,3,5,6,False,0.5563,0.5737,0.52,assets/expansion_batch03/t1_thermal/malvern_leneo/model.glb,assets/expansion_batch03/t1_thermal/malvern_leneo/model.urdf,assets/expansion_batch03/t1_thermal/malvern_leneo/asset.contract.json
|
| 52 |
+
instrument.specac_atlasmanual,CHEM-051,Hydraulic pellet press,Specac,Atlas Manual 15T,Specac Atlas Manual15T液压粉末压片机,Digestion & Solid Sample Prep,assets/expansion_batch03/t1_thermal/specac_atlasmanual,57,9,27,16,0,3,6,False,0.31,0.19,0.61,assets/expansion_batch03/t1_thermal/specac_atlasmanual/model.glb,assets/expansion_batch03/t1_thermal/specac_atlasmanual/model.urdf,assets/expansion_batch03/t1_thermal/specac_atlasmanual/asset.contract.json
|
| 53 |
+
instrument.buchi_encapsulatorb,CHEM-052,Vibrating-nozzle encapsulator,BUCHI,Encapsulator B-390,BUCHI Encapsulator B-390振动喷嘴微胶囊制备仪,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/buchi_encapsulatorb,53,8,30,23,4,10,6,False,0.435,0.34,0.29,assets/expansion_batch04/t5_automation/buchi_encapsulatorb/model.glb,assets/expansion_batch04/t5_automation/buchi_encapsulatorb/model.urdf,assets/expansion_batch04/t5_automation/buchi_encapsulatorb/asset.contract.json
|
| 54 |
+
instrument.ossila_spincoater,CHEM-053,Spin coater,Ossila,Spin Coater V3,Ossila Spin Coater Standard V3 L2001A3旋涂机,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/ossila_spincoater,45,15,13,12,3,4,7,False,0.171,0.234,0.1399,assets/expansion_batch04/t5_automation/ossila_spincoater/model.glb,assets/expansion_batch04/t5_automation/ossila_spincoater/model.urdf,assets/expansion_batch04/t5_automation/ossila_spincoater/asset.contract.json
|
| 55 |
+
instrument.ossila_dipcoater,CHEM-054,Dip coater,Ossila,Dip Coater V2,Ossila Dip Coater V2 L2006A2(手册2.0.A),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/ossila_dipcoater,45,15,18,17,3,4,7,False,0.2,0.3,0.35,assets/expansion_batch04/t5_automation/ossila_dipcoater/model.glb,assets/expansion_batch04/t5_automation/ossila_dipcoater/model.urdf,assets/expansion_batch04/t5_automation/ossila_dipcoater/asset.contract.json
|
| 56 |
+
instrument.ossila_doctorblade,CHEM-055,Automated doctor-blade coater,Ossila,Doctor Blade Coater,Ossila Doctor Blade Coater(100mm数字刮刀+8mm玻璃台),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/ossila_doctorblade,66,16,21,18,4,4,8,False,0.28,0.36,0.19,assets/expansion_batch04/t5_automation/ossila_doctorblade/model.glb,assets/expansion_batch04/t5_automation/ossila_doctorblade/model.urdf,assets/expansion_batch04/t5_automation/ossila_doctorblade/asset.contract.json
|
| 57 |
+
instrument.ossila_slotdie,CHEM-056,Slot-die coater,Ossila,Slot-Die Coater V2,Ossila Slot-Die Coater V2 L2005A2(100mm标准模头/5mL注射器),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/ossila_slotdie,64,17,29,22,6,5,8,False,0.28,0.36,0.19,assets/expansion_batch04/t5_automation/ossila_slotdie/model.glb,assets/expansion_batch04/t5_automation/ossila_slotdie/model.urdf,assets/expansion_batch04/t5_automation/ossila_slotdie/asset.contract.json
|
| 58 |
+
instrument.thermo_process11,CHEM-057,Lab twin-screw extruder,Thermo Fisher Scientific,Process 11,Thermo Scientific Process11(标准350℃双螺杆),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/thermo_process11,66,5,32,22,10,7,7,False,0.82,0.48,0.41,assets/expansion_batch04/t5_automation/thermo_process11/model.glb,assets/expansion_batch04/t5_automation/thermo_process11/model.urdf,assets/expansion_batch04/t5_automation/thermo_process11/asset.contract.json
|
| 59 |
+
instrument.fujifilm_dmp2850,CHEM-058,Materials inkjet printer,FUJIFILM Dimatix,DMP-2850,FUJIFILM Dimatix DMP-2850 S(SAMBA 12喷嘴),Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/fujifilm_dmp2850,60,4,28,21,6,7,9,False,0.673,0.5917,0.419,assets/expansion_batch04/t5_automation/fujifilm_dmp2850/model.glb,assets/expansion_batch04/t5_automation/fujifilm_dmp2850/model.urdf,assets/expansion_batch04/t5_automation/fujifilm_dmp2850/asset.contract.json
|
| 60 |
+
instrument.linari_rtadvanced,CHEM-059,Electrospinning system,Linari Nanotech,RT Advanced,Linari Nanotech RT Advanced静电纺丝系统,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/linari_rtadvanced,63,14,33,21,6,15,6,False,1.05,1.0455,2.2,assets/expansion_batch04/t5_automation/linari_rtadvanced/model.glb,assets/expansion_batch04/t5_automation/linari_rtadvanced/model.urdf,assets/expansion_batch04/t5_automation/linari_rtadvanced/asset.contract.json
|
| 61 |
+
instrument.cytiva_nanoassemblrignite,CHEM-060,Microfluidic nanoparticle formulation system,Cytiva / Precision NanoSystems,NanoAssemblr Ignite,NanoAssemblr Ignite NIN0001微流控制备仪,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite,43,9,35,20,6,12,9,False,0.381,0.3527,0.38,assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/model.glb,assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/model.urdf,assets/expansion_batch04/t5_automation/cytiva_nanoassemblrignite/asset.contract.json
|
| 62 |
+
instrument.glatt_miniglatt,CHEM-061,Fluid-bed granulator / coater,Glatt,Mini-Glatt,Glatt Mini-Glatt2012流化床制粒包衣仪,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/glatt_miniglatt,54,12,33,21,4,12,9,False,0.7057,0.7587,0.84,assets/expansion_batch04/t5_automation/glatt_miniglatt/model.glb,assets/expansion_batch04/t5_automation/glatt_miniglatt/model.urdf,assets/expansion_batch04/t5_automation/glatt_miniglatt/asset.contract.json
|
| 63 |
+
instrument.quorum_q150tes,CHEM-062,Sputter & carbon coater,Quorum Technologies,Q150T ES Plus,Quorum Q150T ES Plus显微样品镀膜机,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/quorum_q150tes,52,7,28,18,6,10,10,False,0.585,0.5546,0.41,assets/expansion_batch04/t5_automation/quorum_q150tes/model.glb,assets/expansion_batch04/t5_automation/quorum_q150tes/model.urdf,assets/expansion_batch04/t5_automation/quorum_q150tes/asset.contract.json
|
| 64 |
+
instrument.laboao_cvdltf12p50,CHEM-063,Chemical vapour deposition system,LABOAO,CVD-LTF12P50,LABOAO CVD-LTF12P50单温区化学气相沉积系统,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/laboao_cvdltf12p50,110,10,34,16,6,12,10,False,1.9073,0.62,1.378,assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/model.glb,assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/model.urdf,assets/expansion_batch04/t5_automation/laboao_cvdltf12p50/asset.contract.json
|
| 65 |
+
instrument.arradiance_gemstarxt,CHEM-064,Atomic layer deposition system,Arradiance,GEMStar XT-SP (PEALD / thermal ALD),Arradiance GEMStar XT-SP单歧管PEALD/热ALD系统,Thin-Film & Functional Materials,assets/expansion_batch04/t5_automation/arradiance_gemstarxt,74,8,31,21,6,20,11,False,1.1576,0.6096,0.635,assets/expansion_batch04/t5_automation/arradiance_gemstarxt/model.glb,assets/expansion_batch04/t5_automation/arradiance_gemstarxt/model.urdf,assets/expansion_batch04/t5_automation/arradiance_gemstarxt/asset.contract.json
|
| 66 |
+
instrument.jasco_j1500,CHEM-065,Circular dichroism spectrometer,JASCO,J-1500,JASCO J-1500 150W标准PMT电子圆二色光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/jasco_j1500,60,2,25,18,6,9,11,False,1.055,0.6655,0.39,assets/expansion_batch04/t3_analytical/jasco_j1500/model.glb,assets/expansion_batch04/t3_analytical/jasco_j1500/model.urdf,assets/expansion_batch04/t3_analytical/jasco_j1500/asset.contract.json
|
| 67 |
+
instrument.bruker_minispecmq20,CHEM-066,Time-domain NMR relaxometer,Bruker,minispec mq20,Bruker minispec mq20时域核磁弛豫分析仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/bruker_minispecmq20,59,1,21,17,6,8,18,False,0.7492,0.787,0.356,assets/expansion_batch04/t3_analytical/bruker_minispecmq20/model.glb,assets/expansion_batch04/t3_analytical/bruker_minispecmq20/model.urdf,assets/expansion_batch04/t3_analytical/bruker_minispecmq20/asset.contract.json
|
| 68 |
+
instrument.jasco_fp8350,CHEM-067,Spectrofluorometer,JASCO,FP-8350,JASCO FP-8350 荧光分光光度计,Molecular Spectroscopy & Structure,assets/expansion_batch03/t3_analytical/jasco_fp8350,61,2,25,19,6,7,8,False,0.84,0.5663,0.27,assets/expansion_batch03/t3_analytical/jasco_fp8350/model.glb,assets/expansion_batch03/t3_analytical/jasco_fp8350/model.urdf,assets/expansion_batch03/t3_analytical/jasco_fp8350/asset.contract.json
|
| 69 |
+
instrument.magritek_spinsolve80,CHEM-068,Benchtop NMR spectrometer,Magritek,Spinsolve 80 Carbon,核磁共振结构光谱仪 — Magritek Spinsolve 80 Carbon,Molecular Spectroscopy & Structure,assets/basic40_batch02/t4_measure/magritek_spinsolve80,13,1,24,15,0,1,10,False,0.5814,0.4005,0.675,assets/basic40_batch02/t4_measure/magritek_spinsolve80/model.glb,assets/basic40_batch02/t4_measure/magritek_spinsolve80/model.urdf,assets/basic40_batch02/t4_measure/magritek_spinsolve80/asset.contract.json
|
| 70 |
+
instrument.bruker_magnettechesr5000,CHEM-069,Benchtop EPR spectrometer,Bruker,Magnettech ESR5000,Bruker Magnettech ESR5000 电子顺磁共振谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000,57,1,21,19,6,7,12,False,0.397,0.426,0.2032,assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/model.glb,assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/model.urdf,assets/expansion_batch04/t3_analytical/bruker_magnettechesr5000/asset.contract.json
|
| 71 |
+
instrument.jasco_p4200,CHEM-070,Digital polarimeter,JASCO,P-4200,JASCO P-4200 数字旋光仪,Molecular Spectroscopy & Structure,assets/expansion_batch03/t3_analytical/jasco_p4200,58,2,23,20,6,7,9,False,0.55,0.3582,0.21,assets/expansion_batch03/t3_analytical/jasco_p4200/model.glb,assets/expansion_batch03/t3_analytical/jasco_p4200/model.urdf,assets/expansion_batch03/t3_analytical/jasco_p4200/asset.contract.json
|
| 72 |
+
instrument.hach_dr6000,CHEM-071,UV-Vis spectrophotometer,Hach,DR6000,Hach DR6000 紫外可见分光光度计,Molecular Spectroscopy & Structure,assets/basic40_batch02/t3_analytical/hach_dr6000,14,1,14,13,1,1,7,False,0.5,0.46,0.215,assets/basic40_batch02/t3_analytical/hach_dr6000/model.glb,assets/basic40_batch02/t3_analytical/hach_dr6000/model.urdf,assets/basic40_batch02/t3_analytical/hach_dr6000/asset.contract.json
|
| 73 |
+
instrument.jasco_ftir4700,CHEM-072,FT-IR spectrometer,JASCO,FT/IR-4700,JASCO FT/IR-4700 傅里叶变换红外光谱仪,Molecular Spectroscopy & Structure,assets/basic40_batch02/t3_analytical/jasco_ftir4700,17,1,18,12,0,1,7,False,0.46,0.645,0.29,assets/basic40_batch02/t3_analytical/jasco_ftir4700/model.glb,assets/basic40_batch02/t3_analytical/jasco_ftir4700/model.urdf,assets/basic40_batch02/t3_analytical/jasco_ftir4700/asset.contract.json
|
| 74 |
+
instrument.jasco_nrs5500,CHEM-073,Raman microscope,JASCO,NRS-5500,JASCO NRS-5500 显微拉曼光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/jasco_nrs5500,61,4,26,23,6,7,8,False,1.15,0.89,0.67,assets/expansion_batch04/t3_analytical/jasco_nrs5500/model.glb,assets/expansion_batch04/t3_analytical/jasco_nrs5500/model.urdf,assets/expansion_batch04/t3_analytical/jasco_nrs5500/asset.contract.json
|
| 75 |
+
instrument.applied_sx20,CHEM-074,Stopped-flow kinetics spectrometer,Applied Photophysics,SX20,Applied Photophysics SX20 停流反应动力学光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/applied_sx20,63,6,30,19,6,9,9,False,1.2,0.5,0.5775,assets/expansion_batch04/t3_analytical/applied_sx20/model.glb,assets/expansion_batch04/t3_analytical/applied_sx20/model.urdf,assets/expansion_batch04/t3_analytical/applied_sx20/asset.contract.json
|
| 76 |
+
instrument.edinburgh_fls1000tcspc,CHEM-075,Time-resolved fluorescence (TCSPC) spectrometer,Edinburgh Instruments,FLS1000,Edinburgh Instruments FLS1000 TCSPC 时间分辨荧光寿命光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc,55,4,26,18,6,8,17,False,1.2,0.8,0.63,assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/model.glb,assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/model.urdf,assets/expansion_batch04/t3_analytical/edinburgh_fls1000tcspc/asset.contract.json
|
| 77 |
+
instrument.ultrafast_helios,CHEM-076,Femtosecond transient absorption spectrometer,Ultrafast Systems,HELIOS,Ultrafast Systems HELIOS 飞秒瞬态吸收光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/ultrafast_helios,56,4,25,17,6,6,13,False,1.5,0.85,0.66,assets/expansion_batch04/t3_analytical/ultrafast_helios/model.glb,assets/expansion_batch04/t3_analytical/ultrafast_helios/model.urdf,assets/expansion_batch04/t3_analytical/ultrafast_helios/asset.contract.json
|
| 78 |
+
instrument.jasco_fvs6000,CHEM-077,Vibrational circular dichroism spectrometer,JASCO,FVS-6000,JASCO FVS-6000 振动圆二色光���仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/jasco_fvs6000,74,4,32,22,6,10,12,False,0.945,0.67,0.425,assets/expansion_batch04/t3_analytical/jasco_fvs6000/model.glb,assets/expansion_batch04/t3_analytical/jasco_fvs6000/model.urdf,assets/expansion_batch04/t3_analytical/jasco_fvs6000/asset.contract.json
|
| 79 |
+
instrument.jasco_cpl300,CHEM-078,Circularly polarized luminescence spectrometer,JASCO,CPL-300,JASCO CPL-300 圆偏振发光光谱仪,Molecular Spectroscopy & Structure,assets/expansion_batch04/t3_analytical/jasco_cpl300,107,5,29,22,6,7,13,False,2.4,0.7,1.0,assets/expansion_batch04/t3_analytical/jasco_cpl300/model.glb,assets/expansion_batch04/t3_analytical/jasco_cpl300/model.urdf,assets/expansion_batch04/t3_analytical/jasco_cpl300/asset.contract.json
|
| 80 |
+
instrument.elementar_varioel,CHEM-079,Organic elemental (CHNS) analyzer,Elementar,vario EL cube,Elementar vario EL cube 有机元素分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/elementar_varioel,81,5,31,23,6,7,11,False,0.815,0.55,0.57,assets/expansion_batch04/t3_analytical/elementar_varioel/model.glb,assets/expansion_batch04/t3_analytical/elementar_varioel/model.urdf,assets/expansion_batch04/t3_analytical/elementar_varioel/asset.contract.json
|
| 81 |
+
instrument.shimadzu_tocl,CHEM-080,Total organic carbon analyzer,Shimadzu,TOC-L CSH,Shimadzu TOC-L CSH 总有机碳分析仪,Elemental & Mass Spectrometry,assets/expansion_batch03/t3_analytical/shimadzu_tocl,148,40,32,29,6,9,29,False,0.34,0.66,0.48,assets/expansion_batch03/t3_analytical/shimadzu_tocl/model.glb,assets/expansion_batch03/t3_analytical/shimadzu_tocl/model.urdf,assets/expansion_batch03/t3_analytical/shimadzu_tocl/asset.contract.json
|
| 82 |
+
instrument.jena_contraa800,CHEM-081,Atomic absorption spectrometer,Analytik Jena,contrAA 800 D,Analytik Jena contrAA 800 D 原子吸收光谱仪,Elemental & Mass Spectrometry,assets/expansion_batch03/t3_analytical/jena_contraa800,118,10,41,33,6,14,14,False,1.115,0.97,0.625,assets/expansion_batch03/t3_analytical/jena_contraa800/model.glb,assets/expansion_batch03/t3_analytical/jena_contraa800/model.urdf,assets/expansion_batch03/t3_analytical/jena_contraa800/asset.contract.json
|
| 83 |
+
instrument.shimadzu_icpe9800,CHEM-082,ICP optical emission spectrometer,Shimadzu,ICPE-9800,Shimadzu ICPE-9820 电感耦合等离子体发射光谱仪(9800系列),Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/shimadzu_icpe9800,97,3,36,33,6,9,83,False,1.3,0.72,0.91,assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/model.glb,assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/model.urdf,assets/expansion_batch04/t3_analytical/shimadzu_icpe9800/asset.contract.json
|
| 84 |
+
instrument.shimadzu_icpms2030,CHEM-083,ICP mass spectrometer,Shimadzu,ICPMS-2030,Shimadzu ICPMS-2030 电感耦合等离子体质谱仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/shimadzu_icpms2030,126,5,37,30,6,10,18,False,1.0133,0.645,0.857,assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/model.glb,assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/model.urdf,assets/expansion_batch04/t3_analytical/shimadzu_icpms2030/asset.contract.json
|
| 85 |
+
instrument.shimadzu_edx7200,CHEM-084,Energy-dispersive XRF spectrometer,Shimadzu,EDX-7200,Shimadzu EDX-7200 能量色散X射线荧光分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/shimadzu_edx7200,71,3,33,29,6,5,22,False,0.46,0.59,0.5775,assets/expansion_batch04/t3_analytical/shimadzu_edx7200/model.glb,assets/expansion_batch04/t3_analytical/shimadzu_edx7200/model.urdf,assets/expansion_batch04/t3_analytical/shimadzu_edx7200/asset.contract.json
|
| 86 |
+
instrument.jena_multix,CHEM-085,Total organic halogen (AOX/TOX) analyzer,Analytik Jena,multi X 2500,Analytik Jena multi X 2500 总有机卤素分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/jena_multix,132,8,38,37,6,11,84,False,1.4,0.55,0.671,assets/expansion_batch04/t3_analytical/jena_multix/model.glb,assets/expansion_batch04/t3_analytical/jena_multix/model.urdf,assets/expansion_batch04/t3_analytical/jena_multix/asset.contract.json
|
| 87 |
+
instrument.milestone_dma80,CHEM-086,Direct mercury analyzer,Milestone,DMA-80 evo,Milestone DMA-80 evo DoubleBeam 直接测汞仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/milestone_dma80,114,5,38,34,6,46,69,False,0.8,0.42,0.3,assets/expansion_batch04/t3_analytical/milestone_dma80/model.glb,assets/expansion_batch04/t3_analytical/milestone_dma80/model.urdf,assets/expansion_batch04/t3_analytical/milestone_dma80/asset.contract.json
|
| 88 |
+
instrument.stanford_rga100,CHEM-087,Residual gas analyzer,Stanford Research Systems,RGA100,Stanford Research Systems RGA100 残余气体质谱分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/stanford_rga100,99,2,40,34,13,7,327,False,0.215,0.5812,0.264,assets/expansion_batch04/t3_analytical/stanford_rga100/model.glb,assets/expansion_batch04/t3_analytical/stanford_rga100/model.urdf,assets/expansion_batch04/t3_analytical/stanford_rga100/asset.contract.json
|
| 89 |
+
instrument.thermo_orbitrapexploris,CHEM-088,High-resolution Orbitrap mass spectrometer,Thermo Fisher Scientific,Orbitrap Exploris 120,Thermo Fisher Scientific Orbitrap Exploris120 高分辨分子质谱仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris,119,4,37,37,9,14,100,False,0.534,0.939,0.703,assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/model.glb,assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/model.urdf,assets/expansion_batch04/t3_analytical/thermo_orbitrapexploris/asset.contract.json
|
| 90 |
+
instrument.leco_onh836,CHEM-089,Inert-gas fusion O/N/H analyzer,LECO,ONH836,LECO ONH836 惰气熔融氧氮氢分析仪,Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/leco_onh836,140,4,36,35,7,8,31,False,0.71,0.76,0.915,assets/expansion_batch04/t3_analytical/leco_onh836/model.glb,assets/expansion_batch04/t3_analytical/leco_onh836/model.urdf,assets/expansion_batch04/t3_analytical/leco_onh836/asset.contract.json
|
| 91 |
+
instrument.elementar_isoprimeprecision,CHEM-090,Stable isotope-ratio mass spectrometer,Elementar,isoprime precisION,稳定同位素比质谱仪Elementar isoprime precisION(标准通用收集器阵列,集成centrION),Elemental & Mass Spectrometry,assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision,36,2,21,30,3,16,15,True,0.595,0.4607,0.65,assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/model.glb,assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/model.urdf,assets/expansion_batch04/t3_analytical/elementar_isoprimeprecision/asset.contract.json
|
| 92 |
+
instrument.agilent_gc8890b,CHEM-096,Gas chromatograph,Agilent,8890B GC,Agilent 8890B GC 气相色谱仪(单S/SL + FID迁移配置),Chromatography & Electrophoresis,assets/basic40_batch02/t3_analytical/agilent_gc8890b,52,50,22,55,3,1,9,False,0.5803,0.545,0.4905,assets/basic40_batch02/t3_analytical/agilent_gc8890b/model.glb,assets/basic40_batch02/t3_analytical/agilent_gc8890b/model.urdf,assets/basic40_batch02/t3_analytical/agilent_gc8890b/asset.contract.json
|
| 93 |
+
instrument.agilent_hplc1260,CHEM-097,HPLC system,Agilent,1260 Infinity III LC,高效液相色谱仪 Agilent | 1260 Infinity III LC,Chromatography & Electrophoresis,assets/basic40_batch02/t3_analytical/agilent_hplc1260,15,1,24,14,0,3,9,False,0.396,0.468,0.66,assets/basic40_batch02/t3_analytical/agilent_hplc1260/model.glb,assets/basic40_batch02/t3_analytical/agilent_hplc1260/model.urdf,assets/basic40_batch02/t3_analytical/agilent_hplc1260/asset.contract.json
|
| 94 |
+
instrument.thermo_dionexintegrion,CHEM-098,Ion chromatograph,Thermo Fisher Scientific,Dionex Integrion HPIC,Thermo Scientific Dionex Integrion HPIC 离子色谱仪,Chromatography & Electrophoresis,assets/expansion_batch03/t3_analytical/thermo_dionexintegrion,72,2,21,16,4,6,7,False,0.3,0.577,0.625,assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/model.glb,assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/model.urdf,assets/expansion_batch03/t3_analytical/thermo_dionexintegrion/asset.contract.json
|
| 95 |
+
instrument.agilent_1290infinity,CHEM-099,GPC/SEC system,Agilent,1290 Infinity II GPC/SEC,Agilent 1290 Infinity II GPC/SEC 凝胶渗透体积排阻色谱系统,Chromatography & Electrophoresis,assets/expansion_batch04/t3_analytical/agilent_1290infinity,166,3,25,18,4,14,8,False,0.4365,0.481,0.9,assets/expansion_batch04/t3_analytical/agilent_1290infinity/model.glb,assets/expansion_batch04/t3_analytical/agilent_1290infinity/model.urdf,assets/expansion_batch04/t3_analytical/agilent_1290infinity/asset.contract.json
|
| 96 |
+
instrument.gas_flavourspec25gc,CHEM-100,GC–ion mobility spectrometer,G.A.S.,FlavourSpec25 GC-IMS,G.A.S. FlavourSpec25 GC-IMS 离子迁移谱正交分离系统,Chromatography & Electrophoresis,assets/expansion_batch04/t3_analytical/gas_flavourspec25gc,200,4,29,20,4,65,5,False,1.01,0.8,0.79,assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/model.glb,assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/model.urdf,assets/expansion_batch04/t3_analytical/gas_flavourspec25gc/asset.contract.json
|
| 97 |
+
instrument.metrohm_omnis,CHEM-101,Automatic potentiometric titrator,Metrohm,OMNIS Professional Titrator,Metrohm OMNIS Professional Titrator 2.1001.0320 自动电位滴定仪,Electrochemistry & Titration,assets/basic40_batch02/t4_measure/metrohm_omnis,17,2,34,12,1,1,15,False,0.142,0.3996,0.358,assets/basic40_batch02/t4_measure/metrohm_omnis/model.glb,assets/basic40_batch02/t4_measure/metrohm_omnis/model.urdf,assets/basic40_batch02/t4_measure/metrohm_omnis/asset.contract.json
|
| 98 |
+
instrument.metrohm_899,CHEM-102,Karl Fischer coulometer,Metrohm,899 Coulometer,CHEM-102 卡尔费休水分滴定仪 · Metrohm 899 Coulometer,Electrochemistry & Titration,assets/basic40_batch02/t4_measure/metrohm_899,11,11,26,7,0,1,9,False,0.1436,0.2889,0.3373,assets/basic40_batch02/t4_measure/metrohm_899/model.glb,assets/basic40_batch02/t4_measure/metrohm_899/model.urdf,assets/basic40_batch02/t4_measure/metrohm_899/asset.contract.json
|
| 99 |
+
instrument.gamry_reference620,CHEM-103,Potentiostat / electrochemical workstation,Gamry,Reference 620,Gamry Reference 620 电化学工作站,Electrochemistry & Titration,assets/basic40_batch02/t4_measure/gamry_ref620,12,0,21,7,0,0,13,False,0.09,0.2744,0.19,assets/basic40_batch02/t4_measure/gamry_ref620/model.glb,assets/basic40_batch02/t4_measure/gamry_ref620/model.urdf,assets/basic40_batch02/t4_measure/gamry_ref620/asset.contract.json
|
| 100 |
+
instrument.ch_chi920d,CHEM-104,Scanning electrochemical microscope,CH Instruments,CHI920D,CH Instruments CHI920D 扫描电化学显微镜,Electrochemistry & Titration,assets/expansion_batch04/t4_measure/ch_chi920d,118,3,29,16,2,12,6,False,0.76,0.36,0.45,assets/expansion_batch04/t4_measure/ch_chi920d/model.glb,assets/expansion_batch04/t4_measure/ch_chi920d/model.urdf,assets/expansion_batch04/t4_measure/ch_chi920d/asset.contract.json
|
| 101 |
+
instrument.ch_chi440c,CHEM-105,Electrochemical quartz crystal microbalance,CH Instruments,CHI440C,CH Instruments CHI440C 电化学石英晶体微天平,Electrochemistry & Titration,assets/expansion_batch04/t4_measure/ch_chi440c,79,1,19,17,1,10,6,False,0.6,0.31,0.1247,assets/expansion_batch04/t4_measure/ch_chi440c/model.glb,assets/expansion_batch04/t4_measure/ch_chi440c/model.urdf,assets/expansion_batch04/t4_measure/ch_chi440c/asset.contract.json
|
| 102 |
+
instrument.knauer_k7400s,CHEM-106,Freezing-point osmometer,KNAUER,K-7400S,KNAUER K-7400S 冰点渗透压仪,Electrochemistry & Titration,assets/expansion_batch04/t4_measure/knauer_k7400s,77,2,24,17,2,6,6,False,0.1606,0.3434,0.228,assets/expansion_batch04/t4_measure/knauer_k7400s/model.glb,assets/expansion_batch04/t4_measure/knauer_k7400s/model.urdf,assets/expansion_batch04/t4_measure/knauer_k7400s/asset.contract.json
|
| 103 |
+
instrument.pine_wavevortex10,CHEM-107,Rotating ring-disk electrode rotator,Pine Research,WaveVortex 10,Pine Research WaveVortex 10旋转环盘驱动,Electrochemistry & Titration,assets/expansion_batch04/t4_measure/pine_wavevortex10,113,4,30,22,5,9,5,False,0.38,0.28,0.38,assets/expansion_batch04/t4_measure/pine_wavevortex10/model.glb,assets/expansion_batch04/t4_measure/pine_wavevortex10/model.urdf,assets/expansion_batch04/t4_measure/pine_wavevortex10/asset.contract.json
|
| 104 |
+
instrument.agilent_hs8697,CHEM-108,Headspace autosampler (48-vial tray),Agilent,8697,CHEM-108 Agilent 8697 顶空自动进样器(48 位托盘),Analytical Sampling & Interfaces,assets/basic40_batch02/t3_analytical/agilent_hs8697,141,1,24,13,1,60,7,False,0.599,0.73,0.8,assets/basic40_batch02/t3_analytical/agilent_hs8697/model.glb,assets/basic40_batch02/t3_analytical/agilent_hs8697/model.urdf,assets/basic40_batch02/t3_analytical/agilent_hs8697/asset.contract.json
|
| 105 |
+
instrument.teledyne_atomxxyz,CHEM-109,Purge-and-trap autosampler,Teledyne Tekmar,Atomx XYZ,Teledyne Tekmar Atomx XYZ 吹扫捕集自动进样系统,Analytical Sampling & Interfaces,assets/expansion_batch03/t3_analytical/teledyne_atomxxyz,443,7,25,20,2,97,7,False,0.701,0.5842,0.495,assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/model.glb,assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/model.urdf,assets/expansion_batch03/t3_analytical/teledyne_atomxxyz/asset.contract.json
|
| 106 |
+
instrument.teledyne_analyteexcite,CHEM-110,Laser ablation sampling system,Teledyne CETAC,Analyte Excite+,Teledyne CETAC Analyte Excite+ 激光剥蚀系统,Analytical Sampling & Interfaces,assets/expansion_batch03/t3_analytical/teledyne_analyteexcite,135,6,22,23,2,25,7,False,0.76,0.87,1.5,assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/model.glb,assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/model.urdf,assets/expansion_batch03/t3_analytical/teledyne_analyteexcite/asset.contract.json
|
| 107 |
+
instrument.frontier_egapy,CHEM-111,Multi-shot pyrolyzer (GC inlet),Frontier Laboratories,EGA/PY-3030D,Frontier EGA/PY-3030D 热裂解进样器,Analytical Sampling & Interfaces,assets/expansion_batch03/t3_analytical/frontier_egapy,101,4,22,22,0,21,9,False,0.3355,0.346,0.3935,assets/expansion_batch03/t3_analytical/frontier_egapy/model.glb,assets/expansion_batch03/t3_analytical/frontier_egapy/model.urdf,assets/expansion_batch03/t3_analytical/frontier_egapy/asset.contract.json
|
| 108 |
+
instrument.markes_unityxr,CHEM-112,Thermal desorber,Markes International,UNITY-xr,Markes UNITY-xr 热脱附进样器,Analytical Sampling & Interfaces,assets/expansion_batch03/t3_analytical/markes_unityxr,104,6,27,26,0,11,9,False,0.16,0.54,0.46,assets/expansion_batch03/t3_analytical/markes_unityxr/model.glb,assets/expansion_batch03/t3_analytical/markes_unityxr/model.urdf,assets/expansion_batch03/t3_analytical/markes_unityxr/asset.contract.json
|
| 109 |
+
instrument.antonpaar_surpass3,CHEM-113,Solid-surface streaming-potential analyzer,Anton Paar,SurPASS 3,Anton Paar SurPASS 3 固体表面流动电位分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_surpass3,137,7,29,25,1,15,7,False,0.5365,0.605,0.3508,assets/expansion_batch03/t4_measure/antonpaar_surpass3/model.glb,assets/expansion_batch03/t4_measure/antonpaar_surpass3/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_surpass3/asset.contract.json
|
| 110 |
+
instrument.antonpaar_ultrapyc5000,CHEM-114,Gas pycnometer (true density),Anton Paar,Ultrapyc 5000,Anton Paar Ultrapyc 5000 气体置换真密度仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000,122,6,33,25,4,9,9,False,0.3988,0.4895,0.25,assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/model.glb,assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_ultrapyc5000/asset.contract.json
|
| 111 |
+
instrument.antonpaar_autosorb6100,CHEM-115,Gas physisorption surface-area & pore analyzer,Anton Paar,Autosorb 6100,Anton Paar Autosorb 6100 气体物理吸附比表面积与孔径分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_autosorb6100,178,8,49,33,1,23,7,False,0.8056,0.712,1.079,assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/model.glb,assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_autosorb6100/asset.contract.json
|
| 112 |
+
instrument.antonpaar_poremaster60,CHEM-116,Mercury intrusion porosimeter,Anton Paar,PoreMaster 60,Anton Paar PoreMaster 60 标准型压汞孔隙率分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_poremaster60,121,7,27,28,1,12,10,False,0.5272,0.6665,0.7865,assets/expansion_batch03/t4_measure/antonpaar_poremaster60/model.glb,assets/expansion_batch03/t4_measure/antonpaar_poremaster60/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_poremaster60/asset.contract.json
|
| 113 |
+
instrument.antonpaar_litesizerdls,CHEM-117,DLS & zeta-potential analyzer,Anton Paar,Litesizer DLS 701,Anton Paar Litesizer DLS 701 动态光散射与胶体电位仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_litesizerdls,103,6,31,29,4,10,12,False,0.452,0.5115,0.135,assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/model.glb,assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_litesizerdls/asset.contract.json
|
| 114 |
+
instrument.antonpaar_psa1190,CHEM-118,Laser-diffraction particle sizer,Anton Paar,PSA 1190,Anton Paar PSA1190 L/D 激光衍射粒度仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_psa1190,248,9,31,28,1,16,15,False,0.895,0.547,0.4304,assets/expansion_batch03/t4_measure/antonpaar_psa1190/model.glb,assets/expansion_batch03/t4_measure/antonpaar_psa1190/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_psa1190/asset.contract.json
|
| 115 |
+
instrument.antonpaar_litesizerdia,CHEM-119,Dynamic image analyzer (particle shape),Anton Paar,Litesizer DIA 700,Anton Paar Litesizer DIA700 Liquid Flow 动态颗粒图像分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/antonpaar_litesizerdia,95,7,31,29,1,12,12,False,0.79,0.311,0.4,assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/model.glb,assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/model.urdf,assets/expansion_batch03/t4_measure/antonpaar_litesizerdia/asset.contract.json
|
| 116 |
+
instrument.biolin_sigma700,CHEM-120,Force tensiometer,Biolin Scientific,Sigma 700,Biolin Scientific Sigma700 力学式表面张力仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/biolin_sigma700,82,7,30,32,1,11,15,False,0.244,0.333,0.62,assets/expansion_batch03/t4_measure/biolin_sigma700/model.glb,assets/expansion_batch03/t4_measure/biolin_sigma700/model.urdf,assets/expansion_batch03/t4_measure/biolin_sigma700/asset.contract.json
|
| 117 |
+
instrument.biolin_thetaflex,CHEM-121,Optical contact-angle meter,Biolin Scientific,Theta Flex,Biolin Scientific Theta Flex 光学接触角测量仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/biolin_thetaflex,111,8,33,35,1,10,15,False,0.7665,0.2515,0.559,assets/expansion_batch03/t4_measure/biolin_thetaflex/model.glb,assets/expansion_batch03/t4_measure/biolin_thetaflex/model.urdf,assets/expansion_batch03/t4_measure/biolin_thetaflex/asset.contract.json
|
| 118 |
+
instrument.micromeritics_autochemiii,CHEM-122,Temperature-programmed chemisorption analyzer,Micromeritics,AutoChem III,Micromeritics AutoChem III 程序升温化学吸附仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/micromeritics_autochemiii,199,6,36,35,1,29,14,False,0.61,0.64,0.64,assets/expansion_batch03/t4_measure/micromeritics_autochemiii/model.glb,assets/expansion_batch03/t4_measure/micromeritics_autochemiii/model.urdf,assets/expansion_batch03/t4_measure/micromeritics_autochemiii/asset.contract.json
|
| 119 |
+
instrument.surface_dvsresolution,CHEM-123,Dynamic vapour sorption analyzer,Surface Measurement Systems,DVS Resolution,Surface Measurement Systems DVS Resolution 动态蒸气吸附仪(低质量天平),"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/surface_dvsresolution,211,6,40,37,4,11,12,False,0.52,0.61,0.98,assets/expansion_batch03/t4_measure/surface_dvsresolution/model.glb,assets/expansion_batch03/t4_measure/surface_dvsresolution/model.urdf,assets/expansion_batch03/t4_measure/surface_dvsresolution/asset.contract.json
|
| 120 |
+
instrument.freeman_ft4powder,CHEM-124,Powder rheometer,Freeman Technology / Micromeritics,FT4 Powder Rheometer,Freeman Technology / Micromeritics FT4 Powder Rheometer 粉体流动性流变仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/freeman_ft4powder,143,6,39,33,1,8,12,False,0.48,0.306,0.76,assets/expansion_batch03/t4_measure/freeman_ft4powder/model.glb,assets/expansion_batch03/t4_measure/freeman_ft4powder/model.urdf,assets/expansion_batch03/t4_measure/freeman_ft4powder/asset.contract.json
|
| 121 |
+
instrument.porometer_poroluxrevo,CHEM-125,Capillary flow porometer,POROMETER,POROLUX Revo,POROMETER POROLUX Revo 毛细流动孔径仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/porometer_poroluxrevo,129,3,28,33,1,8,13,False,0.53,0.53,0.755,assets/expansion_batch03/t4_measure/porometer_poroluxrevo/model.glb,assets/expansion_batch03/t4_measure/porometer_poroluxrevo/model.urdf,assets/expansion_batch03/t4_measure/porometer_poroluxrevo/asset.contract.json
|
| 122 |
+
instrument.microtrac_turbiscanlab,CHEM-126,Dispersion stability analyzer,Microtrac,TURBISCAN LAB,Microtrac TURBISCAN LAB 分散体系稳定性分析仪,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/microtrac_turbiscanlab,118,5,28,27,3,6,19,False,0.26,0.28,0.25,assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/model.glb,assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/model.urdf,assets/expansion_batch03/t4_measure/microtrac_turbiscanlab/asset.contract.json
|
| 123 |
+
instrument.biolin_mediuml,CHEM-127,Langmuir / Langmuir–Blodgett trough,Biolin Scientific KSV NIMA,Medium L&LB Trough,KSV NIMA Medium L&LB Langmuir 单分子膜槽,"Particles, Pores & Interfaces",assets/expansion_batch03/t4_measure/biolin_mediuml,124,7,36,34,2,8,15,False,0.662,0.308,0.455,assets/expansion_batch03/t4_measure/biolin_mediuml/model.glb,assets/expansion_batch03/t4_measure/biolin_mediuml/model.urdf,assets/expansion_batch03/t4_measure/biolin_mediuml/asset.contract.json
|
| 124 |
+
instrument.antonpaar_trb,CHEM-128,Pin-on-disk tribometer,Anton Paar,TRB³,Anton Paar TRB³ 销盘摩擦磨损试验机,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/antonpaar_trb,155,6,42,39,0,7,13,False,0.532,0.443,0.501,assets/expansion_batch04/t1_thermal/antonpaar_trb/model.glb,assets/expansion_batch04/t1_thermal/antonpaar_trb/model.urdf,assets/expansion_batch04/t1_thermal/antonpaar_trb/asset.contract.json
|
| 125 |
+
instrument.antonpaar_rst300,CHEM-129,Coating scratch tester,Anton Paar,RST 300,Anton Paar RST 300 涂层划痕附着力试验机,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/antonpaar_rst300,168,6,42,38,0,6,13,False,0.364,0.369,0.5425,assets/expansion_batch04/t1_thermal/antonpaar_rst300/model.glb,assets/expansion_batch04/t1_thermal/antonpaar_rst300/model.urdf,assets/expansion_batch04/t1_thermal/antonpaar_rst300/asset.contract.json
|
| 126 |
+
instrument.antonpaar_hit300,CHEM-130,Nanoindentation tester,Anton Paar,HIT 300,Anton Paar HIT 300 纳米压痕仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/antonpaar_hit300,156,6,38,33,2,7,17,False,0.269,0.259,0.42,assets/expansion_batch04/t1_thermal/antonpaar_hit300/model.glb,assets/expansion_batch04/t1_thermal/antonpaar_hit300/model.urdf,assets/expansion_batch04/t1_thermal/antonpaar_hit300/asset.contract.json
|
| 127 |
+
instrument.ta_dsc2500,CHEM-131,Differential scanning calorimeter,TA Instruments,DSC 2500,TA Instruments DSC 2500 差示扫描量热仪,"Thermal, Mechanical & Transport",assets/expansion_batch03/t1_thermal/ta_dsc2500,307,5,43,36,1,13,89,False,0.53,0.51,0.61,assets/expansion_batch03/t1_thermal/ta_dsc2500/model.glb,assets/expansion_batch03/t1_thermal/ta_dsc2500/model.urdf,assets/expansion_batch03/t1_thermal/ta_dsc2500/asset.contract.json
|
| 128 |
+
instrument.ta_tga5500,CHEM-132,Thermogravimetric analyzer,TA Instruments,TGA 5500,TA Instruments TGA 5500 热重分析仪,"Thermal, Mechanical & Transport",assets/expansion_batch03/t1_thermal/ta_tga5500,186,4,48,40,2,13,10,False,0.56,0.56,0.61,assets/expansion_batch03/t1_thermal/ta_tga5500/model.glb,assets/expansion_batch03/t1_thermal/ta_tga5500/model.urdf,assets/expansion_batch03/t1_thermal/ta_tga5500/asset.contract.json
|
| 129 |
+
instrument.ta_dma850,CHEM-133,Dynamic mechanical analyzer,TA Instruments,DMA 850,TA Instruments DMA 850 动态机械分析仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/ta_dma850,121,5,43,41,2,10,22,False,0.64,0.47,0.535,assets/expansion_batch04/t1_thermal/ta_dma850/model.glb,assets/expansion_batch04/t1_thermal/ta_dma850/model.urdf,assets/expansion_batch04/t1_thermal/ta_dma850/asset.contract.json
|
| 130 |
+
instrument.ta_tma450,CHEM-134,Thermomechanical analyzer,TA Instruments,TMA 450,TA Instruments TMA 450 热机械分析仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/ta_tma450,107,3,50,47,2,10,13,False,0.56,0.56,0.63,assets/expansion_batch04/t1_thermal/ta_tma450/model.glb,assets/expansion_batch04/t1_thermal/ta_tma450/model.urdf,assets/expansion_batch04/t1_thermal/ta_tma450/asset.contract.json
|
| 131 |
+
instrument.netzsch_lfa467,CHEM-135,Laser/light flash thermal diffusivity analyzer,NETZSCH,LFA 467 HyperFlash,NETZSCH LFA467 HyperFlash 闪光法热扩��仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/netzsch_lfa467,133,4,54,47,6,14,20,False,0.54,0.52,0.61,assets/expansion_batch04/t1_thermal/netzsch_lfa467/model.glb,assets/expansion_batch04/t1_thermal/netzsch_lfa467/model.urdf,assets/expansion_batch04/t1_thermal/netzsch_lfa467/asset.contract.json
|
| 132 |
+
instrument.hot_tps2500,CHEM-136,Transient plane source thermal-conductivity analyzer,Hot Disk,TPS 2500 S,Hot Disk TPS 2500 S 瞬态平面热源导热仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/hot_tps2500,47,4,25,25,1,6,13,False,0.6975,0.5663,0.325,assets/expansion_batch04/t1_thermal/hot_tps2500/model.glb,assets/expansion_batch04/t1_thermal/hot_tps2500/model.urdf,assets/expansion_batch04/t1_thermal/hot_tps2500/asset.contract.json
|
| 133 |
+
instrument.antonpaar_mcr503,CHEM-137,Rotational & oscillatory rheometer,Anton Paar,MCR 503,Anton Paar MCR 503 旋转与振荡流变仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/antonpaar_mcr503,51,3,26,28,1,8,8,False,0.453,0.673,0.775,assets/expansion_batch04/t1_thermal/antonpaar_mcr503/model.glb,assets/expansion_batch04/t1_thermal/antonpaar_mcr503/model.urdf,assets/expansion_batch04/t1_thermal/antonpaar_mcr503/asset.contract.json
|
| 134 |
+
instrument.ta_tamiv,CHEM-138,Isothermal microcalorimeter,TA Instruments,TAM IV,TA Instruments TAM IV 20 mL 等温微量热仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/ta_tamiv,52,2,25,31,0,8,10,False,0.58,0.76,1.0,assets/expansion_batch04/t1_thermal/ta_tamiv/model.glb,assets/expansion_batch04/t1_thermal/ta_tamiv/model.urdf,assets/expansion_batch04/t1_thermal/ta_tamiv/asset.contract.json
|
| 135 |
+
instrument.linseis_lsr3,CHEM-139,Thermoelectric (Seebeck) tester,Linseis,LSR-3,Linseis LSR-3 红外炉800°C热电性能测试仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/linseis_lsr3,57,5,32,31,2,12,11,False,0.7204,0.4278,0.53,assets/expansion_batch04/t1_thermal/linseis_lsr3/model.glb,assets/expansion_batch04/t1_thermal/linseis_lsr3/model.urdf,assets/expansion_batch04/t1_thermal/linseis_lsr3/asset.contract.json
|
| 136 |
+
instrument.novocontrol_alphat,CHEM-140,Broadband dielectric spectrometer,Novocontrol Technologies,Alpha-T,Novocontrol Alpha-T Rev C 宽频介电谱仪(含电流转换接口),"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/novocontrol_alphat,48,3,27,30,0,12,13,False,0.6815,0.364,0.205,assets/expansion_batch04/t1_thermal/novocontrol_alphat/model.glb,assets/expansion_batch04/t1_thermal/novocontrol_alphat/model.urdf,assets/expansion_batch04/t1_thermal/novocontrol_alphat/asset.contract.json
|
| 137 |
+
instrument.lakeshore_measurereadym91,CHEM-141,Hall-effect measurement system,Lake Shore Cryotronics,MeasureReady M91 FastHall,Lake Shore MeasureReady M91 FastHall 霍尔测量控制器,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91,64,4,36,31,1,17,11,False,0.343,0.369,0.087,assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/model.glb,assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/model.urdf,assets/expansion_batch04/t1_thermal/lakeshore_measurereadym91/asset.contract.json
|
| 138 |
+
instrument.signatone_quadpro2,CHEM-142,Automated four-point-probe sheet-resistance mapper,Signatone,QuadPro2,Signatone QuadPro2-DAC0 自动四探针面电阻测绘系统,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/signatone_quadpro2,99,5,34,29,2,16,13,False,0.572,0.978,1.676,assets/expansion_batch04/t1_thermal/signatone_quadpro2/model.glb,assets/expansion_batch04/t1_thermal/signatone_quadpro2/model.urdf,assets/expansion_batch04/t1_thermal/signatone_quadpro2/asset.contract.json
|
| 139 |
+
instrument.lakeshore_8604vsm,CHEM-143,Vibrating sample magnetometer,Lake Shore Cryotronics,8604 VSM,Lake Shore 8604 振动样品磁强计,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/lakeshore_8604vsm,106,5,34,32,2,14,14,False,2.175,1.04,1.6,assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/model.glb,assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/model.urdf,assets/expansion_batch04/t1_thermal/lakeshore_8604vsm/asset.contract.json
|
| 140 |
+
instrument.shimadzu_ags10knxd,CHEM-144,Universal testing machine,Shimadzu,AGS-10kNXD,Shimadzu AGS-10kNXD 万能材料试验机,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd,85,6,35,28,2,14,12,False,0.653,0.52,1.603,assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/model.glb,assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/model.urdf,assets/expansion_batch04/t1_thermal/shimadzu_ags10knxd/asset.contract.json
|
| 141 |
+
instrument.zwick_hit5p,CHEM-145,Pendulum impact tester,ZwickRoell,HIT5P,ZwickRoell HIT5P 摆锤冲击试验机,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/zwick_hit5p,73,4,31,27,2,13,12,False,0.68,0.429,0.684,assets/expansion_batch04/t1_thermal/zwick_hit5p/model.glb,assets/expansion_batch04/t1_thermal/zwick_hit5p/model.urdf,assets/expansion_batch04/t1_thermal/zwick_hit5p/asset.contract.json
|
| 142 |
+
instrument.zwick_mflow,CHEM-146,Melt flow indexer,ZwickRoell,Mflow,ZwickRoell Mflow 熔体流动速率仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/zwick_mflow,63,9,43,36,3,14,12,False,0.479,0.524,0.548,assets/expansion_batch04/t1_thermal/zwick_mflow/model.glb,assets/expansion_batch04/t1_thermal/zwick_mflow/model.urdf,assets/expansion_batch04/t1_thermal/zwick_mflow/asset.contract.json
|
| 143 |
+
instrument.ametek_oxtran,CHEM-147,Oxygen transmission-rate analyzer,AMETEK MOCON,OX-TRAN 2/22 L,AMETEK MOCON OX-TRAN 2/22 L 氧气透过率分析仪,"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/ametek_oxtran,75,8,55,31,5,14,13,False,0.3046,0.6149,0.5008,assets/expansion_batch04/t1_thermal/ametek_oxtran/model.glb,assets/expansion_batch04/t1_thermal/ametek_oxtran/model.urdf,assets/expansion_batch04/t1_thermal/ametek_oxtran/asset.contract.json
|
| 144 |
+
instrument.netzsch_mmc315,CHEM-148,Adiabatic (ARC) reaction calorimeter,NETZSCH,MMC 315 Nexus,NETZSCH MMC 315 Nexus 多模块量热仪(ARC模块),"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/netzsch_mmc315,40,3,30,24,4,10,15,False,0.62,0.594,0.55,assets/expansion_batch04/t1_thermal/netzsch_mmc315/model.glb,assets/expansion_batch04/t1_thermal/netzsch_mmc315/model.urdf,assets/expansion_batch04/t1_thermal/netzsch_mmc315/asset.contract.json
|
| 145 |
+
instrument.mt_rc1mxhfcal,CHEM-149,Heat-flow reaction calorimeter,METTLER TOLEDO,RC1mx + HFCal,METTLER TOLEDO RC1mx + HFCal 热流式反应量热系统(标准转矩搅拌器),"Thermal, Mechanical & Transport",assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal,92,5,57,37,5,12,17,False,0.951,0.705,1.1805,assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/model.glb,assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/model.urdf,assets/expansion_batch04/t1_thermal/mt_rc1mxhfcal/asset.contract.json
|
| 146 |
+
instrument.ika_c6000,CHEM-150,Oxygen bomb calorimeter,IKA,C 6000 isoperibol,IKA C 6000 isoperibol 氧弹量热仪(Package 2/12:C 6000主机+C 6012耐卤素氧弹),"Thermal, Mechanical & Transport",assets/expansion_batch03/t1_thermal/ika_c6000,60,3,43,44,3,16,18,False,0.5053,0.4768,0.4253,assets/expansion_batch03/t1_thermal/ika_c6000/model.glb,assets/expansion_batch03/t1_thermal/ika_c6000/model.urdf,assets/expansion_batch03/t1_thermal/ika_c6000/asset.contract.json
|
| 147 |
+
instrument.jeol_jsmit200,CHEM-151,Scanning electron microscope,JEOL,JSM-IT200 LA,JEOL JSM-IT200 LA 扫描电子显微镜(InTouchScope,集成JED-2300 EDS,含机械泵与选配操作台),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/jeol_jsmit200,102,12,64,48,7,13,22,False,1.537,1.1635,1.48,assets/expansion_batch04/t3_analytical/jeol_jsmit200/model.glb,assets/expansion_batch04/t3_analytical/jeol_jsmit200/model.urdf,assets/expansion_batch04/t3_analytical/jeol_jsmit200/asset.contract.json
|
| 148 |
+
instrument.jeol_jem1400flash,CHEM-152,Transmission electron microscope,JEOL,JEM-1400Flash,JEOL JEM-1400Flash HR 透射电子显微镜(120kV钨灯丝、HR极靴、Matataki Flash sCMOS相机,含电源柜、后控制台与机械泵),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/jeol_jem1400flash,82,21,77,59,7,9,28,False,2.625,2.2643,2.4921,assets/expansion_batch04/t3_analytical/jeol_jem1400flash/model.glb,assets/expansion_batch04/t3_analytical/jeol_jem1400flash/model.urdf,assets/expansion_batch04/t3_analytical/jeol_jem1400flash/asset.contract.json
|
| 149 |
+
instrument.antonpaar_saxspace,CHEM-153,Small-angle X-ray scattering system,Anton Paar,SAXSpace,Anton Paar SAXSpace 小角/广角X射线散射仪(Cu密封管、Kratky块线/点准直、TCStage、MYTHEN2 R 1K探测器2θ臂、ASX自动进样器,含实验桌与柜体),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/antonpaar_saxspace,72,13,76,54,11,13,25,False,1.8,0.922,1.685,assets/expansion_batch04/t3_analytical/antonpaar_saxspace/model.glb,assets/expansion_batch04/t3_analytical/antonpaar_saxspace/model.urdf,assets/expansion_batch04/t3_analytical/antonpaar_saxspace/asset.contract.json
|
| 150 |
+
instrument.kratos_axissupra,CHEM-154,X-ray photoelectron spectrometer,Kratos / Shimadzu,AXIS Supra+,Kratos / Shimadzu AXIS Supra+ 成像X射线光电子能谱仪(单色Al Kα、半球+球面镜分析器、DLD、电子中和器、Minibeam 4离子枪、Flexi-lock 3架仓、五轴样品台,含冷水机与ESCApe工作站),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/kratos_axissupra,66,10,67,49,8,10,22,False,2.77,2.064,1.97,assets/expansion_batch04/t3_analytical/kratos_axissupra/model.glb,assets/expansion_batch04/t3_analytical/kratos_axissupra/model.urdf,assets/expansion_batch04/t3_analytical/kratos_axissupra/asset.contract.json
|
| 151 |
+
instrument.keyence_vkx3000,CHEM-155,3D laser-scanning profilometer microscope,KEYENCE,VK-X3000 / VK-X3100,KEYENCE VK-X3000三维光学表面轮廓显微镜(VK-X3000控制器、VK-X3100测量头、VK-D3电动底座,含显示器与电脑工作站),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/keyence_vkx3000,62,7,51,38,9,9,21,False,1.386,0.5385,0.471,assets/expansion_batch04/t3_analytical/keyence_vkx3000/model.glb,assets/expansion_batch04/t3_analytical/keyence_vkx3000/model.urdf,assets/expansion_batch04/t3_analytical/keyence_vkx3000/asset.contract.json
|
| 152 |
+
instrument.bruker_x4poseidon,CHEM-156,Micro X-ray computed tomography,Bruker,X4 POSEIDON,Bruker X4 POSEIDON台式三维X射线显微镜/微米CT(反射源基本配置:反射式X射线源、7 MP平板探测器、标准旋转台、固定扫描几何、7位滤片转换器,含工作站),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/bruker_x4poseidon,51,7,60,46,7,7,16,False,1.8855,0.622,0.722,assets/expansion_batch04/t3_analytical/bruker_x4poseidon/model.glb,assets/expansion_batch04/t3_analytical/bruker_x4poseidon/model.urdf,assets/expansion_batch04/t3_analytical/bruker_x4poseidon/asset.contract.json
|
| 153 |
+
instrument.ja_alphase,CHEM-157,Spectroscopic ellipsometer,J.A. Woollam,alpha-SE,J.A. Woollam alpha-SE光谱椭偏仪(2015规格:旋转补偿器+CCD,380–900 nm 180个波长,入射角65/70/75°与90°直通,手动换角,电动Z对准,真空吸盘,选配液池;含操作电脑),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/ja_alphase,49,5,39,37,5,7,16,False,1.23,0.485,0.434,assets/expansion_batch04/t3_analytical/ja_alphase/model.glb,assets/expansion_batch04/t3_analytical/ja_alphase/model.urdf,assets/expansion_batch04/t3_analytical/ja_alphase/asset.contract.json
|
| 154 |
+
instrument.park_nx10,CHEM-158,Atomic force microscope,Park Systems,NX10,Park Systems NX10原子力显微镜(2024宣传册配置:50×50 µm闭环XY扫描器、15 µm Z扫描器、20×20 mm XY台、25 mm Z台、15 mm聚焦台、10×同轴光学、SLD光束检测;接触/True Non-Contact/轻敲、相位成像、力-距离谱、热调谐;含控制电子单元),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/park_nx10,51,12,54,56,2,7,12,False,0.776,0.5107,0.443,assets/expansion_batch04/t3_analytical/park_nx10/model.glb,assets/expansion_batch04/t3_analytical/park_nx10/model.urdf,assets/expansion_batch04/t3_analytical/park_nx10/asset.contract.json
|
| 155 |
+
instrument.nanosurf_naiostm,CHEM-159,Scanning tunneling microscope,Nanosurf,NaioSTM,Nanosurf NaioSTM扫描隧道显微镜(花岗岩隔振台上的扫描头、500×500×200 nm扫描器、stick-slip自动进针、0.1–100 nA电流放大器、±10 V针尖电压、恒流/恒高成像、I-V与I-z谱、10×放大罩;含台下控制器),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/nanosurf_naiostm,28,3,36,52,1,7,11,False,0.204,0.204,0.104,assets/expansion_batch04/t3_analytical/nanosurf_naiostm/model.glb,assets/expansion_batch04/t3_analytical/nanosurf_naiostm/model.urdf,assets/expansion_batch04/t3_analytical/nanosurf_naiostm/asset.contract.json
|
| 156 |
+
instrument.rigaku_miniflex600_external_cooling,CHEM-160,Powder X-ray diffractometer,Rigaku,MiniFlex600,Rigaku MiniFlex600 粉末X射线衍射仪(外置循环水),"Microscopy, Imaging & Diffraction",assets/basic40_batch02/t4_measure/rigaku_miniflex600,13,3,25,12,0,1,12,False,0.6205,0.456,0.722,assets/basic40_batch02/t4_measure/rigaku_miniflex600/model.glb,assets/basic40_batch02/t4_measure/rigaku_miniflex600/model.urdf,assets/basic40_batch02/t4_measure/rigaku_miniflex600/asset.contract.json
|
| 157 |
+
instrument.rigaku_xtalabsynergy,CHEM-161,Single-crystal X-ray diffractometer,Rigaku Oxford Diffraction,XtaLAB Synergy-R,Rigaku XtaLAB Synergy-R单晶X射线衍射仪(HyPix-6000HE配置:PhotonJet-R转靶光源、1–10 mrad电动狭缝、κ测角仪与伸缩2θ臂、HyPix-6000HE混合光子计数探测器、两扇铰链前门与电气安全回路、Oxford Cryostream 1000),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy,77,11,44,55,8,8,16,False,1.3012,0.914,1.875,assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/model.glb,assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/model.urdf,assets/expansion_batch04/t3_analytical/rigaku_xtalabsynergy/asset.contract.json
|
| 158 |
+
instrument.evident_bx53p,CHEM-162,Polarizing microscope,Evident / Olympus,BX53-P,Evident / Olympus BX53-P偏光显微镜(锥光/正交配置:U-CPA勃氏镜、U-AN360P检偏镜、U-POC-2偏光聚光镜、U-SRP旋转台、四孔物镜转盘、倾斜三目筒),"Microscopy, Imaging & Diffraction",assets/expansion_batch04/t3_analytical/evident_bx53p,50,14,47,34,1,7,13,False,0.282,0.5124,0.534,assets/expansion_batch04/t3_analytical/evident_bx53p/model.glb,assets/expansion_batch04/t3_analytical/evident_bx53p/model.urdf,assets/expansion_batch04/t3_analytical/evident_bx53p/asset.contract.json
|
| 159 |
+
instrument.biotek_405ts,CHEM-163,Microplate washer,Agilent BioTek,405 TS (96-tube manifold),Agilent BioTek 405 TS微孔板洗板机(单96管洗头,内置四路缓冲切换A–D,标准SBS载板),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/biotek_405ts,25,3,36,26,2,12,17,False,0.3556,0.4318,0.254,assets/expansion_batch04/t4_measure/biotek_405ts/model.glb,assets/expansion_batch04/t4_measure/biotek_405ts/model.urdf,assets/expansion_batch04/t4_measure/biotek_405ts/asset.contract.json
|
| 160 |
+
instrument.biorad_miniprotean,CHEM-164,Gel electrophoresis system,Bio-Rad,Mini-PROTEAN Tetra + power supply,Bio-Rad Mini-PROTEAN Tetra垂直电泳槽(电极模块,可加陪伴模块运行1–4块胶)+ PowerPac Basic电源,Biochemical & Wet-Chemistry Assays,assets/expansion_batch03/t4_measure/biorad_miniprotean,40,8,36,37,1,11,17,False,0.41,0.289,0.1993,assets/expansion_batch03/t4_measure/biorad_miniprotean/model.glb,assets/expansion_batch03/t4_measure/biorad_miniprotean/model.urdf,assets/expansion_batch03/t4_measure/biorad_miniprotean/asset.contract.json
|
| 161 |
+
instrument.thermo_ibrightfl1500,CHEM-165,Gel & blot imager,Thermo Fisher Scientific,iBright FL1500,Thermo Fisher Invitrogen iBright FL1500凝胶与印迹成像系统(产品册配置),Biochemical & Wet-Chemistry Assays,assets/expansion_batch03/t4_measure/thermo_ibrightfl1500,19,3,24,32,2,5,10,False,0.38,0.68,0.6,assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/model.glb,assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/model.urdf,assets/expansion_batch03/t4_measure/thermo_ibrightfl1500/asset.contract.json
|
| 162 |
+
instrument.eppendorf_cellxpertc170i,CHEM-166,CO₂ cell-culture incubator,Eppendorf,CellXpert C170i,Eppendorf CellXpert C170i CO2细胞培养箱(O2 1–20 %、湿度与水位选件),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i,39,5,57,46,2,14,18,True,0.72,0.7153,0.9,assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/model.glb,assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/model.urdf,assets/expansion_batch04/t4_measure/eppendorf_cellxpertc170i/asset.contract.json
|
| 163 |
+
instrument.biorad_cfxopus,CHEM-167,Real-time qPCR system,Bio-Rad,CFX Opus 96,Bio-Rad CFX Opus 96实时荧光定量PCR仪(12011319),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/biorad_cfxopus,28,3,40,35,5,7,14,True,0.33,0.5608,0.36,assets/expansion_batch04/t4_measure/biorad_cfxopus/model.glb,assets/expansion_batch04/t4_measure/biorad_cfxopus/model.urdf,assets/expansion_batch04/t4_measure/biorad_cfxopus/asset.contract.json
|
| 164 |
+
instrument.bd_facsariaiii,CHEM-168,Flow cytometer & cell sorter,BD Biosciences,FACSAria III,BD FACSAria III流式细胞分选仪(2018规格,四激光),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/bd_facsariaiii,46,10,105,69,3,17,18,True,2.135,0.7286,0.71,assets/expansion_batch04/t4_measure/bd_facsariaiii/model.glb,assets/expansion_batch04/t4_measure/bd_facsariaiii/model.urdf,assets/expansion_batch04/t4_measure/bd_facsariaiii/asset.contract.json
|
| 165 |
+
instrument.malvern_microcalpeaq,CHEM-169,Isothermal titration calorimeter,Malvern Panalytical,MicroCal PEAQ-ITC,MicroCal PEAQ-ITC等温滴定量热仪(标准型,含洗涤模块),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/malvern_microcalpeaq,55,5,58,45,2,17,17,True,0.43,0.377,0.3688,assets/expansion_batch04/t4_measure/malvern_microcalpeaq/model.glb,assets/expansion_batch04/t4_measure/malvern_microcalpeaq/model.urdf,assets/expansion_batch04/t4_measure/malvern_microcalpeaq/asset.contract.json
|
| 166 |
+
instrument.cytiva_biacoret200,CHEM-170,Surface plasmon resonance system,Cytiva,Biacore T200,Biacore T200表面等离子共振生物传感器(处理单元),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/cytiva_biacoret200,56,7,66,64,5,11,20,True,0.6,0.615,0.69,assets/expansion_batch04/t4_measure/cytiva_biacoret200/model.glb,assets/expansion_batch04/t4_measure/cytiva_biacoret200/model.urdf,assets/expansion_batch04/t4_measure/cytiva_biacoret200/asset.contract.json
|
| 167 |
+
instrument.wtw_oxitopi,CHEM-171,Respirometric BOD system,WTW (Xylem),OxiTop-i,生化需氧量呼吸测定系统WTW OxiTop-i IS 6(6测头、PF 600瓶、IS 6感应搅拌台),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/wtw_oxitopi,96,30,45,33,24,13,19,True,0.265,0.1966,0.2556,assets/expansion_batch04/t4_measure/wtw_oxitopi/model.glb,assets/expansion_batch04/t4_measure/wtw_oxitopi/model.urdf,assets/expansion_batch04/t4_measure/wtw_oxitopi/asset.contract.json
|
| 168 |
+
instrument.seal_aa500,CHEM-172,Segmented continuous-flow analyzer,SEAL Analytical,AA500,分段连续流动分析仪SEAL AA500(4通道营养盐:NOx、氨、磷酸盐、硅酸盐;带AS2 XY进样器),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/seal_aa500,66,11,29,40,1,20,17,True,1.405,0.479,0.409,assets/expansion_batch04/t4_measure/seal_aa500/model.glb,assets/expansion_batch04/t4_measure/seal_aa500/model.urdf,assets/expansion_batch04/t4_measure/seal_aa500/asset.contract.json
|
| 169 |
+
instrument.bmg_clariostarplus,CHEM-173,Multi-mode microplate reader,BMG LABTECH,CLARIOstar Plus,多模式微孔板读板仪BMG LABTECH CLARIOstar Plus(光谱仪吸光、LVF单色器荧光、偏振、发光,两个注射泵),Biochemical & Wet-Chemistry Assays,assets/expansion_batch04/t4_measure/bmg_clariostarplus,28,5,22,37,2,7,11,True,0.4512,0.5168,0.401,assets/expansion_batch04/t4_measure/bmg_clariostarplus/model.glb,assets/expansion_batch04/t4_measure/bmg_clariostarplus/model.urdf,assets/expansion_batch04/t4_measure/bmg_clariostarplus/asset.contract.json
|
| 170 |
+
instrument.mt_quantos_q2_xpe206dr,CHEM-174,Automated powder dosing system,METTLER TOLEDO,Quantos Q2 + XPE206DR,自动粉末定量分配仪 — METTLER TOLEDO Quantos Q2 + XPE206DR,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/mt_quantos_q2,18,3,20,12,0,1,12,False,0.263,0.542,0.495,assets/basic40_batch02/t5_automation/mt_quantos_q2/model.glb,assets/basic40_batch02/t5_automation/mt_quantos_q2/model.urdf,assets/basic40_batch02/t5_automation/mt_quantos_q2/asset.contract.json
|
| 171 |
+
instrument.opentrons_flex_single_5_1000ul,CHEM-175,Automated liquid-handling robot,Opentrons,Flex (1-channel 5–1000 µL),自动移液工作站 — Opentrons Flex 单通道5–1000 µL,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/opentrons_flex,28,4,15,10,0,16,8,False,0.87,0.6907,0.84,assets/basic40_batch02/t5_automation/opentrons_flex/model.glb,assets/basic40_batch02/t5_automation/opentrons_flex/model.urdf,assets/basic40_batch02/t5_automation/opentrons_flex/asset.contract.json
|
| 172 |
+
instrument.azenta_automated_roll_heat_sealer_a4s,CHEM-176,Automated microplate heat sealer,Azenta Life Sciences,Automated Roll Heat Sealer (a4S),自动微孔板热封膜机,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/azenta_heat_sealer,17,1,22,9,1,1,5,False,0.2312,0.5075,0.403,assets/basic40_batch02/t5_automation/azenta_heat_sealer/model.glb,assets/basic40_batch02/t5_automation/azenta_heat_sealer/model.urdf,assets/basic40_batch02/t5_automation/azenta_heat_sealer/asset.contract.json
|
| 173 |
+
instrument.azenta_intellixcap_s1_46_0001,CHEM-177,Automated tube decapper/recapper,Azenta Life Sciences,IntelliXcap S1 46-0001,自动开盖封盖机,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/azenta_intellixcap_s1,10,8,13,6,0,1,11,False,0.17,0.24,0.3,assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/model.glb,assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/model.urdf,assets/basic40_batch02/t5_automation/azenta_intellixcap_s1/asset.contract.json
|
| 174 |
+
instrument.brooks_preciseflex_400,CHEM-178,Lab sample-transfer robot arm,Brooks Automation,PreciseFlex 400,实验室样品转运机械臂 — Brooks Automation PreciseFlex 400 标准臂400 mm行程,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/preciseflex_400,12,4,15,9,0,1,6,False,0.715,0.2111,0.682,assets/basic40_batch02/t5_automation/preciseflex_400/model.glb,assets/basic40_batch02/t5_automation/preciseflex_400/model.urdf,assets/basic40_batch02/t5_automation/preciseflex_400/asset.contract.json
|
| 175 |
+
instrument.ziath_dp5_mirage_2023,CHEM-179,2D-barcode rack reader,Azenta Ziath,DP5 Mirage,样品管二维条码读架仪,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/ziath_dp5,16,1,16,7,0,1,7,False,0.208,0.135,0.1214,assets/basic40_batch02/t5_automation/ziath_dp5/model.glb,assets/basic40_batch02/t5_automation/ziath_dp5/model.urdf,assets/basic40_batch02/t5_automation/ziath_dp5/asset.contract.json
|
| 176 |
+
instrument.alicat_mc_1slpm_rev6,CHEM-180,Gas mass-flow controller,Alicat Scientific,"MC, 1 SLPM full scale, Rev6",气体质量流量控制器(Alicat MC,1 SLPM,标准精度,Rev6),Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/alicat_mc,11,7,25,8,1,0,7,False,0.0911,0.0267,0.1033,assets/basic40_batch02/t5_automation/alicat_mc/model.glb,assets/basic40_batch02/t5_automation/alicat_mc/model.urdf,assets/basic40_batch02/t5_automation/alicat_mc/asset.contract.json
|
| 177 |
+
instrument.bronkhorst_p702cv_5bar_gauge_n2,CHEM-181,Electronic back-pressure controller,Bronkhorst,EL-PRESS P-702CV,电子背压控制器,Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/bronkhorst_p702cv,11,1,18,9,0,0,9,False,0.127,0.025,0.123,assets/basic40_batch02/t5_automation/bronkhorst_p702cv/model.glb,assets/basic40_batch02/t5_automation/bronkhorst_p702cv/model.urdf,assets/basic40_batch02/t5_automation/bronkhorst_p702cv/asset.contract.json
|
| 178 |
+
instrument.vici_euta_2sd6mwe,CHEM-182,Multi-position gas stream-selection valve,VICI Valco,EUTA-2SD6MWE,多路气体自动切换阀 — VICI Valco EUTA-2SD6MWE(6位,2 inch隔热杆),Automation & Gas/Liquid Supply,assets/basic40_batch02/t5_automation/vici_euta,15,1,8,3,0,7,10,False,0.2338,0.086,0.105,assets/basic40_batch02/t5_automation/vici_euta/model.glb,assets/basic40_batch02/t5_automation/vici_euta/model.urdf,assets/basic40_batch02/t5_automation/vici_euta/asset.contract.json
|
| 179 |
+
instrument.bronkhorst_cemw,CHEM-183,Controlled evaporator & mixer,Bronkhorst,CEM W-202A,受控蒸发与混气进料器Bronkhorst CEM W-202A-NN0-K(三通混合阀+100 W换热器),Automation & Gas/Liquid Supply,assets/expansion_batch03/t5_automation/bronkhorst_cemw,16,1,20,21,0,6,12,True,0.12,0.11,0.3819,assets/expansion_batch03/t5_automation/bronkhorst_cemw/model.glb,assets/expansion_batch03/t5_automation/bronkhorst_cemw/model.urdf,assets/expansion_batch03/t5_automation/bronkhorst_cemw/asset.contract.json
|
| 180 |
+
instrument.newera_ne1000,CHEM-184,Programmable syringe pump,New Era Pump Systems,NE-1000 Multi-Phaser,可编程注射泵New Era NE-1000 Multi-Phaser(单通道,12 V DC),Automation & Gas/Liquid Supply,assets/expansion_batch05/t5_automation/newera_ne1000,47,12,31,35,10,9,15,True,0.2965,0.1527,0.1151,assets/expansion_batch05/t5_automation/newera_ne1000/model.glb,assets/expansion_batch05/t5_automation/newera_ne1000/model.urdf,assets/expansion_batch05/t5_automation/newera_ne1000/asset.contract.json
|
| 181 |
+
instrument.nabertherm_l9,CHEM-185,Muffle furnace,Nabertherm,L 9/11/SKM,Nabertherm L 9/11/SKM 马弗炉(目录版 3.4 kW),Lab Environment & Utilities,assets/basic40_batch02/t1_thermal/nabertherm_l9,10,7,12,10,1,4,8,False,0.49,0.505,0.58,assets/basic40_batch02/t1_thermal/nabertherm_l9/model.glb,assets/basic40_batch02/t1_thermal/nabertherm_l9/model.urdf,assets/basic40_batch02/t1_thermal/nabertherm_l9/asset.contract.json
|
| 182 |
+
instrument.carbolite_tf1_12_60_300,CHEM-186,Tube furnace (controlled atmosphere),Carbolite Gero,TF1 12/60/300,管式气氛炉 Carbolite Gero TF1 12/60/300,Lab Environment & Utilities,assets/basic40_batch02/t1_thermal/carbolite_tf1,19,6,14,5,1,1,13,False,0.876,0.48,0.575,assets/basic40_batch02/t1_thermal/carbolite_tf1/model.glb,assets/basic40_batch02/t1_thermal/carbolite_tf1/model.urdf,assets/basic40_batch02/t1_thermal/carbolite_tf1/asset.contract.json
|
| 183 |
+
instrument.julabo_corio_cd200f,CHEM-187,Heating/refrigerated circulator,JULABO,CORIO CD-200F,JULABO CORIO CD-200F 9012701.N1.03 加热制冷循环浴,Lab Environment & Utilities,assets/basic40_batch02/t1_thermal/julabo_corio_cd200f,20,6,15,4,1,1,13,False,0.23,0.3898,0.65,assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/model.glb,assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/model.urdf,assets/basic40_batch02/t1_thermal/julabo_corio_cd200f/asset.contract.json
|
| 184 |
+
instrument.vacuubrand_pc3001_vario_select,CHEM-188,Chemistry vacuum pumping unit,VACUUBRAND,PC 3001 VARIO select,化学耐腐蚀真空工作站,Lab Environment & Utilities,assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001,15,3,12,7,1,0,11,False,0.306,0.303,0.4,assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/model.glb,assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/model.urdf,assets/basic40_batch02/t2_vacuum/vacuubrand_pc3001/asset.contract.json
|
| 185 |
+
instrument.inert_purelab_he_2gb,CHEM-189,Inert-atmosphere glovebox,Inert,PureLab HE 2GB,Inert PureLab HE 2GB 惰性气氛手套箱,Lab Environment & Utilities,assets/basic40_batch02/t2_vacuum/inert_purelab_he,15,2,27,10,1,9,7,False,2.0,1.067,1.921,assets/basic40_batch02/t2_vacuum/inert_purelab_he/model.glb,assets/basic40_batch02/t2_vacuum/inert_purelab_he/model.urdf,assets/basic40_batch02/t2_vacuum/inert_purelab_he/asset.contract.json
|
| 186 |
+
instrument.elga_purelab_flex3,CHEM-190,Lab ultrapure water system,ELGA LabWater,PURELAB flex 3,实验室超纯水系统,Lab Environment & Utilities,assets/basic40_batch02/t2_vacuum/elga_purelab_flex3,17,6,26,8,0,1,7,False,0.236,0.47,0.9,assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/model.glb,assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/model.urdf,assets/basic40_batch02/t2_vacuum/elga_purelab_flex3/asset.contract.json
|
| 187 |
+
instrument.miele_plw6111,CHEM-191,Laboratory glassware washer,Miele,PLW 6111,Miele PLW 6111 DP SC CL H14 10958380 实验室玻璃器皿清洗机,Lab Environment & Utilities,assets/basic40_batch02/t1_thermal/miele_plw6111,29,7,20,8,0,27,9,False,0.65,0.744,1.87,assets/basic40_batch02/t1_thermal/miele_plw6111/model.glb,assets/basic40_batch02/t1_thermal/miele_plw6111/model.urdf,assets/basic40_batch02/t1_thermal/miele_plw6111/asset.contract.json
|
| 188 |
+
instrument.tuttnauer_3870elvd,CHEM-192,Steam autoclave,Tuttnauer,3870ELV-D,立式高压蒸汽灭菌器Tuttnauer 3870ELV-D(85 L,冷却选件),Lab Environment & Utilities,assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd,21,5,19,24,1,9,16,True,0.731,0.555,1.0,assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/model.glb,assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/model.urdf,assets/expansion_batch03/t2_vacuum/tuttnauer_3870elvd/asset.contract.json
|
| 189 |
+
instrument.esco_ac24s8,CHEM-193,Biological safety cabinet,Esco Lifesciences,AC2-4S8-TU,生物安全柜Esco Airstream Plus AC2-4S8-TU(II级A2型,4 ft,不锈钢侧壁,UV-30A),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/esco_ac24s8,40,9,30,24,7,7,12,True,1.34,0.823,1.4,assets/expansion_batch04/t2_vacuum/esco_ac24s8/model.glb,assets/expansion_batch04/t2_vacuum/esco_ac24s8/model.urdf,assets/expansion_batch04/t2_vacuum/esco_ac24s8/asset.contract.json
|
| 190 |
+
instrument.inficon_ul1000fab,CHEM-194,Helium leak detector,INFICON,UL1000 Fab,氦质谱检漏仪INFICON UL1000 Fab(移动式,干式涡旋泵,230 V 50 Hz),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/inficon_ul1000fab,27,6,28,26,4,6,15,True,1.068,0.525,0.85,assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/model.glb,assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/model.urdf,assets/expansion_batch04/t2_vacuum/inficon_ul1000fab/asset.contract.json
|
| 191 |
+
instrument.vaisala_dmt152,CHEM-195,Trace-moisture dew-point transmitter,Vaisala,DMT152,"微量水露点变送器Vaisala DRYCAP DMT152(ISO G1/2"")",Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/vaisala_dmt152,11,1,25,21,0,2,16,True,0.1275,0.033,0.03,assets/expansion_batch04/t2_vacuum/vaisala_dmt152/model.glb,assets/expansion_batch04/t2_vacuum/vaisala_dmt152/model.urdf,assets/expansion_batch04/t2_vacuum/vaisala_dmt152/asset.contract.json
|
| 192 |
+
instrument.peak_precisionhydrogen,CHEM-196,Laboratory hydrogen generator,PEAK Scientific,Precision Hydrogen Trace 500,实验室氢气发生器PEAK Precision Hydrogen Trace 500(存档型号),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen,22,2,23,21,7,5,13,True,0.3814,0.5656,0.4067,assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/model.glb,assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/model.urdf,assets/expansion_batch04/t2_vacuum/peak_precisionhydrogen/asset.contract.json
|
| 193 |
+
instrument.eppendorf_cryocubef570n,CHEM-197,Ultra-low temperature freezer,Eppendorf,CryoCube F570n,超低温冰箱Eppendorf CryoCube F570n(570 L,230 V,F571300031),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n,41,12,35,34,8,11,12,True,1.1415,1.009,1.95,assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/model.glb,assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/model.urdf,assets/expansion_batch04/t2_vacuum/eppendorf_cryocubef570n/asset.contract.json
|
| 194 |
+
instrument.binder_kbf115,CHEM-198,Constant climate (T/RH) chamber,BINDER,KBF 115,恒温恒湿试验箱BINDER KBF 115(102 L,KBF115-230V,9020-0320),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/binder_kbf115,31,3,33,33,6,7,16,True,0.9055,0.7971,1.05,assets/expansion_batch04/t2_vacuum/binder_kbf115/model.glb,assets/expansion_batch04/t2_vacuum/binder_kbf115/model.urdf,assets/expansion_batch04/t2_vacuum/binder_kbf115/asset.contract.json
|
| 195 |
+
instrument.esco_efa5uduvw,CHEM-199,Chemical fume hood,Esco Lifesciences,Frontier Acela EFA-5UDUVW-9,台式化学通风柜Esco Frontier Acela EFA-5UDUVW-9(1.5 m美国版,选配Sentinel XL风速监视器),Lab Environment & Utilities,assets/expansion_batch05/t2_vacuum/esco_efa5uduvw,39,11,32,32,6,10,14,True,1.602,0.9097,1.521,assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/model.glb,assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/model.urdf,assets/expansion_batch05/t2_vacuum/esco_efa5uduvw/asset.contract.json
|
| 196 |
+
instrument.inert_puresolvmd,CHEM-200,Solvent purification system,Inert,PureSolv MD 7,溶剂纯化系统Inert PureSolv MD 7(7路溶剂,双柱,17 L储罐),Lab Environment & Utilities,assets/expansion_batch04/t2_vacuum/inert_puresolvmd,84,27,67,23,0,18,14,True,1.6104,0.8356,1.9459,assets/expansion_batch04/t2_vacuum/inert_puresolvmd/model.glb,assets/expansion_batch04/t2_vacuum/inert_puresolvmd/model.urdf,assets/expansion_batch04/t2_vacuum/inert_puresolvmd/asset.contract.json
|
| 197 |
+
instrument.agilent_7890b_ssl_fid,,Gas chromatograph (S/SL inlet + FID),Agilent,7890B,Agilent 7890B 气相色谱仪(单 S/SL 进样口 + FID),Chromatography & Electrophoresis,assets/GC7890B,52,50,0,16,3,1,0,False,0.5803,0.545,0.4905,assets/GC7890B/GC7890B.glb,assets/GC7890B/GC7890B.urdf,
|
| 198 |
+
instrument.ohaus_px224e,,Analytical balance,OHAUS,Pioneer PX224/E,OHAUS Pioneer PX224/E 分析天平,Basic Metrology & Sample Handling,assets/PX224E,25,16,0,7,1,1,0,False,0.209,0.3285,0.309,assets/PX224E/PX224E.glb,assets/PX224E/PX224E.urdf,
|
| 199 |
+
instrument.ohaus_spx2201,,Portable precision balance,OHAUS,Scout SPX2201,OHAUS Scout SPX2201 电子天平,Basic Metrology & Sample Handling,assets/SPX2201,23,15,0,7,1,1,0,False,0.202,0.2255,0.054,assets/SPX2201/SPX2201.glb,assets/SPX2201/SPX2201.urdf,
|
catalog/catalog.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
examples/quickstart_fume_hood.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Drive the Esco fume hood (CHEM-199) through its contract API.
|
| 2 |
+
|
| 3 |
+
The agent raises the sash, notices that the uncalibrated airflow monitor reads low,
|
| 4 |
+
measures the face velocity with a handheld anemometer and calibrates the monitor.
|
| 5 |
+
|
| 6 |
+
Run from the repository root: python examples/quickstart_fume_hood.py
|
| 7 |
+
"""
|
| 8 |
+
import sys
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
|
| 12 |
+
from asset_runtime import esco_efa5uduvw as rt # noqa: E402
|
| 13 |
+
|
| 14 |
+
hood = rt.EscoEfa5uduvwRuntime("hood_01")
|
| 15 |
+
hood.register_principal("lab", "evaluator") # sets up the world and can see hidden truth
|
| 16 |
+
hood.register_principal("robot", "agent") # sees only what a policy may see
|
| 17 |
+
lab, robot = hood.session("lab"), hood.session("robot")
|
| 18 |
+
_n = 0
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def call(session, capability, **arguments):
|
| 22 |
+
global _n
|
| 23 |
+
_n += 1
|
| 24 |
+
r = session.invoke(instance_id="hood_01", capability_id=capability, arguments=arguments, request_id=f"r{_n}")
|
| 25 |
+
if r["status"] != "succeeded":
|
| 26 |
+
raise RuntimeError(f"{capability}: {r['error']}")
|
| 27 |
+
return r["result"]
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def show(label):
|
| 31 |
+
obs = robot.read(instance_id="hood_01", state_ids=["monitor.reading_m_s", "monitor.alarm"])["observations"]
|
| 32 |
+
print(f"{label:20s} reading {obs['monitor.reading_m_s']['value']:.2f} m/s alarm {obs['monitor.alarm']['value'] or 'none'}")
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
call(lab, "plant.configure", **rt.PLANT_EXAMPLE) # ambient 295.15 K, 101.325 kPa
|
| 36 |
+
call(lab, "exhaust.configure", **rt.EXHAUST_EXAMPLE) # building exhaust, damper half open
|
| 37 |
+
call(robot, "light.set", on=True)
|
| 38 |
+
call(robot, "sash.set", height_m=0.457) # raise the sash to the 18-inch stop
|
| 39 |
+
call(lab, "sim.step", dt_s=30.0) # let the airflow settle
|
| 40 |
+
show("before calibration")
|
| 41 |
+
|
| 42 |
+
v = call(robot, "anemometer.measure")["face_velocity_m_s"] # 18-point traverse of the sash opening
|
| 43 |
+
print(f"{'anemometer':20s} {v:.3f} m/s")
|
| 44 |
+
call(robot, "monitor.calibrate", reference_m_s=round(v, 3))
|
| 45 |
+
call(lab, "sim.step", dt_s=10.0)
|
| 46 |
+
show("after calibration")
|
| 47 |
+
|
| 48 |
+
print("agent-visible capabilities:", len(robot.describe(instance_id="hood_01")["capabilities"]))
|
outputs/expansion_batch03/t4_measure/antonpaar_litesizerdia/example_setup.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
import sys
|
| 3 |
+
R=Path(__file__).resolve().parents[4];sys.path.insert(0,str(R));from scripts.asset_runtime.antonpaar_litesizerdia import *
|
| 4 |
+
OBSERVED=[]
|
| 5 |
+
def call(h,k,**a):
|
| 6 |
+
out=h.invoke(k,**a);OBSERVED.append(dict(capability_id=k,arguments=copy.deepcopy(a),result=copy.deepcopy(out)));return out
|
| 7 |
+
def build(mode='liquid',sid='grain_capecod',method=None,plant=None,count=128):
|
| 8 |
+
h=AntonpaarLitesizerdiaRuntime();call(h,'plant.configure',**dict(PLANT_EXAMPLE,**(plant or {})))
|
| 9 |
+
if mode!='liquid':
|
| 10 |
+
call(h,'latch.set',angle_rad=.65);call(h,'module.withdraw',distance_m=.32);call(h,'module.select',mode=mode);call(h,'module.withdraw',distance_m=0.);call(h,'latch.set',angle_rad=0.)
|
| 11 |
+
call(h,'method.configure',**dict(METHOD_EXAMPLE,**dict({'mode':mode},**(method or {}))));call(h,'lid.set',angle_rad=1.55)
|
| 12 |
+
if mode=='liquid':call(h,'liquid.fill',volume_m3=.0003)
|
| 13 |
+
if mode=='dry':call(h,'air.add',amount_mol=1.);call(h,'vacuum.set',enabled=True)
|
| 14 |
+
call(h,'lid.set',angle_rad=0.);call(h,'power.set',enabled=True);call(h,'background.capture');call(h,'lid.set',angle_rad=1.55);call(h,'sample.load',**dict(SAMPLE_EXAMPLE,substance_id=sid,particle_count=count));call(h,'lid.set',angle_rad=0.);return h
|
outputs/expansion_batch03/t4_measure/antonpaar_litesizerdls/example_setup.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
import sys,copy
|
| 3 |
+
R=Path(__file__).resolve().parents[4];sys.path.insert(0,str(R/'scripts'));from asset_runtime import antonpaar_litesizerdls as rt
|
| 4 |
+
OBSERVED=[]
|
| 5 |
+
def call(h,k,**a):
|
| 6 |
+
r=h.invoke(k,**a);OBSERVED.append(dict(capability_id=k,arguments=copy.deepcopy(a),result=copy.deepcopy(r)));return r
|
| 7 |
+
def configure(h,kind='omega',reference=rt.SID,mode='dls'):
|
| 8 |
+
call(h,'plant.configure',**rt.PLANT_EXAMPLE);call(h,'power.set',enabled=True);call(h,'lid.release');call(h,'lid.set',angle_rad=1.7);call(h,'cuvette.set',lift_m=.12);call(h,'cell.configure',kind=kind);call(h,'cell_cap.set',lift_m=.022)
|
| 9 |
+
sample=dict(rt.SAMPLE_EXAMPLE,reference_id=reference,volume_m3=.7e-6 if kind=='omega' else 1e-6);call(h,'sample.load',**sample);call(h,'cell_cap.set',lift_m=0.);call(h,'cuvette.set',lift_m=0.);call(h,'lid.set',angle_rad=0.)
|
| 10 |
+
call(h,'temperature.calibrate',reference_k=[293.15,313.15],measured_k=[293.15,313.15]);call(h,'dls.calibrate',reference_m=100e-9,measured_m=100e-9);call(h,'mobility.calibrate',reference_m2_v_s=[-1e-8,1e-8],measured_m2_v_s=[-1e-8,1e-8]);call(h,'method.configure',**dict(rt.METHOD_EXAMPLE,mode=mode,angle_deg=15 if mode=='zeta' else 90));h.step(360.)
|
| 11 |
+
return h
|
| 12 |
+
def run(h):
|
| 13 |
+
call(h,'acquisition.start')
|
| 14 |
+
while h.phase=='running':h.step(.1)
|
| 15 |
+
return call(h,'process.measure')
|
| 16 |
+
def unload(h):
|
| 17 |
+
call(h,'lid.release');call(h,'lid.set',angle_rad=1.7);call(h,'cuvette.set',lift_m=.12);call(h,'cell_cap.set',lift_m=.022);return call(h,'sample.unload')
|
| 18 |
+
if __name__=='__main__':
|
| 19 |
+
h=configure(rt.AntonpaarLitesizerdlsRuntime());r=run(h);print(r['phase'],r['dls']['z_average_m'],r['dls']['pdi']);call(h,'method.configure',**dict(rt.METHOD_EXAMPLE,mode='zeta',angle_deg=15));r=run(h);print(r['phase'],r['els']['zeta_v']);unload(h);print(call(h,'ledger.read'))
|
outputs/expansion_batch03/t4_measure/antonpaar_poremaster60/example_setup.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
import sys,copy,math
|
| 3 |
+
R=Path(__file__).resolve().parents[4];sys.path.insert(0,str(R/'scripts'));from asset_runtime import antonpaar_poremaster60 as rt
|
| 4 |
+
OBSERVED={}
|
| 5 |
+
def call(r,k,**a):
|
| 6 |
+
out=r.invoke(k,**a);OBSERVED.setdefault(k,[]).append((copy.deepcopy(a),copy.deepcopy(out)));return out
|
| 7 |
+
def setup(name='micp_demo',plant=None,ref='hemp_shiv',mass=None,entered_mass=None,low1=False):
|
| 8 |
+
r=rt.AntonpaarPoremaster60Runtime(name);p=copy.deepcopy(rt.PLANT_EXAMPLE)
|
| 9 |
+
if plant:p.update(plant)
|
| 10 |
+
call(r,'plant.configure',**p);call(r,'cell.configure',bulb_volume_m3=3.2e-6,stem_capacity_m3=.5e-6);call(r,'power.set',enabled=True)
|
| 11 |
+
for i in range(3):
|
| 12 |
+
xmax=[50*rt.PSI,1500*rt.PSI,rt.P_MAX][i];xs=[0.,xmax];call(r,'pressure.calibrate',range_index=i,reference_pa=xs,measured_pa=[p['pressure_gain'][i]*x+p['pressure_offset_pa'][i] for x in xs])
|
| 13 |
+
xs=[0.,.2e-6];call(r,'volume.calibrate',reference_volume_m3=xs,measured_capacitance_f=[x/p['capacitance_volume_factor_m3_f']+p['capacitance_offset_f'] for x in xs]);call(r,'mercury.fill',mass_kg=.1)
|
| 14 |
+
c=rt.LIB['substances'][ref]['conditions'];m=mass or c['source_sample_mass_kg'] or .0001;bulk=(c['source_bulk_volume_m3']/c['source_sample_mass_kg']*m) if c['source_bulk_volume_m3'] and c['source_sample_mass_kg'] else max(rt.CURVES[(ref,'intrusion')][1])*m*1.2
|
| 15 |
+
call(r,'guard0.set',angle_rad=1.4);call(r,'sample.load',sample_id=name+'_sample',reference_id=ref,true_dry_mass_kg=m,true_bulk_volume_m3=bulk,dry=True,accept_cross_instrument_transfer=True)
|
| 16 |
+
if low1:call(r,'guard1.set',angle_rad=1.4);call(r,'cell.transfer',destination='low1')
|
| 17 |
+
call(r,'guard0.set',angle_rad=0.);call(r,'guard1.set',angle_rad=0.)
|
| 18 |
+
# Host-provided engineering blank at the independently specified fill volume. Not measured OEM calibration.
|
| 19 |
+
fill_volume=r.bulb-bulk+r.capacity;grid=[0.]+[rt.P_MAX*i/1000 for i in range(1,1001)];blank=[fill_volume*(-math.expm1(-v/p['hg_bulk_modulus_pa']))+p['glass_compliance_m3_pa']*v for v in grid];call(r,'blank.calibrate',pressures_pa=grid,volumes_m3=blank)
|
| 20 |
+
meth=copy.deepcopy(rt.METHOD_EXAMPLE);meth['entered_mass_kg']=entered_mass or m
|
| 21 |
+
if ref!='hemp_shiv':
|
| 22 |
+
minimum=rt.CURVES[(ref,'intrusion')][0][0];meth['pressures_pa']=[max(minimum,3*rt.PSI),10*rt.PSI,30*rt.PSI,50*rt.PSI]
|
| 23 |
+
call(r,'method.configure',**meth);return r
|
| 24 |
+
|
| 25 |
+
def run(r,max_s=3600):
|
| 26 |
+
call(r,'acquisition.start')
|
| 27 |
+
for _ in range(int(max_s/rt.DT)):
|
| 28 |
+
r.step(rt.DT)
|
| 29 |
+
if r.phase!='running':break
|
| 30 |
+
if r.phase!='succeeded':raise RuntimeError((r.phase,r.failure,r.stage,r.p,r.index,r.v))
|
| 31 |
+
return call(r,'process.measure')
|
| 32 |
+
def high(r,cycle=True):
|
| 33 |
+
call(r,'guard'+r.position[-1]+'.set',angle_rad=1.4);call(r,'cap.set',lift_m=.19);call(r,'cell.transfer',destination='high');call(r,'guard0.set',angle_rad=0.);call(r,'guard1.set',angle_rad=0.);call(r,'cap.set',lift_m=0.)
|
| 34 |
+
meth=copy.deepcopy(rt.METHOD_EXAMPLE);meth.update(stage='high',entered_mass_kg=r.sample['true_dry_mass_kg'],pressure_rate_pa_s=2e7,pressure_tolerance_pa=7000.,max_volume_drift_m3_s=1e-12);peak=rt.CURVES[(r.sample['reference_id'],'intrusion')][0][-1];meth['pressures_pa']=[50*rt.PSI,1e6,1e7,1e8,peak]+([1e8,1e7,1e6,rt.CURVES[(r.sample['reference_id'],'extrusion')][0][0]] if cycle else []);call(r,'method.configure',**meth);return r
|
| 35 |
+
if __name__=='__main__':
|
| 36 |
+
import json
|
| 37 |
+
r=setup();run(r);high(r);out=run(r);print(r.phase,len(out['points']),r.elapsed,out['max_pore_volume_m3_kg']);print(json.dumps(r._ledger(),indent=2));Path(__file__).with_name('example_porosimetry.json').write_text(json.dumps({'result':out,'ledger':r._ledger(),'scope':'engineering blank calibration; independent measured hemp fullcycle transfer'},indent=2)+'\n')
|
outputs/expansion_batch03/t4_measure/antonpaar_psa1190/example_setup.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
import sys,copy
|
| 3 |
+
R=Path(__file__).resolve().parents[4];sys.path.insert(0,str(R));from scripts.asset_runtime.antonpaar_psa1190 import *
|
| 4 |
+
OBSERVED=[]
|
| 5 |
+
def call(h,k,**a):
|
| 6 |
+
r=h.invoke(k,**a);OBSERVED.append(dict(capability_id=k,arguments=copy.deepcopy(a),result=copy.deepcopy(r)));return r
|
| 7 |
+
def build(mode='wet',sid=SID):
|
| 8 |
+
h=AntonpaarPsa1190Runtime();p=dict(PLANT_EXAMPLE)
|
| 9 |
+
if sid.startswith('soil_'):p.update(n635=1.543,k635=.01,n830=1.543,k830=.01)
|
| 10 |
+
if mode=='dry':p['medium_n']=1.
|
| 11 |
+
call(h,'plant.configure',**p);call(h,'cover.set',angle_rad=1.2);call(h,'ultrasound.select',power_w=50.);call(h,'cover.set',angle_rad=0.);m=dict(METHOD_EXAMPLE,mode=mode,medium_n=p['medium_n'],n635=p['n635'],k635=p['k635'],n830=p['n830'],k830=p['k830']);call(h,'method.configure',**m)
|
| 12 |
+
if mode=='wet':call(h,'tank_lid.set',slide_m=.17);call(h,'liquid.fill',volume_m3=.00045);call(h,'tank_lid.set',slide_m=0.)
|
| 13 |
+
else:call(h,'air.add',amount_mol=2.)
|
| 14 |
+
call(h,'power.set',enabled=True);call(h,'sim.step',dt_s=60.);call(h,'background.start');call(h,'sim.step',dt_s=60.)
|
| 15 |
+
s=dict(SAMPLE_EXAMPLE,substance_id=sid,accept_range_truncation=True)
|
| 16 |
+
if sid.startswith('soil_'):s.update(mass_kg=.00045,true_density_kg_m3=2650.)
|
| 17 |
+
if mode=='wet':call(h,'tank_lid.set',slide_m=.17)
|
| 18 |
+
else:call(h,'dry_hood.set',lift_m=.20);call(h,'distributor.set',angle_rad=.6);s['mass_kg']=.030
|
| 19 |
+
call(h,'sample.load',**s)
|
| 20 |
+
if mode=='wet':call(h,'tank_lid.set',slide_m=0.)
|
| 21 |
+
else:call(h,'dry_hood.set',lift_m=0.)
|
| 22 |
+
return h
|
| 23 |
+
if __name__=='__main__':
|
| 24 |
+
for mode,sid in [('wet',SID),('wet','soil_2014_111'),('dry',SID)]:
|
| 25 |
+
h=build(mode,sid);call(h,'acquisition.start');call(h,'sim.step',dt_s=15.1);r=call(h,'acquisition.result');print(mode,sid,h.phase,h.error,h.obsc,None if h.psd is None else {k:v for k,v in h.psd.items() if k in ['d10_m','d50_m','d90_m','relative_fit_residual']});print(h._ledger())
|
| 26 |
+
print('caps',len(CAPS),'slots',len(SLOTS))
|
outputs/expansion_batch03/t4_measure/biolin_sigma700/example_setup.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
import sys,copy
|
| 3 |
+
ROOT=Path(__file__).resolve().parents[4];sys.path.insert(0,str(ROOT/'scripts'));from asset_runtime import biolin_sigma700 as rt
|
| 4 |
+
OBSERVED=[]
|
| 5 |
+
def call(h,k,**a):
|
| 6 |
+
r=h.invoke(k,**a);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));return r
|
| 7 |
+
def build(probe='plate',sid='cas_67_56_1',method=None,plant=None,c=0.,temp=293.15):
|
| 8 |
+
p=dict(rt.PLANT_EXAMPLE)
|
| 9 |
+
if sid.startswith(('apg_','sds_')):p.update(liquid_density_kg_m3=998.20715,liquid_cp_j_kg_k=4184.0509)
|
| 10 |
+
p.update(plant or {});h=rt.BiolinSigma700Runtime();call(h,'plant.configure',**p);call(h,'door.set',angle_rad=2.35);call(h,'probe.select',probe=probe);call(h,'sample.load',**dict(rt.SAMPLE_EXAMPLE,substance_id=sid,concentration_kg_m3=c,temperature_k=temp));call(h,'door.set',angle_rad=0.);call(h,'method.configure',**dict(rt.METHOD_EXAMPLE,**dict({'accept_ring_proxy':probe=='ring','analysis_density_difference_kg_m3':p['liquid_density_kg_m3']-p['upper_density_kg_m3']},**(method or {}))));call(h,'power.set',enabled=True);h.step(2.);call(h,'balance.tare');return h
|
outputs/expansion_batch03/t4_measure/biolin_thetaflex/example_setup.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
import sys,copy,math
|
| 3 |
+
ROOT=Path(__file__).resolve().parents[4];sys.path.insert(0,str(ROOT/'scripts'));from asset_runtime import biolin_thetaflex as rt
|
| 4 |
+
OBSERVED=[]
|
| 5 |
+
def call(h,k,**a):
|
| 6 |
+
r=h.invoke(k,**a);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));return r
|
| 7 |
+
|
| 8 |
+
def finish(h,max_s=60):
|
| 9 |
+
start=h.time_s
|
| 10 |
+
while h.phase=='running' and h.time_s-start<max_s:call(h,'sim.step',dt_s=.1)
|
| 11 |
+
assert h.phase=='succeeded',(h.phase,h.error,h.stage)
|
| 12 |
+
return call(h,'acquisition.result')
|
| 13 |
+
def setup(instance_id='thetaflex_01',reference_id=rt.SAMPLE_EXAMPLE['reference_id'],plant=None):
|
| 14 |
+
h=rt.BiolinThetaFlexRuntime(instance_id);call(h,'plant.configure',**(plant or rt.PLANT_EXAMPLE));call(h,'sample.load',reference_id=reference_id,accept_unknown_conditions=True);call(h,'stock.load',reference_id=reference_id,volume_m3=2e-7);call(h,'power.set',enabled=True);call(h,'illumination.set',fraction=.8);call(h,'focus.set',position_m=.006);call(h,'camera.calibrate',known_length_m=.001,observed_pixels=.001/(h.method['field_width_m']/rt.W));call(h,'stage.move',x_m=.04,y_m=.02,z_m=.025);finish(h);return h
|
| 15 |
+
|
| 16 |
+
def put_drop(h,volume=2e-10):
|
| 17 |
+
call(h,'dispenser.move',position_m=.020);finish(h);call(h,'liquid.transfer',volume_m3=volume);finish(h);call(h,'dispenser.move',position_m=.0);finish(h)
|
| 18 |
+
|
| 19 |
+
def static_example():
|
| 20 |
+
h=setup();put_drop(h);call(h,'acquisition.start');result=finish(h);return h,result
|
| 21 |
+
|
| 22 |
+
def dynamic_example():
|
| 23 |
+
h=setup('theta_dynamic');put_drop(h,4e-11);m=copy.deepcopy(rt.METHOD_EXAMPLE);m.update(mode='dynamic',frame_rate_hz=5.,flow_m3_s=3e-11);call(h,'method.configure',**m);call(h,'dispenser.move',position_m=.0240);finish(h);call(h,'liquid.transfer',volume_m3=1.4e-10);advance=finish(h);call(h,'liquid.transfer',volume_m3=-1.7e-10);recede=finish(h);angles=call(h,'analysis.hysteresis',advancing_rad=[x['mean_rad'] for x in advance['rows']],receding_rad=[x['mean_rad'] for x in recede['rows']]);return h,advance,recede,angles
|
| 24 |
+
if __name__=='__main__':
|
| 25 |
+
h,r=static_example();print('static angle deg',math.degrees(r['rows'][-1]['mean_rad']),'imagechars',len(r['image_png_base64']));h,a,b,c=dynamic_example();print('dynamic',len(a['rows']),len(b['rows']),c,'ledger',call(h,'ledger.read'))
|
outputs/expansion_batch03/t4_measure/biorad_miniprotean/migration_chart_digitized.json
ADDED
|
@@ -0,0 +1,741 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source": "Bio-Rad bulletin 1658100 (Mini-PROTEAN Precast Gels Instruction Manual and Application Guide), p.9 migration charts",
|
| 3 |
+
"pdf_sha256": "4790097f20a2e733c6e5e07b29603e2751c629b78f2e9b9f783d16c58ef24cba",
|
| 4 |
+
"page": 15,
|
| 5 |
+
"method_zh": "从PDF矢量图读取泳道外框与条带标记线的精确坐标(0.1 pt),按文字包围盒配对kD标签;泳道外框=整块7.2 cm胶,底边=参考线/染料前沿,分离胶顶在底边以上6.2 cm。",
|
| 6 |
+
"evidence": "digitized_manufacturer_chart",
|
| 7 |
+
"gel_height_cm": 7.2,
|
| 8 |
+
"resolving_height_cm": 6.2,
|
| 9 |
+
"sets": {
|
| 10 |
+
"precision_plus_unstained": [
|
| 11 |
+
{
|
| 12 |
+
"gel": "7.5%",
|
| 13 |
+
"lane_top_pt": 434.97656200000006,
|
| 14 |
+
"lane_bottom_pt": 655.0703120000001,
|
| 15 |
+
"well_bottom_pt": 452.19140600000003,
|
| 16 |
+
"resolving_top_pt": 465.55,
|
| 17 |
+
"pt_per_cm": 30.569,
|
| 18 |
+
"bands": [
|
| 19 |
+
{
|
| 20 |
+
"mw_kda": 250.0,
|
| 21 |
+
"y_pt": 499.6,
|
| 22 |
+
"distance_from_resolving_top_cm": 1.114,
|
| 23 |
+
"rf": 0.1797
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"mw_kda": 150.0,
|
| 27 |
+
"y_pt": 513.82,
|
| 28 |
+
"distance_from_resolving_top_cm": 1.5791,
|
| 29 |
+
"rf": 0.2547
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"mw_kda": 100.0,
|
| 33 |
+
"y_pt": 538.55,
|
| 34 |
+
"distance_from_resolving_top_cm": 2.3881,
|
| 35 |
+
"rf": 0.3852
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"mw_kda": 75.0,
|
| 39 |
+
"y_pt": 576.96,
|
| 40 |
+
"distance_from_resolving_top_cm": 3.6449,
|
| 41 |
+
"rf": 0.5879
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"mw_kda": 50.0,
|
| 45 |
+
"y_pt": 610.85,
|
| 46 |
+
"distance_from_resolving_top_cm": 4.7535,
|
| 47 |
+
"rf": 0.7667
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"mw_kda": 37.0,
|
| 51 |
+
"y_pt": 633.98,
|
| 52 |
+
"distance_from_resolving_top_cm": 5.51,
|
| 53 |
+
"rf": 0.8887
|
| 54 |
+
}
|
| 55 |
+
]
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"gel": "10%",
|
| 59 |
+
"lane_top_pt": 434.97656200000006,
|
| 60 |
+
"lane_bottom_pt": 655.0703120000001,
|
| 61 |
+
"well_bottom_pt": 452.19140600000003,
|
| 62 |
+
"resolving_top_pt": 465.55,
|
| 63 |
+
"pt_per_cm": 30.569,
|
| 64 |
+
"bands": [
|
| 65 |
+
{
|
| 66 |
+
"mw_kda": 250.0,
|
| 67 |
+
"y_pt": 498.5,
|
| 68 |
+
"distance_from_resolving_top_cm": 1.0779,
|
| 69 |
+
"rf": 0.1739
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"mw_kda": 150.0,
|
| 73 |
+
"y_pt": 508.05,
|
| 74 |
+
"distance_from_resolving_top_cm": 1.3905,
|
| 75 |
+
"rf": 0.2243
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"mw_kda": 100.0,
|
| 79 |
+
"y_pt": 526.55,
|
| 80 |
+
"distance_from_resolving_top_cm": 1.9957,
|
| 81 |
+
"rf": 0.3219
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"mw_kda": 75.0,
|
| 85 |
+
"y_pt": 547.27,
|
| 86 |
+
"distance_from_resolving_top_cm": 2.6735,
|
| 87 |
+
"rf": 0.4312
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"mw_kda": 50.0,
|
| 91 |
+
"y_pt": 576.24,
|
| 92 |
+
"distance_from_resolving_top_cm": 3.6211,
|
| 93 |
+
"rf": 0.5841
|
| 94 |
+
},
|
| 95 |
+
{
|
| 96 |
+
"mw_kda": 37.0,
|
| 97 |
+
"y_pt": 603.07,
|
| 98 |
+
"distance_from_resolving_top_cm": 4.4989,
|
| 99 |
+
"rf": 0.7256
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"mw_kda": 25.0,
|
| 103 |
+
"y_pt": 629.79,
|
| 104 |
+
"distance_from_resolving_top_cm": 5.3731,
|
| 105 |
+
"rf": 0.8666
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"mw_kda": 20.0,
|
| 109 |
+
"y_pt": 639.05,
|
| 110 |
+
"distance_from_resolving_top_cm": 5.6759,
|
| 111 |
+
"rf": 0.9155
|
| 112 |
+
}
|
| 113 |
+
]
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"gel": "12%",
|
| 117 |
+
"lane_top_pt": 434.97656200000006,
|
| 118 |
+
"lane_bottom_pt": 655.0703120000001,
|
| 119 |
+
"well_bottom_pt": 452.19140600000003,
|
| 120 |
+
"resolving_top_pt": 465.55,
|
| 121 |
+
"pt_per_cm": 30.569,
|
| 122 |
+
"bands": [
|
| 123 |
+
{
|
| 124 |
+
"mw_kda": 250.0,
|
| 125 |
+
"y_pt": 497.41,
|
| 126 |
+
"distance_from_resolving_top_cm": 1.0425,
|
| 127 |
+
"rf": 0.1682
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"mw_kda": 150.0,
|
| 131 |
+
"y_pt": 505.2,
|
| 132 |
+
"distance_from_resolving_top_cm": 1.2972,
|
| 133 |
+
"rf": 0.2092
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"mw_kda": 100.0,
|
| 137 |
+
"y_pt": 519.36,
|
| 138 |
+
"distance_from_resolving_top_cm": 1.7606,
|
| 139 |
+
"rf": 0.284
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"mw_kda": 75.0,
|
| 143 |
+
"y_pt": 538.33,
|
| 144 |
+
"distance_from_resolving_top_cm": 2.3811,
|
| 145 |
+
"rf": 0.384
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"mw_kda": 50.0,
|
| 149 |
+
"y_pt": 558.43,
|
| 150 |
+
"distance_from_resolving_top_cm": 3.0387,
|
| 151 |
+
"rf": 0.4901
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"mw_kda": 37.0,
|
| 155 |
+
"y_pt": 573.72,
|
| 156 |
+
"distance_from_resolving_top_cm": 3.5387,
|
| 157 |
+
"rf": 0.5708
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"mw_kda": 25.0,
|
| 161 |
+
"y_pt": 600.25,
|
| 162 |
+
"distance_from_resolving_top_cm": 4.4065,
|
| 163 |
+
"rf": 0.7107
|
| 164 |
+
},
|
| 165 |
+
{
|
| 166 |
+
"mw_kda": 20.0,
|
| 167 |
+
"y_pt": 609.43,
|
| 168 |
+
"distance_from_resolving_top_cm": 4.7068,
|
| 169 |
+
"rf": 0.7592
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"mw_kda": 15.0,
|
| 173 |
+
"y_pt": 639.07,
|
| 174 |
+
"distance_from_resolving_top_cm": 5.6766,
|
| 175 |
+
"rf": 0.9156
|
| 176 |
+
}
|
| 177 |
+
]
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"gel": "4–15%",
|
| 181 |
+
"lane_top_pt": 434.97656200000006,
|
| 182 |
+
"lane_bottom_pt": 655.0703120000001,
|
| 183 |
+
"well_bottom_pt": 452.19140600000003,
|
| 184 |
+
"resolving_top_pt": 465.55,
|
| 185 |
+
"pt_per_cm": 30.569,
|
| 186 |
+
"bands": [
|
| 187 |
+
{
|
| 188 |
+
"mw_kda": 250.0,
|
| 189 |
+
"y_pt": 500.88,
|
| 190 |
+
"distance_from_resolving_top_cm": 1.156,
|
| 191 |
+
"rf": 0.1865
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
"mw_kda": 150.0,
|
| 195 |
+
"y_pt": 521.25,
|
| 196 |
+
"distance_from_resolving_top_cm": 1.8222,
|
| 197 |
+
"rf": 0.2939
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"mw_kda": 100.0,
|
| 201 |
+
"y_pt": 538.58,
|
| 202 |
+
"distance_from_resolving_top_cm": 2.3893,
|
| 203 |
+
"rf": 0.3854
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
"mw_kda": 75.0,
|
| 207 |
+
"y_pt": 551.71,
|
| 208 |
+
"distance_from_resolving_top_cm": 2.8186,
|
| 209 |
+
"rf": 0.4546
|
| 210 |
+
},
|
| 211 |
+
{
|
| 212 |
+
"mw_kda": 50.0,
|
| 213 |
+
"y_pt": 573.04,
|
| 214 |
+
"distance_from_resolving_top_cm": 3.5164,
|
| 215 |
+
"rf": 0.5672
|
| 216 |
+
},
|
| 217 |
+
{
|
| 218 |
+
"mw_kda": 37.0,
|
| 219 |
+
"y_pt": 591.16,
|
| 220 |
+
"distance_from_resolving_top_cm": 4.1094,
|
| 221 |
+
"rf": 0.6628
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
"mw_kda": 25.0,
|
| 225 |
+
"y_pt": 614.62,
|
| 226 |
+
"distance_from_resolving_top_cm": 4.8766,
|
| 227 |
+
"rf": 0.7866
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"mw_kda": 20.0,
|
| 231 |
+
"y_pt": 624.5,
|
| 232 |
+
"distance_from_resolving_top_cm": 5.1998,
|
| 233 |
+
"rf": 0.8387
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"mw_kda": 15.0,
|
| 237 |
+
"y_pt": 641.37,
|
| 238 |
+
"distance_from_resolving_top_cm": 5.7517,
|
| 239 |
+
"rf": 0.9277
|
| 240 |
+
},
|
| 241 |
+
{
|
| 242 |
+
"mw_kda": 10.0,
|
| 243 |
+
"y_pt": 651.23,
|
| 244 |
+
"distance_from_resolving_top_cm": 6.0745,
|
| 245 |
+
"rf": 0.9798
|
| 246 |
+
}
|
| 247 |
+
]
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"gel": "4–20%",
|
| 251 |
+
"lane_top_pt": 434.97656200000006,
|
| 252 |
+
"lane_bottom_pt": 655.0703120000001,
|
| 253 |
+
"well_bottom_pt": 452.19140600000003,
|
| 254 |
+
"resolving_top_pt": 465.55,
|
| 255 |
+
"pt_per_cm": 30.569,
|
| 256 |
+
"bands": [
|
| 257 |
+
{
|
| 258 |
+
"mw_kda": 250.0,
|
| 259 |
+
"y_pt": 493.34,
|
| 260 |
+
"distance_from_resolving_top_cm": 0.9093,
|
| 261 |
+
"rf": 0.1467
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"mw_kda": 150.0,
|
| 265 |
+
"y_pt": 513.31,
|
| 266 |
+
"distance_from_resolving_top_cm": 1.5625,
|
| 267 |
+
"rf": 0.252
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"mw_kda": 100.0,
|
| 271 |
+
"y_pt": 530.65,
|
| 272 |
+
"distance_from_resolving_top_cm": 2.1297,
|
| 273 |
+
"rf": 0.3435
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"mw_kda": 75.0,
|
| 277 |
+
"y_pt": 545.27,
|
| 278 |
+
"distance_from_resolving_top_cm": 2.6082,
|
| 279 |
+
"rf": 0.4207
|
| 280 |
+
},
|
| 281 |
+
{
|
| 282 |
+
"mw_kda": 50.0,
|
| 283 |
+
"y_pt": 564.88,
|
| 284 |
+
"distance_from_resolving_top_cm": 3.2497,
|
| 285 |
+
"rf": 0.5241
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"mw_kda": 37.0,
|
| 289 |
+
"y_pt": 579.59,
|
| 290 |
+
"distance_from_resolving_top_cm": 3.7309,
|
| 291 |
+
"rf": 0.6018
|
| 292 |
+
},
|
| 293 |
+
{
|
| 294 |
+
"mw_kda": 25.0,
|
| 295 |
+
"y_pt": 602.61,
|
| 296 |
+
"distance_from_resolving_top_cm": 4.4837,
|
| 297 |
+
"rf": 0.7232
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"mw_kda": 20.0,
|
| 301 |
+
"y_pt": 609.29,
|
| 302 |
+
"distance_from_resolving_top_cm": 4.7023,
|
| 303 |
+
"rf": 0.7584
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
"mw_kda": 15.0,
|
| 307 |
+
"y_pt": 627.82,
|
| 308 |
+
"distance_from_resolving_top_cm": 5.3086,
|
| 309 |
+
"rf": 0.8562
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"mw_kda": 10.0,
|
| 313 |
+
"y_pt": 640.61,
|
| 314 |
+
"distance_from_resolving_top_cm": 5.7269,
|
| 315 |
+
"rf": 0.9237
|
| 316 |
+
}
|
| 317 |
+
]
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"gel": "Any kD",
|
| 321 |
+
"lane_top_pt": 434.97656200000006,
|
| 322 |
+
"lane_bottom_pt": 655.0703120000001,
|
| 323 |
+
"well_bottom_pt": 452.19140600000003,
|
| 324 |
+
"resolving_top_pt": 465.55,
|
| 325 |
+
"pt_per_cm": 30.569,
|
| 326 |
+
"bands": [
|
| 327 |
+
{
|
| 328 |
+
"mw_kda": 250.0,
|
| 329 |
+
"y_pt": 495.11,
|
| 330 |
+
"distance_from_resolving_top_cm": 0.967,
|
| 331 |
+
"rf": 0.156
|
| 332 |
+
},
|
| 333 |
+
{
|
| 334 |
+
"mw_kda": 150.0,
|
| 335 |
+
"y_pt": 501.17,
|
| 336 |
+
"distance_from_resolving_top_cm": 1.1655,
|
| 337 |
+
"rf": 0.188
|
| 338 |
+
},
|
| 339 |
+
{
|
| 340 |
+
"mw_kda": 100.0,
|
| 341 |
+
"y_pt": 511.64,
|
| 342 |
+
"distance_from_resolving_top_cm": 1.5079,
|
| 343 |
+
"rf": 0.2432
|
| 344 |
+
},
|
| 345 |
+
{
|
| 346 |
+
"mw_kda": 75.0,
|
| 347 |
+
"y_pt": 523.62,
|
| 348 |
+
"distance_from_resolving_top_cm": 1.8997,
|
| 349 |
+
"rf": 0.3064
|
| 350 |
+
},
|
| 351 |
+
{
|
| 352 |
+
"mw_kda": 50.0,
|
| 353 |
+
"y_pt": 542.64,
|
| 354 |
+
"distance_from_resolving_top_cm": 2.5221,
|
| 355 |
+
"rf": 0.4068
|
| 356 |
+
},
|
| 357 |
+
{
|
| 358 |
+
"mw_kda": 37.0,
|
| 359 |
+
"y_pt": 558.18,
|
| 360 |
+
"distance_from_resolving_top_cm": 3.0304,
|
| 361 |
+
"rf": 0.4888
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"mw_kda": 25.0,
|
| 365 |
+
"y_pt": 584.51,
|
| 366 |
+
"distance_from_resolving_top_cm": 3.8917,
|
| 367 |
+
"rf": 0.6277
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"mw_kda": 20.0,
|
| 371 |
+
"y_pt": 597.35,
|
| 372 |
+
"distance_from_resolving_top_cm": 4.3118,
|
| 373 |
+
"rf": 0.6955
|
| 374 |
+
},
|
| 375 |
+
{
|
| 376 |
+
"mw_kda": 15.0,
|
| 377 |
+
"y_pt": 618.43,
|
| 378 |
+
"distance_from_resolving_top_cm": 5.0015,
|
| 379 |
+
"rf": 0.8067
|
| 380 |
+
},
|
| 381 |
+
{
|
| 382 |
+
"mw_kda": 10.0,
|
| 383 |
+
"y_pt": 639.43,
|
| 384 |
+
"distance_from_resolving_top_cm": 5.6885,
|
| 385 |
+
"rf": 0.9175
|
| 386 |
+
}
|
| 387 |
+
]
|
| 388 |
+
}
|
| 389 |
+
],
|
| 390 |
+
"broad_range_unstained": [
|
| 391 |
+
{
|
| 392 |
+
"gel": "7.5%",
|
| 393 |
+
"lane_top_pt": 434.195312,
|
| 394 |
+
"lane_bottom_pt": 654.28125,
|
| 395 |
+
"well_bottom_pt": 451.41015600000003,
|
| 396 |
+
"resolving_top_pt": 464.76,
|
| 397 |
+
"pt_per_cm": 30.567,
|
| 398 |
+
"bands": [
|
| 399 |
+
{
|
| 400 |
+
"mw_kda": 200.0,
|
| 401 |
+
"y_pt": 502.22,
|
| 402 |
+
"distance_from_resolving_top_cm": 1.2254,
|
| 403 |
+
"rf": 0.1976
|
| 404 |
+
},
|
| 405 |
+
{
|
| 406 |
+
"mw_kda": 116.0,
|
| 407 |
+
"y_pt": 535.77,
|
| 408 |
+
"distance_from_resolving_top_cm": 2.3228,
|
| 409 |
+
"rf": 0.3746
|
| 410 |
+
},
|
| 411 |
+
{
|
| 412 |
+
"mw_kda": 97.4,
|
| 413 |
+
"y_pt": 548.24,
|
| 414 |
+
"distance_from_resolving_top_cm": 2.7309,
|
| 415 |
+
"rf": 0.4405
|
| 416 |
+
},
|
| 417 |
+
{
|
| 418 |
+
"mw_kda": 66.0,
|
| 419 |
+
"y_pt": 586.02,
|
| 420 |
+
"distance_from_resolving_top_cm": 3.9667,
|
| 421 |
+
"rf": 0.6398
|
| 422 |
+
},
|
| 423 |
+
{
|
| 424 |
+
"mw_kda": 45.0,
|
| 425 |
+
"y_pt": 625.71,
|
| 426 |
+
"distance_from_resolving_top_cm": 5.2652,
|
| 427 |
+
"rf": 0.8492
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
"mw_kda": 31.0,
|
| 431 |
+
"y_pt": 649.91,
|
| 432 |
+
"distance_from_resolving_top_cm": 6.0569,
|
| 433 |
+
"rf": 0.9769
|
| 434 |
+
}
|
| 435 |
+
]
|
| 436 |
+
},
|
| 437 |
+
{
|
| 438 |
+
"gel": "10%",
|
| 439 |
+
"lane_top_pt": 434.195312,
|
| 440 |
+
"lane_bottom_pt": 654.28125,
|
| 441 |
+
"well_bottom_pt": 451.41015600000003,
|
| 442 |
+
"resolving_top_pt": 464.76,
|
| 443 |
+
"pt_per_cm": 30.567,
|
| 444 |
+
"bands": [
|
| 445 |
+
{
|
| 446 |
+
"mw_kda": 200.0,
|
| 447 |
+
"y_pt": 499.74,
|
| 448 |
+
"distance_from_resolving_top_cm": 1.1443,
|
| 449 |
+
"rf": 0.1846
|
| 450 |
+
},
|
| 451 |
+
{
|
| 452 |
+
"mw_kda": 116.0,
|
| 453 |
+
"y_pt": 522.32,
|
| 454 |
+
"distance_from_resolving_top_cm": 1.8831,
|
| 455 |
+
"rf": 0.3037
|
| 456 |
+
},
|
| 457 |
+
{
|
| 458 |
+
"mw_kda": 97.4,
|
| 459 |
+
"y_pt": 532.07,
|
| 460 |
+
"distance_from_resolving_top_cm": 2.2018,
|
| 461 |
+
"rf": 0.3551
|
| 462 |
+
},
|
| 463 |
+
{
|
| 464 |
+
"mw_kda": 66.0,
|
| 465 |
+
"y_pt": 560.91,
|
| 466 |
+
"distance_from_resolving_top_cm": 3.1453,
|
| 467 |
+
"rf": 0.5073
|
| 468 |
+
},
|
| 469 |
+
{
|
| 470 |
+
"mw_kda": 45.0,
|
| 471 |
+
"y_pt": 593.62,
|
| 472 |
+
"distance_from_resolving_top_cm": 4.2154,
|
| 473 |
+
"rf": 0.6799
|
| 474 |
+
},
|
| 475 |
+
{
|
| 476 |
+
"mw_kda": 31.0,
|
| 477 |
+
"y_pt": 626.59,
|
| 478 |
+
"distance_from_resolving_top_cm": 5.2941,
|
| 479 |
+
"rf": 0.8539
|
| 480 |
+
},
|
| 481 |
+
{
|
| 482 |
+
"mw_kda": 21.5,
|
| 483 |
+
"y_pt": 645.17,
|
| 484 |
+
"distance_from_resolving_top_cm": 5.9019,
|
| 485 |
+
"rf": 0.9519
|
| 486 |
+
}
|
| 487 |
+
]
|
| 488 |
+
},
|
| 489 |
+
{
|
| 490 |
+
"gel": "12%",
|
| 491 |
+
"lane_top_pt": 434.195312,
|
| 492 |
+
"lane_bottom_pt": 654.28125,
|
| 493 |
+
"well_bottom_pt": 451.41015600000003,
|
| 494 |
+
"resolving_top_pt": 464.76,
|
| 495 |
+
"pt_per_cm": 30.567,
|
| 496 |
+
"bands": [
|
| 497 |
+
{
|
| 498 |
+
"mw_kda": 200.0,
|
| 499 |
+
"y_pt": 496.87,
|
| 500 |
+
"distance_from_resolving_top_cm": 1.0504,
|
| 501 |
+
"rf": 0.1694
|
| 502 |
+
},
|
| 503 |
+
{
|
| 504 |
+
"mw_kda": 116.0,
|
| 505 |
+
"y_pt": 519.43,
|
| 506 |
+
"distance_from_resolving_top_cm": 1.7883,
|
| 507 |
+
"rf": 0.2884
|
| 508 |
+
},
|
| 509 |
+
{
|
| 510 |
+
"mw_kda": 97.4,
|
| 511 |
+
"y_pt": 525.27,
|
| 512 |
+
"distance_from_resolving_top_cm": 1.9793,
|
| 513 |
+
"rf": 0.3192
|
| 514 |
+
},
|
| 515 |
+
{
|
| 516 |
+
"mw_kda": 66.0,
|
| 517 |
+
"y_pt": 545.64,
|
| 518 |
+
"distance_from_resolving_top_cm": 2.646,
|
| 519 |
+
"rf": 0.4268
|
| 520 |
+
},
|
| 521 |
+
{
|
| 522 |
+
"mw_kda": 45.0,
|
| 523 |
+
"y_pt": 570.21,
|
| 524 |
+
"distance_from_resolving_top_cm": 3.4497,
|
| 525 |
+
"rf": 0.5564
|
| 526 |
+
},
|
| 527 |
+
{
|
| 528 |
+
"mw_kda": 31.0,
|
| 529 |
+
"y_pt": 593.17,
|
| 530 |
+
"distance_from_resolving_top_cm": 4.2007,
|
| 531 |
+
"rf": 0.6775
|
| 532 |
+
},
|
| 533 |
+
{
|
| 534 |
+
"mw_kda": 21.5,
|
| 535 |
+
"y_pt": 631.76,
|
| 536 |
+
"distance_from_resolving_top_cm": 5.4633,
|
| 537 |
+
"rf": 0.8812
|
| 538 |
+
},
|
| 539 |
+
{
|
| 540 |
+
"mw_kda": 14.4,
|
| 541 |
+
"y_pt": 646.82,
|
| 542 |
+
"distance_from_resolving_top_cm": 5.956,
|
| 543 |
+
"rf": 0.9607
|
| 544 |
+
}
|
| 545 |
+
]
|
| 546 |
+
},
|
| 547 |
+
{
|
| 548 |
+
"gel": "4–15%",
|
| 549 |
+
"lane_top_pt": 434.195312,
|
| 550 |
+
"lane_bottom_pt": 654.28125,
|
| 551 |
+
"well_bottom_pt": 451.41015600000003,
|
| 552 |
+
"resolving_top_pt": 464.76,
|
| 553 |
+
"pt_per_cm": 30.567,
|
| 554 |
+
"bands": [
|
| 555 |
+
{
|
| 556 |
+
"mw_kda": 200.0,
|
| 557 |
+
"y_pt": 498.73,
|
| 558 |
+
"distance_from_resolving_top_cm": 1.1114,
|
| 559 |
+
"rf": 0.1793
|
| 560 |
+
},
|
| 561 |
+
{
|
| 562 |
+
"mw_kda": 116.0,
|
| 563 |
+
"y_pt": 536.54,
|
| 564 |
+
"distance_from_resolving_top_cm": 2.348,
|
| 565 |
+
"rf": 0.3787
|
| 566 |
+
},
|
| 567 |
+
{
|
| 568 |
+
"mw_kda": 97.4,
|
| 569 |
+
"y_pt": 548.78,
|
| 570 |
+
"distance_from_resolving_top_cm": 2.7486,
|
| 571 |
+
"rf": 0.4433
|
| 572 |
+
},
|
| 573 |
+
{
|
| 574 |
+
"mw_kda": 66.0,
|
| 575 |
+
"y_pt": 568.4,
|
| 576 |
+
"distance_from_resolving_top_cm": 3.3905,
|
| 577 |
+
"rf": 0.5469
|
| 578 |
+
},
|
| 579 |
+
{
|
| 580 |
+
"mw_kda": 45.0,
|
| 581 |
+
"y_pt": 585.53,
|
| 582 |
+
"distance_from_resolving_top_cm": 3.9508,
|
| 583 |
+
"rf": 0.6372
|
| 584 |
+
},
|
| 585 |
+
{
|
| 586 |
+
"mw_kda": 31.0,
|
| 587 |
+
"y_pt": 608.76,
|
| 588 |
+
"distance_from_resolving_top_cm": 4.7109,
|
| 589 |
+
"rf": 0.7598
|
| 590 |
+
},
|
| 591 |
+
{
|
| 592 |
+
"mw_kda": 21.5,
|
| 593 |
+
"y_pt": 631.56,
|
| 594 |
+
"distance_from_resolving_top_cm": 5.4568,
|
| 595 |
+
"rf": 0.8801
|
| 596 |
+
},
|
| 597 |
+
{
|
| 598 |
+
"mw_kda": 14.4,
|
| 599 |
+
"y_pt": 643.41,
|
| 600 |
+
"distance_from_resolving_top_cm": 5.8445,
|
| 601 |
+
"rf": 0.9427
|
| 602 |
+
},
|
| 603 |
+
{
|
| 604 |
+
"mw_kda": 6.5,
|
| 605 |
+
"y_pt": 650.79,
|
| 606 |
+
"distance_from_resolving_top_cm": 6.0856,
|
| 607 |
+
"rf": 0.9816
|
| 608 |
+
}
|
| 609 |
+
]
|
| 610 |
+
},
|
| 611 |
+
{
|
| 612 |
+
"gel": "4–20%",
|
| 613 |
+
"lane_top_pt": 434.195312,
|
| 614 |
+
"lane_bottom_pt": 654.28125,
|
| 615 |
+
"well_bottom_pt": 451.41015600000003,
|
| 616 |
+
"resolving_top_pt": 464.76,
|
| 617 |
+
"pt_per_cm": 30.567,
|
| 618 |
+
"bands": [
|
| 619 |
+
{
|
| 620 |
+
"mw_kda": 200.0,
|
| 621 |
+
"y_pt": 496.78,
|
| 622 |
+
"distance_from_resolving_top_cm": 1.0475,
|
| 623 |
+
"rf": 0.1689
|
| 624 |
+
},
|
| 625 |
+
{
|
| 626 |
+
"mw_kda": 116.0,
|
| 627 |
+
"y_pt": 526.03,
|
| 628 |
+
"distance_from_resolving_top_cm": 2.0044,
|
| 629 |
+
"rf": 0.3233
|
| 630 |
+
},
|
| 631 |
+
{
|
| 632 |
+
"mw_kda": 97.4,
|
| 633 |
+
"y_pt": 534.27,
|
| 634 |
+
"distance_from_resolving_top_cm": 2.2737,
|
| 635 |
+
"rf": 0.3667
|
| 636 |
+
},
|
| 637 |
+
{
|
| 638 |
+
"mw_kda": 66.0,
|
| 639 |
+
"y_pt": 553.84,
|
| 640 |
+
"distance_from_resolving_top_cm": 2.9142,
|
| 641 |
+
"rf": 0.47
|
| 642 |
+
},
|
| 643 |
+
{
|
| 644 |
+
"mw_kda": 45.0,
|
| 645 |
+
"y_pt": 572.41,
|
| 646 |
+
"distance_from_resolving_top_cm": 3.5215,
|
| 647 |
+
"rf": 0.568
|
| 648 |
+
},
|
| 649 |
+
{
|
| 650 |
+
"mw_kda": 31.0,
|
| 651 |
+
"y_pt": 595.93,
|
| 652 |
+
"distance_from_resolving_top_cm": 4.2911,
|
| 653 |
+
"rf": 0.6921
|
| 654 |
+
},
|
| 655 |
+
{
|
| 656 |
+
"mw_kda": 21.5,
|
| 657 |
+
"y_pt": 617.02,
|
| 658 |
+
"distance_from_resolving_top_cm": 4.981,
|
| 659 |
+
"rf": 0.8034
|
| 660 |
+
},
|
| 661 |
+
{
|
| 662 |
+
"mw_kda": 14.4,
|
| 663 |
+
"y_pt": 630.32,
|
| 664 |
+
"distance_from_resolving_top_cm": 5.416,
|
| 665 |
+
"rf": 0.8735
|
| 666 |
+
},
|
| 667 |
+
{
|
| 668 |
+
"mw_kda": 6.5,
|
| 669 |
+
"y_pt": 639.55,
|
| 670 |
+
"distance_from_resolving_top_cm": 5.7182,
|
| 671 |
+
"rf": 0.9223
|
| 672 |
+
}
|
| 673 |
+
]
|
| 674 |
+
},
|
| 675 |
+
{
|
| 676 |
+
"gel": "Any kD",
|
| 677 |
+
"lane_top_pt": 434.195312,
|
| 678 |
+
"lane_bottom_pt": 654.28125,
|
| 679 |
+
"well_bottom_pt": 451.41015600000003,
|
| 680 |
+
"resolving_top_pt": 464.76,
|
| 681 |
+
"pt_per_cm": 30.567,
|
| 682 |
+
"bands": [
|
| 683 |
+
{
|
| 684 |
+
"mw_kda": 200.0,
|
| 685 |
+
"y_pt": 492.0,
|
| 686 |
+
"distance_from_resolving_top_cm": 0.8911,
|
| 687 |
+
"rf": 0.1437
|
| 688 |
+
},
|
| 689 |
+
{
|
| 690 |
+
"mw_kda": 116.0,
|
| 691 |
+
"y_pt": 505.11,
|
| 692 |
+
"distance_from_resolving_top_cm": 1.32,
|
| 693 |
+
"rf": 0.2129
|
| 694 |
+
},
|
| 695 |
+
{
|
| 696 |
+
"mw_kda": 97.4,
|
| 697 |
+
"y_pt": 509.86,
|
| 698 |
+
"distance_from_resolving_top_cm": 1.4752,
|
| 699 |
+
"rf": 0.2379
|
| 700 |
+
},
|
| 701 |
+
{
|
| 702 |
+
"mw_kda": 66.0,
|
| 703 |
+
"y_pt": 525.87,
|
| 704 |
+
"distance_from_resolving_top_cm": 1.9991,
|
| 705 |
+
"rf": 0.3224
|
| 706 |
+
},
|
| 707 |
+
{
|
| 708 |
+
"mw_kda": 45.0,
|
| 709 |
+
"y_pt": 548.08,
|
| 710 |
+
"distance_from_resolving_top_cm": 2.7257,
|
| 711 |
+
"rf": 0.4396
|
| 712 |
+
},
|
| 713 |
+
{
|
| 714 |
+
"mw_kda": 31.0,
|
| 715 |
+
"y_pt": 576.32,
|
| 716 |
+
"distance_from_resolving_top_cm": 3.6495,
|
| 717 |
+
"rf": 0.5886
|
| 718 |
+
},
|
| 719 |
+
{
|
| 720 |
+
"mw_kda": 21.5,
|
| 721 |
+
"y_pt": 606.21,
|
| 722 |
+
"distance_from_resolving_top_cm": 4.6275,
|
| 723 |
+
"rf": 0.7464
|
| 724 |
+
},
|
| 725 |
+
{
|
| 726 |
+
"mw_kda": 14.4,
|
| 727 |
+
"y_pt": 625.15,
|
| 728 |
+
"distance_from_resolving_top_cm": 5.2469,
|
| 729 |
+
"rf": 0.8463
|
| 730 |
+
},
|
| 731 |
+
{
|
| 732 |
+
"mw_kda": 6.5,
|
| 733 |
+
"y_pt": 639.88,
|
| 734 |
+
"distance_from_resolving_top_cm": 5.729,
|
| 735 |
+
"rf": 0.924
|
| 736 |
+
}
|
| 737 |
+
]
|
| 738 |
+
}
|
| 739 |
+
]
|
| 740 |
+
}
|
| 741 |
+
}
|
outputs/expansion_batch04/t1_thermal/ametek_oxtran/independent_permeation_source_validation.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"catalog_id": "CHEM-147",
|
| 3 |
+
"checked_at": "2026-09-24T12:39:42.801221+00:00",
|
| 4 |
+
"status": "passed",
|
| 5 |
+
"method": "independent re-read of the cached polyVERSE CSV by line number; unit conversions recomputed with independent constants; RDKit SMILES parse; license/hashes",
|
| 6 |
+
"library": "assets/expansion_batch04/t1_thermal/ametek_oxtran/oxygen_permeation_library.json",
|
| 7 |
+
"library_sha256": "4efb2f2c4fb60cd637b6f1e37327c324a70a511199f015331bcd3565af8beb72",
|
| 8 |
+
"csv_sha256": "546c6120713c737a1b0b93a7558ef2e745fb0a44ca5498473532b7077955e7f3",
|
| 9 |
+
"templates": 128,
|
| 10 |
+
"with_diffusivity": 92,
|
| 11 |
+
"passed_count": 11,
|
| 12 |
+
"checks": [
|
| 13 |
+
{
|
| 14 |
+
"id": "csv_header",
|
| 15 |
+
"status": "passed",
|
| 16 |
+
"detail": [
|
| 17 |
+
"property",
|
| 18 |
+
"smiles_string",
|
| 19 |
+
"p_csmiles",
|
| 20 |
+
"value",
|
| 21 |
+
"unscaled_value",
|
| 22 |
+
"Activity",
|
| 23 |
+
"Temp",
|
| 24 |
+
"Solvent_SMILES",
|
| 25 |
+
"source"
|
| 26 |
+
]
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"id": "at_least_50_templates",
|
| 30 |
+
"status": "passed",
|
| 31 |
+
"detail": 128
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"id": "at_least_50_with_measured_diffusivity",
|
| 35 |
+
"status": "passed",
|
| 36 |
+
"detail": 92
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"id": "unique_ids",
|
| 40 |
+
"status": "passed",
|
| 41 |
+
"detail": null
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"id": "unique_repeat_units",
|
| 45 |
+
"status": "passed",
|
| 46 |
+
"detail": null
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"id": "license_copy_identical",
|
| 50 |
+
"status": "passed",
|
| 51 |
+
"detail": null
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"id": "no_synthetic_records",
|
| 55 |
+
"status": "passed",
|
| 56 |
+
"detail": null
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"id": "barrer_constant",
|
| 60 |
+
"status": "passed",
|
| 61 |
+
"detail": 3.3463981560817787e-16
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"id": "every_template_matches_source_row_and_conversion",
|
| 65 |
+
"status": "passed",
|
| 66 |
+
"detail": []
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"id": "csv_sha_recorded",
|
| 70 |
+
"status": "passed",
|
| 71 |
+
"detail": "546c6120713c737a1b0b93a7558ef2e745fb0a44ca5498473532b7077955e7f3"
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"id": "rdkit_available_for_smiles_parse",
|
| 75 |
+
"status": "passed",
|
| 76 |
+
"detail": null
|
| 77 |
+
}
|
| 78 |
+
]
|
| 79 |
+
}
|
outputs/expansion_batch04/t1_thermal/ametek_oxtran/interface_definition.py
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM-147 AMETEK MOCON OX-TRAN 2/22 L shared interface geometry (SI, +Z up, +Y rear, origin = bench footprint centre).
|
| 2 |
+
|
| 3 |
+
Single source for build_geometry.py, build_blender.py, verify_geometry.py and the Matterix scripts. The runtime
|
| 4 |
+
(scripts/asset_runtime/ametek_oxtran.py) keeps its own copies of the physical constants; the tests compare them.
|
| 5 |
+
|
| 6 |
+
Manufacturer facts: body 12 in W x 23 in D x 15.5 in H (30.4 x 58.0 x 39.4 cm), 95 lb (43.1 kg) (2020 brochure p4 under an
|
| 7 |
+
"Interior Dimensions and Volume" heading; the current product page and the same-chassis OX-TRAN 2/28 manual list the same
|
| 8 |
+
numbers as the uncrated physical specification). Front/rear layouts follow the OX-TRAN 2/28 operator's manual line drawings
|
| 9 |
+
(Fig. 2-1 front, 2-2 behind the cover, 2-3 back panel; same chassis and 43.1 kg) and the 2/22 product photographs. The
|
| 10 |
+
drawings put 394 mm at the top of the side shoulders; the colour touchscreen stands above the body (photo/drawing estimate).
|
| 11 |
+
Every local number below is a drawing / photo estimate or an engineering assumption (see geometry_manifest evidence).
|
| 12 |
+
"""
|
| 13 |
+
import math
|
| 14 |
+
|
| 15 |
+
# ---------------------------------------------------------------- body (manufacturer envelope, touchscreen excluded)
|
| 16 |
+
BODY_M = (0.304, 0.580, 0.394) # W x D x H (manufacturer uncrated physical specification)
|
| 17 |
+
FRONT_Y = -BODY_M[1] / 2 # -0.290 front face
|
| 18 |
+
REAR_Y = BODY_M[1] / 2 # +0.290 rear face
|
| 19 |
+
FOOT_H = 0.025 # block feet (front and rear drawings)
|
| 20 |
+
SHOULDER_X = 0.130 # |x| of the inner edge of the raised side shoulders beside the display
|
| 21 |
+
RECESS_Z = 0.360 # top of the display recess between the shoulders (front part)
|
| 22 |
+
RECESS_BACK_Y = -0.175 # rear end of the display recess
|
| 23 |
+
# front vertical bands (front drawing): left control column | centre drawer column | right column
|
| 24 |
+
LEFT_COLUMN_X = (-0.152, -0.085)
|
| 25 |
+
CENTER_COLUMN_X = (-0.085, 0.084)
|
| 26 |
+
BAND_B_Z = (FOOT_H, 0.130) # cell B module band
|
| 27 |
+
BAND_A_Z = (0.130, 0.226) # cell A module band
|
| 28 |
+
COVER_Z = (0.226, 0.334) # hinged upper front cover (OX-TRAN label)
|
| 29 |
+
COVER_X = (-0.082, 0.082)
|
| 30 |
+
COVER_THICKNESS = 0.004
|
| 31 |
+
COVER_HINGE = (0.0, FRONT_Y - 0.0065, COVER_Z[1]) # cover plate 4.5-8.5 mm in front of the face (clears the vent stubs)
|
| 32 |
+
COVER_OPEN_RAD = 1.40
|
| 33 |
+
|
| 34 |
+
# ---------------------------------------------------------------- cells, drawers, cartridges
|
| 35 |
+
DRAWER_FRONT_Z = {'a': (0.170, 0.219), 'b': (0.078, 0.127)}
|
| 36 |
+
DRAWER_CENTER_Z = {k: (v[0] + v[1]) / 2 for k, v in DRAWER_FRONT_Z.items()}
|
| 37 |
+
DRAWER_FRONT_X = (-0.084, 0.084)
|
| 38 |
+
DRAWER_PROUD = 0.010 # handle stands 10 mm in front of the face when closed
|
| 39 |
+
DRAWER_TRAVEL_M = 0.190 # fully open: the cartridge clears the front face for lifting
|
| 40 |
+
BAY_X = (-0.080, 0.080)
|
| 41 |
+
BAY_DEPTH = 0.245 # bay from the front face into the body
|
| 42 |
+
BAY_H = 0.046
|
| 43 |
+
CARTRIDGE_SIZE = (0.140, 0.150, 0.022) # removable horizontal test cartridge (photo / drawing estimate)
|
| 44 |
+
CARTRIDGE_Y_LOCAL = 0.098 # centre of the cartridge behind the drawer front (drawer-local +Y)
|
| 45 |
+
TRAY_LENGTH = 0.230 # tray stays engaged in the bay at full travel
|
| 46 |
+
TRAY_TOP_LOCAL = -0.0215 # tray top surface relative to the drawer front centre (bay floor -0.0225)
|
| 47 |
+
CARTRIDGE_Z_LOCAL = TRAY_TOP_LOCAL + CARTRIDGE_SIZE[2] / 2 # -0.0105: cartridge rests on the tray, top at +0.0005
|
| 48 |
+
PLATEN_REST_BOTTOM_LOCAL = CARTRIDGE_Z_LOCAL + CARTRIDGE_SIZE[2] / 2 + 0.003 # clamp platen 3 mm above the cartridge when released
|
| 49 |
+
PLATEN_T = 0.004
|
| 50 |
+
BAY_HALF_H = 0.0225
|
| 51 |
+
TEST_AREA_M2 = 50e-4 # documented standard test area 50 cm^2
|
| 52 |
+
TEST_WINDOW_D = 2 * math.sqrt(TEST_AREA_M2 / math.pi) # 79.8 mm circle
|
| 53 |
+
FILM_ACROSS_FLATS = 0.1016 # 4 in x 4 in film (product page "Film Size 4 x 4 in std."), cut octagonal
|
| 54 |
+
CLAMP_TRAVEL_M = 0.003 # pneumatic clamp platen stroke (engineering assumption)
|
| 55 |
+
CELLS = ('a', 'b')
|
| 56 |
+
|
| 57 |
+
# ---------------------------------------------------------------- left column: load/unload buttons, status lamps, labels
|
| 58 |
+
BUTTON_X = -0.114
|
| 59 |
+
BUTTON_Z = {'a': 0.191, 'b': 0.098}
|
| 60 |
+
LAMP_Z = {'a': 0.205, 'b': 0.113}
|
| 61 |
+
BUTTON_R = 0.0080
|
| 62 |
+
BEZEL_R = 0.0105
|
| 63 |
+
|
| 64 |
+
# ---------------------------------------------------------------- touchscreen (tilted tablet above the body)
|
| 65 |
+
DISPLAY_TILT_RAD = math.radians(16.0) # face tilted back from vertical (photo estimate)
|
| 66 |
+
DISPLAY_W, DISPLAY_H, DISPLAY_T = 0.252, 0.145, 0.016
|
| 67 |
+
DISPLAY_HINGE = (0.0, -0.208, 0.357) # centre of the lower back edge line
|
| 68 |
+
U = [1.0, 0.0, 0.0]
|
| 69 |
+
V = [0.0, math.sin(DISPLAY_TILT_RAD), math.cos(DISPLAY_TILT_RAD)]
|
| 70 |
+
N = [0.0, -math.cos(DISPLAY_TILT_RAD), math.sin(DISPLAY_TILT_RAD)]
|
| 71 |
+
DISPLAY_CENTER = [DISPLAY_HINGE[0] + V[0] * DISPLAY_H / 2 + N[0] * DISPLAY_T,
|
| 72 |
+
DISPLAY_HINGE[1] + V[1] * DISPLAY_H / 2 + N[1] * DISPLAY_T,
|
| 73 |
+
DISPLAY_HINGE[2] + V[2] * DISPLAY_H / 2 + N[2] * DISPLAY_T] # front face centre of the tablet
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def panel_point(u, v, n=0.0):
|
| 77 |
+
"""Display-face local (u right, v up the face, n outward) -> asset frame."""
|
| 78 |
+
return [DISPLAY_CENTER[i] + u * U[i] + v * V[i] + n * N[i] for i in range(3)]
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
SCREEN_SIZE = (0.222, 0.125) # active area (10.1 in class, drawing estimate)
|
| 82 |
+
SCREEN_CENTER_UV = (0.0, 0.002)
|
| 83 |
+
READOUT_FIELD_U = (0.050, 0.104) # right-hand status column of the engineering UI where the digits sit
|
| 84 |
+
READOUT_LINES_V = {'otr_a_digits': 0.030, 'otr_b_digits': 0.000, 'temperature_digits': -0.030}
|
| 85 |
+
READOUT_DIGIT_H = 0.0105
|
| 86 |
+
LED_BG = (0.012, 0.020, 0.030)
|
| 87 |
+
OTR_DISPLAY_SCALE = 22414.0 * 86400.0 # mol/(m2 s) -> cc(STP)/(m2 day)
|
| 88 |
+
READOUTS = [dict(name='otr_cell_a_sim', part='otr_a_digits', face='N', digits=6, decimals=3, unit='cc/(m2 day)', on=(0.40, 0.86, 0.98), off=LED_BG,
|
| 89 |
+
blank_channel=None, source={'bridge': ['cell_a.last_otr_mol_m2_s'], 'scale': OTR_DISPLAY_SCALE}),
|
| 90 |
+
dict(name='otr_cell_b_sim', part='otr_b_digits', face='N', digits=6, decimals=3, unit='cc/(m2 day)', on=(0.98, 0.78, 0.30), off=LED_BG,
|
| 91 |
+
blank_channel=None, source={'bridge': ['cell_b.last_otr_mol_m2_s'], 'scale': OTR_DISPLAY_SCALE}),
|
| 92 |
+
dict(name='cell_temperature_sim', part='temperature_digits', face='N', digits=4, decimals=1, unit='C', on=(0.92, 0.94, 0.95), off=LED_BG,
|
| 93 |
+
blank_channel=None, source={'bridge': ['thermal.indicated_k'], 'offset': -273.15})]
|
| 94 |
+
LAMPS = [dict(name='cell_a_status', part='lamp_cell_a', face='-Y', digits=0, decimals=0, unit='1', on=(0.20, 0.95, 0.25), off=(0.02, 0.05, 0.03),
|
| 95 |
+
source={'lamp': {'bridge': 'cell_a.indicator_on'}}),
|
| 96 |
+
dict(name='cell_b_status', part='lamp_cell_b', face='-Y', digits=0, decimals=0, unit='1', on=(0.20, 0.95, 0.25), off=(0.02, 0.05, 0.03),
|
| 97 |
+
source={'lamp': {'bridge': 'cell_b.indicator_on'}})]
|
| 98 |
+
READOUT_NOTE_ZH = ('厂家为彩色触摸屏(WinPerm 2 界面,照片可见OTR曲线、A/B/Z池状态与右侧菜单);本资产在屏幕右侧状态栏叠加三行工程七段读数:A池与B池最近一次报告的OTR'
|
| 99 |
+
'(cc/(m²·day),由运行层SI值×22414×86400换算)和池温°C,均来自公开传感/报告状态,不是原厂界面、字体或驱动;A-/B-上方的状态灯亮=该池已夹紧'
|
| 100 |
+
'(灯语为工程映射,厂家未公开)。')
|
| 101 |
+
|
| 102 |
+
# ---------------------------------------------------------------- behind the cover (2/28 Fig. 2-2 layout)
|
| 103 |
+
RECESS_PANEL_Y = FRONT_Y - 0.0004 # dark service panel just proud of the face, hidden by the closed cover
|
| 104 |
+
RECESS_X = (-0.080, 0.080)
|
| 105 |
+
THERMOMETER_WELL = (0.0, 0.2356) # (x, z) centre, "Temp" well visible through the cover notch (Fig. 2-2 item 12)
|
| 106 |
+
VENTS = {'vent_zero': (0.071, 0.2751), 'vent_cell_a': (0.071, 0.2510), 'vent_cell_b': (0.071, 0.2276)} # Fig. 2-2 items 9-11 (Z/A/B)
|
| 107 |
+
TEST_GAS_PORT = (0.0004, 0.2755) # centre fitting behind the cover (manual: cover gives access to the test gas port)
|
| 108 |
+
AUX_PORT = (0.0573, 0.2309) # small unlabelled fitting next to the B vent (purpose not documented)
|
| 109 |
+
COVER_SCREWS = [(-0.0398, 0.3139), (0.0399, 0.3139)]
|
| 110 |
+
COVER_NOTCH = dict(x=(-0.021, 0.021), z=(COVER_Z[0], 0.251))
|
| 111 |
+
|
| 112 |
+
# ---------------------------------------------------------------- rear panel (2/28 Fig. 2-3 layout)
|
| 113 |
+
REAR_PANEL_X = (-0.107, 0.107)
|
| 114 |
+
REAR_PANEL_Z = (0.030, 0.325)
|
| 115 |
+
GAS_INLETS = {'carrier_gas_inlet': (-0.076, 0.263), 'test_gas_inlet': (-0.057, 0.263)}
|
| 116 |
+
COOLING_FAN = dict(center=(0.028, 0.220), radius=0.075)
|
| 117 |
+
ENCLOSURE_FANS = {'enclosure_fan_left': (-0.016, 0.075), 'enclosure_fan_right': (0.066, 0.075)}
|
| 118 |
+
ENCLOSURE_FAN_R = 0.038
|
| 119 |
+
POWER_ENTRY = dict(center=(-0.080, 0.060), size=(0.031, 0.049))
|
| 120 |
+
POWER_SWITCH = dict(center=(-0.080, 0.075), size=(0.018, 0.012))
|
| 121 |
+
POWER_SWITCH_ON_RAD = 0.30
|
| 122 |
+
ETHERNET = (0.127, 0.124)
|
| 123 |
+
USB = {'usb_1': (0.120, 0.076), 'usb_2': (0.134, 0.076)}
|
| 124 |
+
|
| 125 |
+
# ---------------------------------------------------------------- ports, joints, process mirrors
|
| 126 |
+
PORTS = [('carrier_gas_inlet', 'carrier_gas_inlet', 'gas', 'in'), ('test_gas_inlet', 'test_gas_inlet', 'gas', 'in'),
|
| 127 |
+
('vent_zero', 'vent_zero', 'gas', 'out'), ('vent_cell_a', 'vent_cell_a', 'gas', 'out'), ('vent_cell_b', 'vent_cell_b', 'gas', 'out'),
|
| 128 |
+
('test_gas_outlet', 'test_gas_port', 'gas', 'out'), ('cell_a_film', 'cartridge_a', 'mechanical', 'bidirectional'),
|
| 129 |
+
('cell_b_film', 'cartridge_b', 'mechanical', 'bidirectional'), ('thermometer_well', 'thermometer_well', 'thermal', 'in'),
|
| 130 |
+
('line_power', 'power_entry', 'electrical', 'in'), ('ethernet', 'ethernet_port', 'data', 'bidirectional'),
|
| 131 |
+
('usb_1', 'usb_1', 'data', 'bidirectional'), ('usb_2', 'usb_2', 'data', 'bidirectional'), ('cooling_air', 'cooling_fan', 'thermal', 'out')]
|
| 132 |
+
# (part, state_id, capability, blender attribute, unit, upper) ; process-authoritative mirrors
|
| 133 |
+
MOTION = [('drawer_a', 'drawer_a.position_m', 'drawer.move', 'location[1]', 'm', DRAWER_TRAVEL_M),
|
| 134 |
+
('drawer_b', 'drawer_b.position_m', 'drawer.move', 'location[1]', 'm', DRAWER_TRAVEL_M),
|
| 135 |
+
('clamp_a', 'clamp_a.position_m', 'cell.load_unload', 'location[2]', 'm', CLAMP_TRAVEL_M),
|
| 136 |
+
('clamp_b', 'clamp_b.position_m', 'cell.load_unload', 'location[2]', 'm', CLAMP_TRAVEL_M),
|
| 137 |
+
('power_switch', 'power.angle_rad', 'power.set', 'rotation_euler[0]', 'rad', POWER_SWITCH_ON_RAD)]
|
| 138 |
+
PASSIVE_JOINTS = [('cover', 'cover.angle_rad', COVER_OPEN_RAD)]
|
| 139 |
+
KEYS = [('button_load_a', 'a'), ('button_load_b', 'b')]
|
| 140 |
+
KEY_COMMANDS = {'button_load_a': ('cell.load_unload', {'cell': 'A'}), 'button_load_b': ('cell.load_unload', {'cell': 'B'})}
|
| 141 |
+
|
| 142 |
+
PORT_GEOMETRY = {
|
| 143 |
+
'carrier_gas_inlet': dict(pos=[GAS_INLETS['carrier_gas_inlet'][0], REAR_Y + 0.020, GAS_INLETS['carrier_gas_inlet'][1]], insert_axis=[0, -1, 0], radius=0.0016, capture=0.003),
|
| 144 |
+
'test_gas_inlet': dict(pos=[GAS_INLETS['test_gas_inlet'][0], REAR_Y + 0.020, GAS_INLETS['test_gas_inlet'][1]], insert_axis=[0, -1, 0], radius=0.0016, capture=0.003),
|
| 145 |
+
'vent_zero': dict(pos=[VENTS['vent_zero'][0], RECESS_PANEL_Y - 0.004, VENTS['vent_zero'][1]], insert_axis=[0, 1, 0], radius=0.004, capture=0.003),
|
| 146 |
+
'vent_cell_a': dict(pos=[VENTS['vent_cell_a'][0], RECESS_PANEL_Y - 0.004, VENTS['vent_cell_a'][1]], insert_axis=[0, 1, 0], radius=0.004, capture=0.003),
|
| 147 |
+
'vent_cell_b': dict(pos=[VENTS['vent_cell_b'][0], RECESS_PANEL_Y - 0.004, VENTS['vent_cell_b'][1]], insert_axis=[0, 1, 0], radius=0.004, capture=0.003),
|
| 148 |
+
'test_gas_outlet': dict(pos=[TEST_GAS_PORT[0], RECESS_PANEL_Y - 0.004, TEST_GAS_PORT[1]], insert_axis=[0, 1, 0], radius=0.003, capture=0.003),
|
| 149 |
+
'thermometer_well': dict(pos=[THERMOMETER_WELL[0], RECESS_PANEL_Y - 0.002, THERMOMETER_WELL[1]], insert_axis=[0, 1, 0], radius=0.0035, capture=0.003),
|
| 150 |
+
'line_power': dict(pos=[POWER_ENTRY['center'][0], REAR_Y + 0.004, POWER_ENTRY['center'][1] - 0.010], insert_axis=[0, -1, 0], radius=0.010, capture=0.004),
|
| 151 |
+
'ethernet': dict(pos=[ETHERNET[0], REAR_Y + 0.003, ETHERNET[1]], insert_axis=[0, -1, 0], radius=0.006, capture=0.003),
|
| 152 |
+
'usb_1': dict(pos=[USB['usb_1'][0], REAR_Y + 0.003, USB['usb_1'][1]], insert_axis=[0, -1, 0], radius=0.004, capture=0.003),
|
| 153 |
+
'usb_2': dict(pos=[USB['usb_2'][0], REAR_Y + 0.003, USB['usb_2'][1]], insert_axis=[0, -1, 0], radius=0.004, capture=0.003),
|
| 154 |
+
'cooling_air': dict(pos=[COOLING_FAN['center'][0], REAR_Y + 0.010, COOLING_FAN['center'][1]], insert_axis=[0, 1, 0], radius=COOLING_FAN['radius'], capture=0.01),
|
| 155 |
+
}
|
| 156 |
+
for _cell in CELLS:
|
| 157 |
+
PORT_GEOMETRY[f'cell_{_cell}_film'] = dict(pos=[0.0, FRONT_Y + CARTRIDGE_Y_LOCAL, DRAWER_CENTER_Z[_cell] + CARTRIDGE_Z_LOCAL + CARTRIDGE_SIZE[2] / 2],
|
| 158 |
+
insert_axis=[0, 0, 1], radius=TEST_WINDOW_D / 2, capture=0.01, access=[f'drawer_{_cell}_joint']) # q=0 pose; rides the drawer link
|
| 159 |
+
for _row in PORT_GEOMETRY.values():
|
| 160 |
+
_row.update(position_evidence='geometry_derived_simulation_assumption', capture_evidence='simulation_assumption',
|
| 161 |
+
note='接口位置取自2/28同机身线图与2/22照片的比例估计;捕获半径为工程几何,真实管径/pinout/机器人接触未验证。')
|
outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/interface_definition.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM-149 METTLER TOLEDO RC1mx + HFCal (standard torque stirrer, MidTemp oil, AP01-2 glass reactor): single source of the
|
| 2 |
+
interface numbers shared by geometry, runtime tests, Matterix metadata and the scene (SI, +Z up, +Y back, origin at the centre
|
| 3 |
+
of the documented RC1mx footprint, floor Z=0).
|
| 4 |
+
|
| 5 |
+
Documented (RC1mx User Manual 30357680B, 7.1): the RC1mx with the standard stirrer motor is 669 mm wide, 670 mm deep and
|
| 6 |
+
1180.5 mm high and weighs 170 kg -- without reactor and touchscreen terminal. Component positions inside that envelope are
|
| 7 |
+
read from the dimension drawing (manual p.27, rendered at 300 dpi and calibrated on the 669 / 670 / 1180.5 mm dimension lines;
|
| 8 |
+
the front view is scaled 0.905 mm/px horizontally and 0.956 mm/px vertically, the side view 1.017 / 1.022 mm/px) together
|
| 9 |
+
with the labelled overview drawings (p.9 front side, p.10 left side, p.11 electronics cabinet bottom); they are drawing
|
| 10 |
+
estimates with about +-5 mm reading error. The AP01-2 reactor data (2.5 L nominal, 0.5-2 L operating volume, cover ports,
|
| 11 |
+
anchor stirrer, split-flange oil connections, reactor support in rod clamps and double clamps 120 mm apart) come from the RC1e
|
| 12 |
+
High Performance Thermostat operating instructions (predecessor thermostat, same reactor family); the reactor diameters and
|
| 13 |
+
wall thicknesses are engineering values. The touchscreen and the emergency button are separate units of the scope of
|
| 14 |
+
delivery; their bench positions are assumptions."""
|
| 15 |
+
import math
|
| 16 |
+
|
| 17 |
+
SLUG = 'mt_rc1mxhfcal'
|
| 18 |
+
# ---- documented envelope of the RC1mx thermostat with the standard stirrer motor (no reactor, no terminal)
|
| 19 |
+
ENVELOPE_M = (0.669, 0.670, 1.1805)
|
| 20 |
+
X_LEFT, X_RIGHT = -0.3345, 0.3345 # cabinet left face .. right rod-clamp blocks
|
| 21 |
+
Y_FRONT, Y_BACK = -0.335, 0.335 # stirrer-motor holder arm .. cabinet back
|
| 22 |
+
TOP_Z = 1.1805 # top of the standard stirrer motor
|
| 23 |
+
# ---- thermostat: base, rear body (column core), front module, top band, electronics cabinet
|
| 24 |
+
BASE_Z = 0.031
|
| 25 |
+
BASE_Y = (-0.115, 0.332)
|
| 26 |
+
COL_X = (-0.0913, 0.310)
|
| 27 |
+
COL_Y = (0.030, 0.331) # rear body; its front face is recessed behind the front module
|
| 28 |
+
FRONT_X = (-0.0095, 0.227) # front module between the frame rods (oil connections, rotameter)
|
| 29 |
+
FRONT_Y = (-0.062, COL_Y[0])
|
| 30 |
+
COL_TOP_Z = 1.033
|
| 31 |
+
TOPBAND_Z = (1.002, COL_TOP_Z)
|
| 32 |
+
CAB_X = (X_LEFT, COL_X[0])
|
| 33 |
+
CAB_Y = (0.0855, 0.331)
|
| 34 |
+
CAB_Z = (0.432, 1.031)
|
| 35 |
+
# ---- accessory frame: two vertical rods in front of the column, two U-bars held by clamp blocks on the corner rails
|
| 36 |
+
ROD_X = (-0.022, 0.238)
|
| 37 |
+
ROD_Y = -0.103
|
| 38 |
+
ROD_R = 0.007
|
| 39 |
+
ROD_TOP_Z = 0.942
|
| 40 |
+
BAR_Z = (0.500, 0.906) # cross-member heights of the lower and upper U-bar
|
| 41 |
+
BAR_Y = -0.135 # cross members run along X in front of the rods
|
| 42 |
+
BAR_X = (-0.058, 0.289) # risers into the clamp blocks
|
| 43 |
+
BAR_R = 0.006
|
| 44 |
+
CLAMP_BLOCK_Z = ((0.429, 0.471), (0.835, 0.876))
|
| 45 |
+
CLAMP_BLOCK_Y = (-0.044, COL_Y[0])
|
| 46 |
+
CLAMP_BLOCK_X = ((COL_X[0], -0.038), (0.254, X_RIGHT))
|
| 47 |
+
# ---- stirrer motor on the holder (support clamp on the upper U-bar, horizontal arm, mounting plate)
|
| 48 |
+
AXIS_X, AXIS_Y = 0.1275, -0.262 # stirrer / reactor axis (front view 0.1274 m, side view -0.262 m)
|
| 49 |
+
MOTOR_XY = (0.077, 0.075) # motor body width (X) and depth (Y)
|
| 50 |
+
MOTOR_Z = (0.995, TOP_Z)
|
| 51 |
+
MOTOR_BAND_Z = (0.985, 0.995)
|
| 52 |
+
PLATE_X = (0.0615, 0.1928)
|
| 53 |
+
PLATE_Y = (-0.302, -0.222)
|
| 54 |
+
PLATE_Z = (0.959, MOTOR_BAND_Z[0])
|
| 55 |
+
ARM_Z = 0.9735
|
| 56 |
+
ARM_Y = (-0.151, Y_FRONT + 0.001)
|
| 57 |
+
CHUCK_Z = (0.935, PLATE_Z[0])
|
| 58 |
+
# ---- AP01-2 double-wall glass reactor (engineering dimensions; nominal 2.5 L, operating 0.5-2 L documented for the RC1e)
|
| 59 |
+
REACTOR_INNER_R = 0.060
|
| 60 |
+
REACTOR_WALL = 0.004
|
| 61 |
+
JACKET_OUTER_R = 0.080
|
| 62 |
+
REACTOR_FLANGE_Z = 0.500 # top of the glass flange / cover seat
|
| 63 |
+
REACTOR_BOTTOM_Z = 0.262 # inner bottom
|
| 64 |
+
JACKET_Z = (0.214, 0.470)
|
| 65 |
+
COVER_H = 0.030
|
| 66 |
+
SUPPORT_RING_Z = (0.476, 0.486) # reactor support (steel ring under the glass flange)
|
| 67 |
+
SUPPORT_CLAMP_Z = (0.481, 0.361) # rod clamp and double clamp on each frame rod, 120 mm apart (documented distance)
|
| 68 |
+
NOMINAL_VOLUME_M3 = 2.5e-3
|
| 69 |
+
OPERATING_VOLUME_M3 = (0.5e-3, 2.0e-3)
|
| 70 |
+
DRAIN_Z = 0.160 # bottom drain valve body centre
|
| 71 |
+
OUTLET_Z = 0.100 # BS 29 ball-joint outlet
|
| 72 |
+
IMPELLER_Z = REACTOR_BOTTOM_Z + 0.010 # "position the stirrer about 1 cm above the bottom of the reactor"
|
| 73 |
+
IMPELLER_D = 0.100 # anchor stirrer diameter (engineering)
|
| 74 |
+
IMPELLER_H = 0.094
|
| 75 |
+
PROBE_RING_R = 0.034 # Tr sensor, calibration heater and dip tube stay inside the anchor sweep
|
| 76 |
+
# cover ports (documented configuration: ST 29/32 centre, ST 45/40, 2 x ST 19/26, 2 x ST 29/32): name -> (dx, dy, neck radius, neck height, joint)
|
| 77 |
+
COVER_PORTS = {
|
| 78 |
+
'central': (0.0, 0.0, 0.016, 0.045, 'ST 29/32'),
|
| 79 |
+
'large': (0.0, -0.052, 0.026, 0.036, 'ST 45/40'),
|
| 80 |
+
'tr': (-PROBE_RING_R * math.cos(math.radians(30)), PROBE_RING_R * 0.5, 0.012, 0.030, 'ST 19/26'),
|
| 81 |
+
'ph': (PROBE_RING_R * math.cos(math.radians(30)), PROBE_RING_R * 0.5, 0.012, 0.030, 'ST 19/26'),
|
| 82 |
+
'cal': (-PROBE_RING_R * math.cos(math.radians(30)), -PROBE_RING_R * 0.5, 0.0165, 0.032, 'ST 29/32'),
|
| 83 |
+
'dip': (PROBE_RING_R * math.cos(math.radians(30)), -PROBE_RING_R * 0.5, 0.0165, 0.032, 'ST 29/32'),
|
| 84 |
+
}
|
| 85 |
+
PROBE_TOP_Z = {'tr': 0.600, 'cal': 0.598, 'dip': 0.585}
|
| 86 |
+
PROBE_TIP_Z = REACTOR_BOTTOM_Z + 0.045 # immersed at the 0.5 L minimum operating volume (liquid height 44 mm)
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def port_top_z(name):
|
| 90 |
+
return REACTOR_FLANGE_Z + COVER_H + COVER_PORTS[name][3] - 0.004
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
# ---- oil connections to the reactor on the front module (outlet upper, inlet lower): RC1 nozzle, blue split flange, glass flange
|
| 94 |
+
OIL_UPPER = (0.0721, 0.389) # (x, z)
|
| 95 |
+
OIL_LOWER = (0.1815, 0.2284)
|
| 96 |
+
OIL_NOZZLE_Y = (FRONT_Y[0], -0.100)
|
| 97 |
+
OIL_FLANGE_Y = -0.113 # reactor-side glass flange face
|
| 98 |
+
# ---- front module details
|
| 99 |
+
ROTAMETER = dict(x=(0.038, 0.059), z=(0.756, 0.833), panel_x=(0.010, 0.085), panel_z=(0.705, 0.882), knob=(0.0473, 0.731))
|
| 100 |
+
SOCKET_BOX = dict(x=(COL_X[0], -0.0383), y=(-0.044, COL_Y[0]), z=(0.619, 0.720))
|
| 101 |
+
TR_SOCKET_XY = (-0.0865, -0.026)
|
| 102 |
+
CAL_SOCKET_XY = (-0.0743, -0.039)
|
| 103 |
+
STIRRER_BUTTON_XZ = (-0.081, 0.639)
|
| 104 |
+
OIL_WINDOW = dict(x=-0.0150, y=(-0.058, -0.046), z=(0.451, 0.615))
|
| 105 |
+
# ---- left side of the column (below the cabinet): control valve cover, coolant plate, oil drain stopcock
|
| 106 |
+
VALVE_COVER = dict(y=0.1364, z=0.2690, r=0.057, flange_r=0.098, x0=-0.2266)
|
| 107 |
+
COOLANT_PLATE = dict(y=(0.042, 0.222), z=(0.044, 0.119))
|
| 108 |
+
COOLANT_IN_Y, COOLANT_OUT_Y, COOLANT_Z = 0.180, 0.084, 0.082
|
| 109 |
+
FITTING_X0 = -0.141 # hose-end of the coolant fittings
|
| 110 |
+
STOPCOCK = dict(y=0.132, z=0.083, valve_x=(-0.217, -0.157), end_x=-0.239, handle_top=0.121)
|
| 111 |
+
INTERFACE_STRIP = dict(y=(0.045, 0.075), z=(0.745, 0.985))
|
| 112 |
+
# ---- operator units on the bench (assumed placement; separate units in the scope of delivery)
|
| 113 |
+
TERMINAL_CENTER = (0.470, -0.180) # touchscreen stand (x, y)
|
| 114 |
+
EMERGENCY_CENTER = (-0.300, -0.285) # emergency (safeguard) button box (x, y)
|
| 115 |
+
# ---- motion (process-authoritative mirrors) and keys
|
| 116 |
+
STIRRER_JOINT_MAX_RAD = 2 * math.pi # the shaft angle is mirrored modulo one turn
|
| 117 |
+
DRAIN_OPEN_RAD = math.pi / 2
|
| 118 |
+
MOTION = [('stirrer_shaft', 'stirrer.angle_rad', 'stirrer.set', 'rotation', 'rad', STIRRER_JOINT_MAX_RAD),
|
| 119 |
+
('drain_valve_handle', 'drain.angle_rad', 'reactor.discharge', 'rotation', 'rad', DRAIN_OPEN_RAD)]
|
| 120 |
+
PASSIVE_JOINTS = []
|
| 121 |
+
KEYS = ['button_power', 'button_stirrer', 'button_emergency']
|
| 122 |
+
# explicit URDF spring-key joints: press direction into the housing (the Matterix panel pass signs whole-link keys towards the
|
| 123 |
+
# asset centroid, which inverts the switch under the cabinet and the mushroom on top of the floor box); 1.5 mm travel
|
| 124 |
+
KEY_AXES = {'button_power': [0.0, 0.0, 1.0], 'button_stirrer': [0.0, 1.0, 0.0], 'button_emergency': [0.0, 0.0, -1.0]}
|
| 125 |
+
KEY_TRAVEL_M = 0.0015
|
| 126 |
+
KEY_JOINTS = {k: k + '_joint' for k in KEYS}
|
| 127 |
+
KEY_COMMANDS = {'button_power': ('power.toggle', {}), 'button_stirrer': ('stirrer.toggle', {}), 'button_emergency': ('emergency.trigger', {})}
|
| 128 |
+
# ---- simulated overlay readouts on the touchscreen and the status light (not the original iControl GUI)
|
| 129 |
+
TOUCH = dict(center=(TERMINAL_CENTER[0], TERMINAL_CENTER[1] - 0.0205, 0.300), width=0.250, height=0.160)
|
| 130 |
+
LED_BG = (0.02, 0.03, 0.04)
|
| 131 |
+
READOUT_NOTE_ZH = ('RC1mx触摸屏为iControl图形界面;本资产在触摸屏上叠加三行仿真七段读数(Tr °C、Tj °C、转速rpm),不是原厂界面;'
|
| 132 |
+
'电控柜正面左上角状态灯(厂家:通电后变绿)用绿段表示通电且无急停程序,旁边的红段表示急停程序激活(红色语义为工程约定)。')
|
| 133 |
+
READOUTS = [dict(name='tr_sim', part='tr_digits', face='-Y', digits=5, decimals=1, unit='C', on=(0.98, 0.55, 0.12), off=LED_BG, blank_channel=None,
|
| 134 |
+
source={'bridge': ['reactor.indicated_k'], 'offset': -273.15}),
|
| 135 |
+
dict(name='tj_sim', part='tj_digits', face='-Y', digits=5, decimals=1, unit='C', on=(0.98, 0.55, 0.12), off=LED_BG, blank_channel=None,
|
| 136 |
+
source={'bridge': ['jacket.indicated_k'], 'offset': -273.15}),
|
| 137 |
+
dict(name='speed_sim', part='speed_digits', face='-Y', digits=4, decimals=0, unit='rpm', on=(0.98, 0.55, 0.12), off=LED_BG, blank_channel=None,
|
| 138 |
+
source={'bridge': ['stirrer.indicated_rpm']})]
|
| 139 |
+
LAMPS = [dict(name='status_ok', part='lamp_status_ok', face='-Y', digits=0, decimals=0, unit='1', on=(0.20, 0.95, 0.25), off=(0.02, 0.05, 0.03),
|
| 140 |
+
source={'lamp': {'bridge': 'status.ok'}}),
|
| 141 |
+
dict(name='status_alarm', part='lamp_status_alarm', face='-Y', digits=0, decimals=0, unit='1', on=(1.00, 0.18, 0.12), off=(0.06, 0.02, 0.02),
|
| 142 |
+
source={'lamp': {'bridge': 'emergency.active'}})]
|
| 143 |
+
# ---- ports: (name, component, medium, direction)
|
| 144 |
+
PORTS = [('reactor_port_large', 'reactor_cover', 'liquid', 'in'), ('dosing_dip_tube', 'dip_tube', 'liquid', 'in'),
|
| 145 |
+
('drain_outlet', 'drain_valve_body', 'liquid', 'out'), ('tr_sensor_socket', 'front_socket_box', 'electrical', 'bidirectional'),
|
| 146 |
+
('calibration_heater_socket', 'front_socket_box', 'electrical', 'in'), ('coolant_in', 'coolant_in_fitting', 'liquid', 'in'),
|
| 147 |
+
('coolant_out', 'coolant_out_fitting', 'liquid', 'out'), ('purge_gas_inlet', 'purge_inlet', 'gas', 'in'), ('power_inlet', 'electronics_cabinet', 'electrical', 'in'),
|
| 148 |
+
('data_sockets', 'interface_strip', 'data', 'bidirectional'), ('oil_drain', 'oil_drain_stopcock', 'liquid', 'out'),
|
| 149 |
+
('probe_port_st19', 'reactor_cover', 'mechanical', 'in')]
|
| 150 |
+
PORT_MEANING = {
|
| 151 |
+
'reactor_port_large': '反应器盖ST 45/40大口(厂家:free, big probes):装料漏斗或大探头(宿主装料代理;本资产只模拟液相物料)',
|
| 152 |
+
'dosing_dip_tube': '加料浸管(装在ST 29/32口):外部加料泵/天平送入的加料物流在液面下进入',
|
| 153 |
+
'drain_outlet': '反应器底阀出口(BS 29球磨口):放料', 'tr_sensor_socket': '正面插座盒顶部Tr传感器插座(Tr/Trs双Pt100)',
|
| 154 |
+
'calibration_heater_socket': '正面插座盒顶部校准加热器插座(HFCal标定热功率)', 'coolant_in': '左侧冷却水进口(≥10 L/min)', 'coolant_out': '左侧冷却水出口',
|
| 155 |
+
'purge_gas_inlet': '电控柜底部惰性吹扫气接口(Purge-1油箱/Purge-2电控柜;最高0.5 bar,≥80 mL/min)',
|
| 156 |
+
'power_inlet': '电控柜底部电源线接口(Type L 200–240 V 3~ / Type H 350–415 V 3N~,最大4800 W)',
|
| 157 |
+
'data_sockets': '立柱左侧接口条:CAN-1 Out、USB×4、以太网、触摸屏(Control unit)、RS-232×2', 'oil_drain': '放油旋塞(仅室温下操作)',
|
| 158 |
+
'probe_port_st19': '反应器盖ST 19/26空口(厂家:free, pH electrodes),参考姿态用玻璃塞封住'}
|
| 159 |
+
_R_TOP = REACTOR_FLANGE_Z + COVER_H
|
| 160 |
+
PORT_GEOMETRY = { # insert_axis = outward normal of the interface (slot local +Z)
|
| 161 |
+
'reactor_port_large': dict(pos=[AXIS_X + COVER_PORTS['large'][0], AXIS_Y + COVER_PORTS['large'][1], port_top_z('large')], insert_axis=[0, 0, 1], radius=0.0225,
|
| 162 |
+
capture=0.03, access=[]),
|
| 163 |
+
'dosing_dip_tube': dict(pos=[AXIS_X + COVER_PORTS['dip'][0], AXIS_Y + COVER_PORTS['dip'][1], PROBE_TOP_Z['dip'] + 0.020], insert_axis=[0, 0, 1], radius=0.003,
|
| 164 |
+
capture=0.02, access=[]),
|
| 165 |
+
'drain_outlet': dict(pos=[AXIS_X, AXIS_Y, OUTLET_Z], insert_axis=[0, 0, -1], radius=0.0145, capture=0.03, access=[]),
|
| 166 |
+
'tr_sensor_socket': dict(pos=[TR_SOCKET_XY[0], TR_SOCKET_XY[1], SOCKET_BOX['z'][1] + 0.010], insert_axis=[0, 0, 1], radius=0.005, capture=0.01, access=[]),
|
| 167 |
+
'calibration_heater_socket': dict(pos=[CAL_SOCKET_XY[0], CAL_SOCKET_XY[1], SOCKET_BOX['z'][1] + 0.010], insert_axis=[0, 0, 1], radius=0.005, capture=0.01,
|
| 168 |
+
access=[]),
|
| 169 |
+
'coolant_in': dict(pos=[FITTING_X0, COOLANT_IN_Y, COOLANT_Z], insert_axis=[-1, 0, 0], radius=0.009, capture=0.02, access=[]),
|
| 170 |
+
'coolant_out': dict(pos=[FITTING_X0, COOLANT_OUT_Y, COOLANT_Z], insert_axis=[-1, 0, 0], radius=0.009, capture=0.02, access=[]),
|
| 171 |
+
'purge_gas_inlet': dict(pos=[-0.253, 0.245, CAB_Z[0] - 0.014], insert_axis=[0, 0, -1], radius=0.004, capture=0.01, access=[]),
|
| 172 |
+
'power_inlet': dict(pos=[-0.300, 0.297, CAB_Z[0] - 0.030], insert_axis=[0, 0, -1], radius=0.008, capture=0.02, access=[]),
|
| 173 |
+
'data_sockets': dict(pos=[COL_X[0] - 0.009, sum(INTERFACE_STRIP['y']) / 2, 0.865], insert_axis=[-1, 0, 0], radius=0.006, capture=0.02, access=[]),
|
| 174 |
+
'oil_drain': dict(pos=[STOPCOCK['end_x'], STOPCOCK['y'], STOPCOCK['z']], insert_axis=[-1, 0, 0], radius=0.004, capture=0.02, access=[]),
|
| 175 |
+
'probe_port_st19': dict(pos=[AXIS_X + COVER_PORTS['ph'][0], AXIS_Y + COVER_PORTS['ph'][1], port_top_z('ph')], insert_axis=[0, 0, 1], radius=0.0094,
|
| 176 |
+
capture=0.01, access=[]),
|
| 177 |
+
}
|
outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/rc1e_curves_digitized.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/template_validation.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/thermal_calibration.json
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"catalog_id": "CHEM-149",
|
| 3 |
+
"asset_type_id": "instrument.mt_rc1mxhfcal",
|
| 4 |
+
"fitted_at": "2026-09-25T14:06:15.065137+00:00",
|
| 5 |
+
"source": {
|
| 6 |
+
"digitised": "outputs/expansion_batch04/t1_thermal/mt_rc1mxhfcal/source_cache/rc1e_curves_digitized.json",
|
| 7 |
+
"digitised_sha256": "a304be87363253febbb6ab66f9555e95fd46053115a98886ccfc9e3a745677cd",
|
| 8 |
+
"document": "RC1e High Performance Thermostat operating instructions 9.6 (curves 1-4)"
|
| 9 |
+
},
|
| 10 |
+
"documented_inputs": {
|
| 11 |
+
"heater_w": 2000.0,
|
| 12 |
+
"stationary_cooling_w": 100.0,
|
| 13 |
+
"coolant": "water approx. 16 C, approx. 10 L/min",
|
| 14 |
+
"stirrer": "glass anchor, 200 rpm",
|
| 15 |
+
"tr_controller": "P 9, P-only (RC1e software presets the reset time to 999999 s)",
|
| 16 |
+
"tdiff_max_k": 50.0
|
| 17 |
+
},
|
| 18 |
+
"fixed_engineering": {
|
| 19 |
+
"ambient_k": 295.15,
|
| 20 |
+
"coolant_k": 289.15,
|
| 21 |
+
"coolant_flow_m3_s": 0.00016666666666666666,
|
| 22 |
+
"phi_wall_w_m2k": 239.4957983193277,
|
| 23 |
+
"kp_tj_w_k": 1000.0,
|
| 24 |
+
"ti_tj_s": 60.0,
|
| 25 |
+
"l_cold_w_k": 3.0,
|
| 26 |
+
"ua_empty_w_k": 1.0,
|
| 27 |
+
"glycerol_viscosity_pa_s_for_stirrer_power": 1.4,
|
| 28 |
+
"c_ins_j_k": 150.0,
|
| 29 |
+
"trouton_j_mol_k": 88.0
|
| 30 |
+
},
|
| 31 |
+
"switch_times_s": {
|
| 32 |
+
"curve1_empty_Tj_mode": {
|
| 33 |
+
"setpoint_up": 247.34104929811565,
|
| 34 |
+
"setpoint_down_or_emergency": 1803.763799892292
|
| 35 |
+
},
|
| 36 |
+
"curve2_1L_water_Tr_mode": {
|
| 37 |
+
"setpoint_up": 303.9352502954275,
|
| 38 |
+
"setpoint_down_or_emergency": 1679.600074502595
|
| 39 |
+
},
|
| 40 |
+
"curve3_2L_water_Tr_mode": {
|
| 41 |
+
"setpoint_up": 303.92054350056833,
|
| 42 |
+
"setpoint_down_or_emergency": 1770.9332896409342
|
| 43 |
+
},
|
| 44 |
+
"curve4_1L_glycerol_Tr_mode_emergency_A": {
|
| 45 |
+
"setpoint_up": 228.36096039368067,
|
| 46 |
+
"setpoint_down_or_emergency": 3122.5245783126466
|
| 47 |
+
}
|
| 48 |
+
},
|
| 49 |
+
"fitted": {
|
| 50 |
+
"C_J": 9041.874300591024,
|
| 51 |
+
"L_J": 6.7099936470968515,
|
| 52 |
+
"G_VALVE": 57.1017655334523,
|
| 53 |
+
"G_SAFETY": 55.897521747119924,
|
| 54 |
+
"C_C": 31966.789471394164,
|
| 55 |
+
"UA_COIL": 289.93684619975585,
|
| 56 |
+
"P_COLD": 494.44818543289637,
|
| 57 |
+
"L_R": 0.005165576774617651,
|
| 58 |
+
"K_EV": 6.787810436983388e-06,
|
| 59 |
+
"U_W200": 181.31071468466538,
|
| 60 |
+
"U_GLY": 166.91544060181752
|
| 61 |
+
},
|
| 62 |
+
"derived": {
|
| 63 |
+
"h_ref_water_200rpm_w_m2k": 746.2935798099212,
|
| 64 |
+
"ua_1l_water_w_k": 7.644651508488009,
|
| 65 |
+
"ua_2l_water_w_k": 13.688341997976853,
|
| 66 |
+
"ua_1l_glycerol_w_k": 7.037699768631188,
|
| 67 |
+
"wetted_area_1l_m2": 0.04216326388533378,
|
| 68 |
+
"wetted_area_2l_m2": 0.0754965972186671,
|
| 69 |
+
"coolant_conductance_w_k": 237.17088334134425
|
| 70 |
+
},
|
| 71 |
+
"optimizer": {
|
| 72 |
+
"method": "scipy.optimize.least_squares (trf, log-parameters)",
|
| 73 |
+
"status": 3,
|
| 74 |
+
"nfev": 17,
|
| 75 |
+
"cost": 21.279577517951356
|
| 76 |
+
},
|
| 77 |
+
"residuals": {
|
| 78 |
+
"curve1_empty_Tj_mode": {
|
| 79 |
+
"Tj": {
|
| 80 |
+
"rmse_k": 1.3685188670811057,
|
| 81 |
+
"max_abs_k": 9.034401696985583,
|
| 82 |
+
"samples": 236
|
| 83 |
+
},
|
| 84 |
+
"Tc": {
|
| 85 |
+
"rmse_k": 1.315883339302206,
|
| 86 |
+
"max_abs_k": 5.394606689113402,
|
| 87 |
+
"samples": 240
|
| 88 |
+
}
|
| 89 |
+
},
|
| 90 |
+
"curve2_1L_water_Tr_mode": {
|
| 91 |
+
"Tj": {
|
| 92 |
+
"rmse_k": 2.343716793338593,
|
| 93 |
+
"max_abs_k": 16.442772339834505,
|
| 94 |
+
"samples": 297
|
| 95 |
+
},
|
| 96 |
+
"Tr": {
|
| 97 |
+
"rmse_k": 1.525721450893809,
|
| 98 |
+
"max_abs_k": 4.375378325358099,
|
| 99 |
+
"samples": 293
|
| 100 |
+
},
|
| 101 |
+
"Tc": {
|
| 102 |
+
"rmse_k": 1.7309738168401383,
|
| 103 |
+
"max_abs_k": 3.9576460621627234,
|
| 104 |
+
"samples": 279
|
| 105 |
+
}
|
| 106 |
+
},
|
| 107 |
+
"curve3_2L_water_Tr_mode": {
|
| 108 |
+
"Tj": {
|
| 109 |
+
"rmse_k": 4.202860151557892,
|
| 110 |
+
"max_abs_k": 25.254772971253885,
|
| 111 |
+
"samples": 389
|
| 112 |
+
},
|
| 113 |
+
"Tr": {
|
| 114 |
+
"rmse_k": 2.4323095647355304,
|
| 115 |
+
"max_abs_k": 4.029789042212428,
|
| 116 |
+
"samples": 392
|
| 117 |
+
},
|
| 118 |
+
"Tc": {
|
| 119 |
+
"rmse_k": 1.37081467259648,
|
| 120 |
+
"max_abs_k": 4.399073530940598,
|
| 121 |
+
"samples": 415
|
| 122 |
+
}
|
| 123 |
+
},
|
| 124 |
+
"curve4_1L_glycerol_Tr_mode_emergency_A": {
|
| 125 |
+
"Tj": {
|
| 126 |
+
"rmse_k": 2.0647076842739014,
|
| 127 |
+
"max_abs_k": 11.314607273654246,
|
| 128 |
+
"samples": 425
|
| 129 |
+
},
|
| 130 |
+
"Tr": {
|
| 131 |
+
"rmse_k": 1.6655092865916512,
|
| 132 |
+
"max_abs_k": 4.382584347553177,
|
| 133 |
+
"samples": 396
|
| 134 |
+
},
|
| 135 |
+
"Tc": {
|
| 136 |
+
"rmse_k": 1.5448449369561523,
|
| 137 |
+
"max_abs_k": 7.53264744696628,
|
| 138 |
+
"samples": 427
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
"rate_check": {
|
| 143 |
+
"curve1_empty_Tj_mode_heating": {
|
| 144 |
+
"trace": "Tj",
|
| 145 |
+
"from_c": 60.0,
|
| 146 |
+
"to_c": 180.0,
|
| 147 |
+
"manufacturer_s": 948.0368792588029,
|
| 148 |
+
"model_s": 924.0,
|
| 149 |
+
"model_over_manufacturer": 0.9746456284721798
|
| 150 |
+
},
|
| 151 |
+
"curve1_empty_Tj_mode_cooling": {
|
| 152 |
+
"trace": "Tj",
|
| 153 |
+
"from_c": 180.0,
|
| 154 |
+
"to_c": 60.0,
|
| 155 |
+
"manufacturer_s": 216.4808621929551,
|
| 156 |
+
"model_s": 234.0,
|
| 157 |
+
"model_over_manufacturer": 1.0809269587601218
|
| 158 |
+
},
|
| 159 |
+
"curve2_1L_water_Tr_mode_heating": {
|
| 160 |
+
"trace": "Tr",
|
| 161 |
+
"from_c": 40.0,
|
| 162 |
+
"to_c": 90.0,
|
| 163 |
+
"manufacturer_s": 559.1747968911573,
|
| 164 |
+
"model_s": 604.0,
|
| 165 |
+
"model_over_manufacturer": 1.0801631320976148
|
| 166 |
+
},
|
| 167 |
+
"curve2_1L_water_Tr_mode_cooling": {
|
| 168 |
+
"trace": "Tr",
|
| 169 |
+
"from_c": 90.0,
|
| 170 |
+
"to_c": 40.0,
|
| 171 |
+
"manufacturer_s": 816.3952034610902,
|
| 172 |
+
"model_s": 882.0,
|
| 173 |
+
"model_over_manufacturer": 1.0803591156106498
|
| 174 |
+
},
|
| 175 |
+
"curve3_2L_water_Tr_mode_heating": {
|
| 176 |
+
"trace": "Tr",
|
| 177 |
+
"from_c": 40.0,
|
| 178 |
+
"to_c": 90.0,
|
| 179 |
+
"manufacturer_s": 726.0286421380833,
|
| 180 |
+
"model_s": 706.0,
|
| 181 |
+
"model_over_manufacturer": 0.972413426997727
|
| 182 |
+
},
|
| 183 |
+
"curve3_2L_water_Tr_mode_cooling": {
|
| 184 |
+
"trace": "Tr",
|
| 185 |
+
"from_c": 90.0,
|
| 186 |
+
"to_c": 40.0,
|
| 187 |
+
"manufacturer_s": 1195.1548416734604,
|
| 188 |
+
"model_s": 1042.0,
|
| 189 |
+
"model_over_manufacturer": 0.8718535571014276
|
| 190 |
+
},
|
| 191 |
+
"curve4_1L_glycerol_Tr_mode_emergency_A_heating": {
|
| 192 |
+
"trace": "Tr",
|
| 193 |
+
"from_c": 40.0,
|
| 194 |
+
"to_c": 180.0,
|
| 195 |
+
"manufacturer_s": 1573.8879468579944,
|
| 196 |
+
"model_s": 1612.0,
|
| 197 |
+
"model_over_manufacturer": 1.0242152265147528
|
| 198 |
+
},
|
| 199 |
+
"curve4_1L_glycerol_Tr_mode_emergency_A_cooling": {
|
| 200 |
+
"trace": "Tr",
|
| 201 |
+
"from_c": 180.0,
|
| 202 |
+
"to_c": 60.0,
|
| 203 |
+
"manufacturer_s": 768.2960119733343,
|
| 204 |
+
"model_s": 734.0,
|
| 205 |
+
"model_over_manufacturer": 0.9553609397434636
|
| 206 |
+
}
|
| 207 |
+
},
|
| 208 |
+
"limitations_zh": [
|
| 209 |
+
"拟合对象是前代RC1e与AP01-2的厂家“典型曲线”(仅作示意),RC1mx厂家未给同类曲线;拟合常数是集总工程值,不是部件实测。",
|
| 210 |
+
"室温22°C、Tj PI增益、壁+油膜导热phi与冷回路室温得热为固定工程值;曲线的设定值切换时刻由数字化曲线读出。",
|
| 211 |
+
"甘油曲线的U_GLY只用于该曲线(黏度随温度大幅变化,本模型的液膜系数不含温度依赖)。"
|
| 212 |
+
]
|
| 213 |
+
}
|
outputs/expansion_batch04/t1_thermal/netzsch_mmc315/interface_definition.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM-148 NETZSCH MMC 315 Nexus + ARC module: single source of the interface numbers shared by geometry, runtime tests,
|
| 2 |
+
Matterix metadata and the scene (SI, +Z up, +Y back, origin at the footprint centre, floor Z=0).
|
| 3 |
+
|
| 4 |
+
No manufacturer body dimensions or masses are public (workbook: "未取得本体外形或质量"): every dimension below is an
|
| 5 |
+
engineering value read from the proportions of the two manufacturer photographs (2026 overview p.24 MMC 315 Nexus; MMC 274
|
| 6 |
+
Nexus brochure p.2), except the sample container: its 10.028 g mass is the titanium sphere of the manufacturer's DTBP example and its inner
|
| 7 |
+
volume is assumed at the documented 8.5 ml maximum (the example gives no volume)."""
|
| 8 |
+
import math
|
| 9 |
+
|
| 10 |
+
SLUG = 'netzsch_mmc315'
|
| 11 |
+
FOOT_H = 0.022
|
| 12 |
+
# ---- base unit (white): left curved electronics housing + right module bay plinth + rear docking tower
|
| 13 |
+
HOUSING_X = (-0.310, -0.040)
|
| 14 |
+
BODY_Y = (-0.280, 0.300)
|
| 15 |
+
HOUSING_FRONT_H = 0.240 # vertical front face height before the curved top
|
| 16 |
+
HOUSING_TOP_Z = 0.480
|
| 17 |
+
HOUSING_ARC_R = 0.240
|
| 18 |
+
PLINTH_X = (-0.040, 0.310)
|
| 19 |
+
PLINTH_TOP_Z = 0.110
|
| 20 |
+
DOCK_Y = (0.200, 0.300)
|
| 21 |
+
DOCK_TOP_Z = 0.300
|
| 22 |
+
# ---- pull-out slide tray carrying the module
|
| 23 |
+
TRAY_X = (0.000, 0.280)
|
| 24 |
+
TRAY_Y = (-0.250, 0.170)
|
| 25 |
+
TRAY_Z = (0.122, 0.132) # plate; telescopic rails below it 0.110-0.122
|
| 26 |
+
TRAY_TRAVEL_M = 0.250 # prismatic -Y (towards the operator)
|
| 27 |
+
HANDLE_Y = -0.268
|
| 28 |
+
# ---- ARC module (child of the tray) in tray-plate coordinates (origin = tray plate top centre)
|
| 29 |
+
TRAY_TOP_CENTER = ((TRAY_X[0] + TRAY_X[1]) / 2, (TRAY_Y[0] + TRAY_Y[1]) / 2 - 0.010, TRAY_Z[1])
|
| 30 |
+
MODULE_R = 0.110
|
| 31 |
+
MODULE_BODY_Z = (0.050, 0.350) # above the tray plate
|
| 32 |
+
RING_Z = 0.300
|
| 33 |
+
LID_H = 0.050
|
| 34 |
+
LID_HINGE = (0.0, MODULE_R - 0.004, MODULE_BODY_Z[1]) # rear top edge, axis -X (front edge lifts)
|
| 35 |
+
LID_OPEN_RAD = 1.90
|
| 36 |
+
CAVITY_R = 0.050
|
| 37 |
+
CAVITY_DEPTH = 0.120
|
| 38 |
+
# ---- sample container: titanium sphere, 10.028 g documented, 8.5 ml assumed (documented maximum); outer radius derived (Ti 4.51 g/cm3)
|
| 39 |
+
CONTAINER_VOLUME_M3 = 8.5e-6
|
| 40 |
+
CONTAINER_MASS_KG = 10.028e-3
|
| 41 |
+
TI_DENSITY = 4510.0
|
| 42 |
+
R_INNER = (3 * CONTAINER_VOLUME_M3 / (4 * math.pi)) ** (1 / 3)
|
| 43 |
+
R_OUTER = (R_INNER ** 3 + 3 * CONTAINER_MASS_KG / TI_DENSITY / (4 * math.pi)) ** (1 / 3)
|
| 44 |
+
BOMB_CENTER_Z = MODULE_BODY_Z[1] - 0.060 # sphere centre below the lid plane, in module coordinates
|
| 45 |
+
# ---- controls and readouts (status panel on the housing front)
|
| 46 |
+
STATUS_PANEL = dict(center_x=-0.175, z=(0.080, 0.230), width=0.120)
|
| 47 |
+
POWER_SWITCH = (-0.250, 0.300, 0.090) # rear panel rocker (x, y, z)
|
| 48 |
+
POWER_SWITCH_ON_RAD = 0.30
|
| 49 |
+
READOUT_NOTE_ZH = ('MMC 315 Nexus主机正面只有状态指示区,测量由Proteus软件完成;状态面板上的两行七段读数(样品温度°C、压力bar)是本资产的仿真叠加显示,'
|
| 50 |
+
'不是原厂界面;两个状态灯=通电、测试进行中(工程灯语)。')
|
| 51 |
+
LED_BG = (0.012, 0.02, 0.03)
|
| 52 |
+
READOUTS = [dict(name='sample_temperature_sim', part='temperature_digits', face='-Y', digits=5, decimals=1, unit='C', on=(0.98, 0.55, 0.12), off=LED_BG,
|
| 53 |
+
blank_channel=None, source={'bridge': ['sample.indicated_k'], 'offset': -273.15}),
|
| 54 |
+
dict(name='pressure_sim', part='pressure_digits', face='-Y', digits=5, decimals=2, unit='bar', on=(0.98, 0.55, 0.12), off=LED_BG,
|
| 55 |
+
blank_channel=None, source={'bridge': ['pressure.indicated_pa'], 'scale': 1e-5})]
|
| 56 |
+
LAMPS = [dict(name='power_status', part='lamp_power', face='-Y', digits=0, decimals=0, unit='1', on=(0.20, 0.95, 0.25), off=(0.02, 0.05, 0.03),
|
| 57 |
+
source={'lamp': {'bridge': 'power.enabled'}}),
|
| 58 |
+
dict(name='run_status', part='lamp_run', face='-Y', digits=0, decimals=0, unit='1', on=(0.25, 0.55, 1.00), off=(0.02, 0.03, 0.06),
|
| 59 |
+
source={'lamp': {'bridge': 'test.running'}})]
|
| 60 |
+
# (part, state_id, capability, blender attribute, unit, upper) : process-authoritative mirrors
|
| 61 |
+
MOTION = [('tray', 'tray.position_m', 'tray.move', 'location', 'm', TRAY_TRAVEL_M),
|
| 62 |
+
('lid', 'lid.angle_rad', 'lid.set', 'rotation', 'rad', LID_OPEN_RAD),
|
| 63 |
+
('power_switch', 'power.angle_rad', 'power.set', 'rotation', 'rad', POWER_SWITCH_ON_RAD)]
|
| 64 |
+
PASSIVE_JOINTS = []
|
| 65 |
+
KEYS = []
|
| 66 |
+
KEY_COMMANDS = {}
|
| 67 |
+
_MX, _MY, _MZ = TRAY_TOP_CENTER
|
| 68 |
+
PORTS = [('bomb_seat', 'sample_container', 'mechanical', 'bidirectional'), ('tray_handle', 'tray_handle', 'mechanical', 'bidirectional'),
|
| 69 |
+
('lid_grip', 'lid', 'mechanical', 'bidirectional'), ('pressure_feedthrough', 'pressure_line', 'gas', 'out'), ('thermocouple_clip', 'sample_thermocouple', 'electrical', 'out'),
|
| 70 |
+
('module_dock', 'dock_socket', 'electrical', 'bidirectional'), ('line_power', 'power_entry', 'electrical', 'in'), ('usb', 'usb_port', 'data', 'bidirectional'),
|
| 71 |
+
('ethernet', 'ethernet_port', 'data', 'bidirectional'), ('cooling_air', 'cooling_fan', 'gas', 'out')]
|
| 72 |
+
PORT_MEANING = {
|
| 73 |
+
'bomb_seat': '量热腔内样品容器位(顶盖打开后放入/取出装样钛球并接取压管与热电偶)', 'tray_handle': '托盘前把手(拉出/推回模块托��)',
|
| 74 |
+
'lid_grip': '模块顶盖前缘把手(开/合量热腔)', 'pressure_feedthrough': '取压管后侧穿舱接头(样品容器→压力传感器)', 'thermocouple_clip': '样品热电偶在钛球赤道的夹持点',
|
| 75 |
+
'module_dock': '对接塔插座(加热器、热电偶、压力信号)', 'line_power': '电源输入(额定值厂家未公开)', 'usb': 'USB(连接Proteus电脑;接口类型为工程假设)',
|
| 76 |
+
'ethernet': '以太网(工程假设)', 'cooling_air': '冷却风扇排风口(冷却阶段)'}
|
| 77 |
+
_NOTE = '接口位置由本资产照片比例几何推得(工程估计);捕获半径为工程几何,真实接头规格/pinout/机器人接触未验证。'
|
| 78 |
+
PORT_GEOMETRY = {
|
| 79 |
+
'bomb_seat': dict(pos=[_MX, _MY, _MZ + BOMB_CENTER_Z + R_OUTER], insert_axis=[0, 0, 1], radius=R_OUTER, capture=0.02, access=['lid_joint']),
|
| 80 |
+
'tray_handle': dict(pos=[_MX, HANDLE_Y - 0.006, TRAY_Z[1] + 0.018], insert_axis=[0, -1, 0], radius=0.006, capture=0.03, access=[]),
|
| 81 |
+
'lid_grip': dict(pos=[_MX, _MY + LID_HINGE[1] - LID_HINGE[1] - MODULE_R + 0.020, _MZ + MODULE_BODY_Z[1] + LID_H + 0.018], insert_axis=[0, 0, 1], radius=0.012, capture=0.03,
|
| 82 |
+
access=[]),
|
| 83 |
+
'pressure_feedthrough': dict(pos=[_MX, _MY + MODULE_R + 0.010, _MZ + MODULE_BODY_Z[1] - 0.006], insert_axis=[0, 1, 0], radius=0.004, capture=0.01, access=[]),
|
| 84 |
+
'thermocouple_clip': dict(pos=[_MX + R_OUTER, _MY, _MZ + BOMB_CENTER_Z], insert_axis=[0, 0, 1], radius=0.0008, capture=0.005, access=['lid_joint']),
|
| 85 |
+
'module_dock': dict(pos=[0.20, DOCK_Y[0] - 0.020, PLINTH_TOP_Z + 0.060], insert_axis=[0, -1, 0], radius=0.02, capture=0.02, access=[]),
|
| 86 |
+
'line_power': dict(pos=[-0.270, BODY_Y[1] + 0.012, 0.090], insert_axis=[0, 1, 0], radius=0.012, capture=0.015, access=[]),
|
| 87 |
+
'usb': dict(pos=[-0.150, BODY_Y[1] + 0.008, 0.090], insert_axis=[0, 1, 0], radius=0.006, capture=0.01, access=[]),
|
| 88 |
+
'ethernet': dict(pos=[-0.110, BODY_Y[1] + 0.008, 0.090], insert_axis=[0, 1, 0], radius=0.007, capture=0.01, access=[]),
|
| 89 |
+
'cooling_air': dict(pos=[-0.175, BODY_Y[1] + 0.012, 0.340], insert_axis=[0, 1, 0], radius=0.040, capture=0.04, access=[]),
|
| 90 |
+
}
|
| 91 |
+
for _v in PORT_GEOMETRY.values():
|
| 92 |
+
_v.update(position_evidence='geometry_derived_simulation_assumption', capture_evidence='simulation_assumption', note=_NOTE)
|
outputs/expansion_batch04/t1_thermal/netzsch_mmc315/template_validation.json
ADDED
|
@@ -0,0 +1,3201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"catalog_id": "CHEM-148",
|
| 3 |
+
"status": "passed",
|
| 4 |
+
"checked_at": "2026-09-24T22:01:07.419189+00:00",
|
| 5 |
+
"library_sha256": "656294b299473c6192d21d94e2c61129e6299439aed71f856a0aac930e0e1783",
|
| 6 |
+
"distinct_substances": 51,
|
| 7 |
+
"max_half_life_deviation_K": 1.062,
|
| 8 |
+
"method": "re-extract each cited pdftotext line from the hashed cache and match printed A, Ea and half-life temperatures; verbatim DTBP ARC values; PubChem/NIST rows",
|
| 9 |
+
"checks": [
|
| 10 |
+
{
|
| 11 |
+
"id": "sha256_SICA_en_web.pdf",
|
| 12 |
+
"status": "passed",
|
| 13 |
+
"detail": null
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"id": "sha256_MMC_274_Nexus_en_web.pdf",
|
| 17 |
+
"status": "passed",
|
| 18 |
+
"detail": null
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"id": "sha256_nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 22 |
+
"status": "passed",
|
| 23 |
+
"detail": null
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"id": "sha256_nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf",
|
| 27 |
+
"status": "passed",
|
| 28 |
+
"detail": null
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"id": "sha256_nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 32 |
+
"status": "passed",
|
| 33 |
+
"detail": null
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"id": "sha256_arkema_luperox_brochure.pdf",
|
| 37 |
+
"status": "passed",
|
| 38 |
+
"detail": null
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"id": "sha256_acc_safety_handling_organic_peroxides.pdf",
|
| 42 |
+
"status": "passed",
|
| 43 |
+
"detail": null
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"id": "sha256_nist_toluene_phase.html",
|
| 47 |
+
"status": "passed",
|
| 48 |
+
"detail": null
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"id": "sha256_pubchem_cas_verification.json",
|
| 52 |
+
"status": "passed",
|
| 53 |
+
"detail": null
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"id": "unique_id_diisobutyryl_peroxide",
|
| 57 |
+
"status": "passed",
|
| 58 |
+
"detail": null
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"id": "unique_cas_diisobutyryl_peroxide",
|
| 62 |
+
"status": "passed",
|
| 63 |
+
"detail": null
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"id": "cas_format_diisobutyryl_peroxide",
|
| 67 |
+
"status": "passed",
|
| 68 |
+
"detail": null
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"id": "line_values_diisobutyryl_peroxide_0",
|
| 72 |
+
"status": "passed",
|
| 73 |
+
"detail": {
|
| 74 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 75 |
+
"line": 521,
|
| 76 |
+
"text": "Diisobutyryl peroxide [3437-84-1] 174.2 9.18 ",
|
| 77 |
+
"A": "3.37E+14",
|
| 78 |
+
"Ea": 109.06,
|
| 79 |
+
"temps_C": [
|
| 80 |
+
57,
|
| 81 |
+
39,
|
| 82 |
+
23
|
| 83 |
+
]
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"id": "name_block_diisobutyryl_peroxide_0",
|
| 88 |
+
"status": "passed",
|
| 89 |
+
"detail": {
|
| 90 |
+
"cas": "3437-84-1"
|
| 91 |
+
}
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"id": "half_life_consistency_diisobutyryl_peroxide_0",
|
| 95 |
+
"status": "passed",
|
| 96 |
+
"detail": 0.22
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"id": "primary_kinetics_is_a_measurement_diisobutyryl_peroxide",
|
| 100 |
+
"status": "passed",
|
| 101 |
+
"detail": null
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"id": "no_invented_heat_diisobutyryl_peroxide",
|
| 105 |
+
"status": "passed",
|
| 106 |
+
"detail": null
|
| 107 |
+
},
|
| 108 |
+
{
|
| 109 |
+
"id": "unique_id_cumyl_peroxyneodecanoate",
|
| 110 |
+
"status": "passed",
|
| 111 |
+
"detail": null
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"id": "unique_cas_cumyl_peroxyneodecanoate",
|
| 115 |
+
"status": "passed",
|
| 116 |
+
"detail": null
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"id": "cas_format_cumyl_peroxyneodecanoate",
|
| 120 |
+
"status": "passed",
|
| 121 |
+
"detail": null
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"id": "line_values_cumyl_peroxyneodecanoate_0",
|
| 125 |
+
"status": "passed",
|
| 126 |
+
"detail": {
|
| 127 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 128 |
+
"line": 531,
|
| 129 |
+
"text": "Cumyl peroxyneodecanoate [26748-47-0] 306.4 5.22 ",
|
| 130 |
+
"A": "3.12E+14",
|
| 131 |
+
"Ea": 114.59,
|
| 132 |
+
"temps_C": [
|
| 133 |
+
75,
|
| 134 |
+
56,
|
| 135 |
+
38
|
| 136 |
+
]
|
| 137 |
+
}
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"id": "name_block_cumyl_peroxyneodecanoate_0",
|
| 141 |
+
"status": "passed",
|
| 142 |
+
"detail": {
|
| 143 |
+
"cas": "26748-47-0"
|
| 144 |
+
}
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"id": "half_life_consistency_cumyl_peroxyneodecanoate_0",
|
| 148 |
+
"status": "passed",
|
| 149 |
+
"detail": 0.453
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"id": "primary_kinetics_is_a_measurement_cumyl_peroxyneodecanoate",
|
| 153 |
+
"status": "passed",
|
| 154 |
+
"detail": null
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"id": "no_invented_heat_cumyl_peroxyneodecanoate",
|
| 158 |
+
"status": "passed",
|
| 159 |
+
"detail": null
|
| 160 |
+
},
|
| 161 |
+
{
|
| 162 |
+
"id": "unique_id_1_1_3_3_tetramethylbutyl_peroxyneodecanoate",
|
| 163 |
+
"status": "passed",
|
| 164 |
+
"detail": null
|
| 165 |
+
},
|
| 166 |
+
{
|
| 167 |
+
"id": "unique_cas_1_1_3_3_tetramethylbutyl_peroxyneodecanoate",
|
| 168 |
+
"status": "passed",
|
| 169 |
+
"detail": null
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"id": "cas_format_1_1_3_3_tetramethylbutyl_peroxyneodecanoate",
|
| 173 |
+
"status": "passed",
|
| 174 |
+
"detail": null
|
| 175 |
+
},
|
| 176 |
+
{
|
| 177 |
+
"id": "line_values_1_1_3_3_tetramethylbutyl_peroxyneodecanoate_0",
|
| 178 |
+
"status": "passed",
|
| 179 |
+
"detail": {
|
| 180 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 181 |
+
"line": 540,
|
| 182 |
+
"text": "1,1,3,3-Tetramethylbutyl peroxyneodecanoate [51240-95-0] 300.5 5.32 ",
|
| 183 |
+
"A": "3.98E+14",
|
| 184 |
+
"Ea": 115.79,
|
| 185 |
+
"temps_C": [
|
| 186 |
+
76,
|
| 187 |
+
57,
|
| 188 |
+
40
|
| 189 |
+
]
|
| 190 |
+
}
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"id": "name_block_1_1_3_3_tetramethylbutyl_peroxyneodecanoate_0",
|
| 194 |
+
"status": "passed",
|
| 195 |
+
"detail": {
|
| 196 |
+
"cas": "51240-95-0"
|
| 197 |
+
}
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"id": "half_life_consistency_1_1_3_3_tetramethylbutyl_peroxyneodecanoate_0",
|
| 201 |
+
"status": "passed",
|
| 202 |
+
"detail": 0.453
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"id": "primary_kinetics_is_a_measurement_1_1_3_3_tetramethylbutyl_peroxyneodecanoate",
|
| 206 |
+
"status": "passed",
|
| 207 |
+
"detail": null
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"id": "no_invented_heat_1_1_3_3_tetramethylbutyl_peroxyneodecanoate",
|
| 211 |
+
"status": "passed",
|
| 212 |
+
"detail": null
|
| 213 |
+
},
|
| 214 |
+
{
|
| 215 |
+
"id": "unique_id_tamyl_peroxyneodecanoate",
|
| 216 |
+
"status": "passed",
|
| 217 |
+
"detail": null
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"id": "unique_cas_tamyl_peroxyneodecanoate",
|
| 221 |
+
"status": "passed",
|
| 222 |
+
"detail": null
|
| 223 |
+
},
|
| 224 |
+
{
|
| 225 |
+
"id": "cas_format_tamyl_peroxyneodecanoate",
|
| 226 |
+
"status": "passed",
|
| 227 |
+
"detail": null
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"id": "line_values_tamyl_peroxyneodecanoate_0",
|
| 231 |
+
"status": "passed",
|
| 232 |
+
"detail": {
|
| 233 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 234 |
+
"line": 549,
|
| 235 |
+
"text": "tert-Amyl peroxyneodecanoate [68299-16-1] 258.4 6.19 ",
|
| 236 |
+
"A": "1.47E+14",
|
| 237 |
+
"Ea": 114.38,
|
| 238 |
+
"temps_C": [
|
| 239 |
+
81,
|
| 240 |
+
61,
|
| 241 |
+
43
|
| 242 |
+
]
|
| 243 |
+
}
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"id": "name_block_tamyl_peroxyneodecanoate_0",
|
| 247 |
+
"status": "passed",
|
| 248 |
+
"detail": {
|
| 249 |
+
"cas": "68299-16-1"
|
| 250 |
+
}
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
"id": "half_life_consistency_tamyl_peroxyneodecanoate_0",
|
| 254 |
+
"status": "passed",
|
| 255 |
+
"detail": 0.453
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
"id": "primary_kinetics_is_a_measurement_tamyl_peroxyneodecanoate",
|
| 259 |
+
"status": "passed",
|
| 260 |
+
"detail": null
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"id": "no_invented_heat_tamyl_peroxyneodecanoate",
|
| 264 |
+
"status": "passed",
|
| 265 |
+
"detail": null
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"id": "unique_id_di_sec_butyl_peroxydicarbonate",
|
| 269 |
+
"status": "passed",
|
| 270 |
+
"detail": null
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"id": "unique_cas_di_sec_butyl_peroxydicarbonate",
|
| 274 |
+
"status": "passed",
|
| 275 |
+
"detail": null
|
| 276 |
+
},
|
| 277 |
+
{
|
| 278 |
+
"id": "cas_format_di_sec_butyl_peroxydicarbonate",
|
| 279 |
+
"status": "passed",
|
| 280 |
+
"detail": null
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"id": "line_values_di_sec_butyl_peroxydicarbonate_0",
|
| 284 |
+
"status": "passed",
|
| 285 |
+
"detail": {
|
| 286 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 287 |
+
"line": 558,
|
| 288 |
+
"text": "Di-sec-butyl peroxydicarbonate [19910-65-7] 234.2 6.83 ",
|
| 289 |
+
"A": "3.19E+15",
|
| 290 |
+
"Ea": 123.85,
|
| 291 |
+
"temps_C": [
|
| 292 |
+
82,
|
| 293 |
+
63,
|
| 294 |
+
47
|
| 295 |
+
]
|
| 296 |
+
}
|
| 297 |
+
},
|
| 298 |
+
{
|
| 299 |
+
"id": "name_block_di_sec_butyl_peroxydicarbonate_0",
|
| 300 |
+
"status": "passed",
|
| 301 |
+
"detail": {
|
| 302 |
+
"cas": "19910-65-7"
|
| 303 |
+
}
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
"id": "half_life_consistency_di_sec_butyl_peroxydicarbonate_0",
|
| 307 |
+
"status": "passed",
|
| 308 |
+
"detail": 0.453
|
| 309 |
+
},
|
| 310 |
+
{
|
| 311 |
+
"id": "primary_kinetics_is_a_measurement_di_sec_butyl_peroxydicarbonate",
|
| 312 |
+
"status": "passed",
|
| 313 |
+
"detail": null
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"id": "no_invented_heat_di_sec_butyl_peroxydicarbonate",
|
| 317 |
+
"status": "passed",
|
| 318 |
+
"detail": null
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"id": "unique_id_diisopropyl_peroxydicarbonate",
|
| 322 |
+
"status": "passed",
|
| 323 |
+
"detail": null
|
| 324 |
+
},
|
| 325 |
+
{
|
| 326 |
+
"id": "unique_cas_diisopropyl_peroxydicarbonate",
|
| 327 |
+
"status": "passed",
|
| 328 |
+
"detail": null
|
| 329 |
+
},
|
| 330 |
+
{
|
| 331 |
+
"id": "cas_format_diisopropyl_peroxydicarbonate",
|
| 332 |
+
"status": "passed",
|
| 333 |
+
"detail": null
|
| 334 |
+
},
|
| 335 |
+
{
|
| 336 |
+
"id": "line_values_diisopropyl_peroxydicarbonate_0",
|
| 337 |
+
"status": "passed",
|
| 338 |
+
"detail": {
|
| 339 |
+
"file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf",
|
| 340 |
+
"line": 442,
|
| 341 |
+
"text": "Diisopropyl peroxydicarbonate [105-64-6] 206.2 7.76 ",
|
| 342 |
+
"A": "3.35E+15",
|
| 343 |
+
"Ea": 124.01,
|
| 344 |
+
"temps_C": [
|
| 345 |
+
82,
|
| 346 |
+
64,
|
| 347 |
+
47
|
| 348 |
+
]
|
| 349 |
+
}
|
| 350 |
+
},
|
| 351 |
+
{
|
| 352 |
+
"id": "name_block_diisopropyl_peroxydicarbonate_0",
|
| 353 |
+
"status": "passed",
|
| 354 |
+
"detail": {
|
| 355 |
+
"cas": "105-64-6"
|
| 356 |
+
}
|
| 357 |
+
},
|
| 358 |
+
{
|
| 359 |
+
"id": "half_life_consistency_diisopropyl_peroxydicarbonate_0",
|
| 360 |
+
"status": "passed",
|
| 361 |
+
"detail": 0.491
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"id": "primary_kinetics_is_a_measurement_diisopropyl_peroxydicarbonate",
|
| 365 |
+
"status": "passed",
|
| 366 |
+
"detail": null
|
| 367 |
+
},
|
| 368 |
+
{
|
| 369 |
+
"id": "no_invented_heat_diisopropyl_peroxydicarbonate",
|
| 370 |
+
"status": "passed",
|
| 371 |
+
"detail": null
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"id": "unique_id_tbutyl_peroxyneodecanoate",
|
| 375 |
+
"status": "passed",
|
| 376 |
+
"detail": null
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"id": "unique_cas_tbutyl_peroxyneodecanoate",
|
| 380 |
+
"status": "passed",
|
| 381 |
+
"detail": null
|
| 382 |
+
},
|
| 383 |
+
{
|
| 384 |
+
"id": "cas_format_tbutyl_peroxyneodecanoate",
|
| 385 |
+
"status": "passed",
|
| 386 |
+
"detail": null
|
| 387 |
+
},
|
| 388 |
+
{
|
| 389 |
+
"id": "line_values_tbutyl_peroxyneodecanoate_0",
|
| 390 |
+
"status": "passed",
|
| 391 |
+
"detail": {
|
| 392 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 393 |
+
"line": 601,
|
| 394 |
+
"text": "tert-Butyl peroxyneodecanoate [26748-41-4] 244.4 6.55 ",
|
| 395 |
+
"A": "1.52E+14",
|
| 396 |
+
"Ea": 115.47,
|
| 397 |
+
"temps_C": [
|
| 398 |
+
84,
|
| 399 |
+
64,
|
| 400 |
+
46
|
| 401 |
+
]
|
| 402 |
+
}
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"id": "name_block_tbutyl_peroxyneodecanoate_0",
|
| 406 |
+
"status": "passed",
|
| 407 |
+
"detail": {
|
| 408 |
+
"cas": "26748-41-4"
|
| 409 |
+
}
|
| 410 |
+
},
|
| 411 |
+
{
|
| 412 |
+
"id": "half_life_consistency_tbutyl_peroxyneodecanoate_0",
|
| 413 |
+
"status": "passed",
|
| 414 |
+
"detail": 0.491
|
| 415 |
+
},
|
| 416 |
+
{
|
| 417 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_peroxyneodecanoate",
|
| 418 |
+
"status": "passed",
|
| 419 |
+
"detail": null
|
| 420 |
+
},
|
| 421 |
+
{
|
| 422 |
+
"id": "no_invented_heat_tbutyl_peroxyneodecanoate",
|
| 423 |
+
"status": "passed",
|
| 424 |
+
"detail": null
|
| 425 |
+
},
|
| 426 |
+
{
|
| 427 |
+
"id": "unique_id_di_2_ethylhexyl_peroxydicarbonate",
|
| 428 |
+
"status": "passed",
|
| 429 |
+
"detail": null
|
| 430 |
+
},
|
| 431 |
+
{
|
| 432 |
+
"id": "unique_cas_di_2_ethylhexyl_peroxydicarbonate",
|
| 433 |
+
"status": "passed",
|
| 434 |
+
"detail": null
|
| 435 |
+
},
|
| 436 |
+
{
|
| 437 |
+
"id": "cas_format_di_2_ethylhexyl_peroxydicarbonate",
|
| 438 |
+
"status": "passed",
|
| 439 |
+
"detail": null
|
| 440 |
+
},
|
| 441 |
+
{
|
| 442 |
+
"id": "line_values_di_2_ethylhexyl_peroxydicarbonate_0",
|
| 443 |
+
"status": "passed",
|
| 444 |
+
"detail": {
|
| 445 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 446 |
+
"line": 591,
|
| 447 |
+
"text": "Di(2-ethylhexyl) peroxydicarbonate [16111-62-9] 346.5 4.62 ",
|
| 448 |
+
"A": "1.83E+15",
|
| 449 |
+
"Ea": 122.45,
|
| 450 |
+
"temps_C": [
|
| 451 |
+
83,
|
| 452 |
+
64,
|
| 453 |
+
47
|
| 454 |
+
]
|
| 455 |
+
}
|
| 456 |
+
},
|
| 457 |
+
{
|
| 458 |
+
"id": "name_block_di_2_ethylhexyl_peroxydicarbonate_0",
|
| 459 |
+
"status": "passed",
|
| 460 |
+
"detail": {
|
| 461 |
+
"cas": "16111-62-9"
|
| 462 |
+
}
|
| 463 |
+
},
|
| 464 |
+
{
|
| 465 |
+
"id": "half_life_consistency_di_2_ethylhexyl_peroxydicarbonate_0",
|
| 466 |
+
"status": "passed",
|
| 467 |
+
"detail": 0.491
|
| 468 |
+
},
|
| 469 |
+
{
|
| 470 |
+
"id": "line_values_di_2_ethylhexyl_peroxydicarbonate_1",
|
| 471 |
+
"status": "passed",
|
| 472 |
+
"detail": {
|
| 473 |
+
"file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf",
|
| 474 |
+
"line": 449,
|
| 475 |
+
"text": "Di(2-ethylhexyl) peroxydicarbonate [16111-62-9]] 346.5 4.62 ",
|
| 476 |
+
"A": "1.52E+14",
|
| 477 |
+
"Ea": 115.47,
|
| 478 |
+
"temps_C": [
|
| 479 |
+
84,
|
| 480 |
+
64,
|
| 481 |
+
46
|
| 482 |
+
]
|
| 483 |
+
}
|
| 484 |
+
},
|
| 485 |
+
{
|
| 486 |
+
"id": "name_block_di_2_ethylhexyl_peroxydicarbonate_1",
|
| 487 |
+
"status": "passed",
|
| 488 |
+
"detail": {
|
| 489 |
+
"cas": "16111-62-9"
|
| 490 |
+
}
|
| 491 |
+
},
|
| 492 |
+
{
|
| 493 |
+
"id": "half_life_consistency_di_2_ethylhexyl_peroxydicarbonate_1",
|
| 494 |
+
"status": "passed",
|
| 495 |
+
"detail": 0.491
|
| 496 |
+
},
|
| 497 |
+
{
|
| 498 |
+
"id": "primary_kinetics_is_a_measurement_di_2_ethylhexyl_peroxydicarbonate",
|
| 499 |
+
"status": "passed",
|
| 500 |
+
"detail": null
|
| 501 |
+
},
|
| 502 |
+
{
|
| 503 |
+
"id": "no_invented_heat_di_2_ethylhexyl_peroxydicarbonate",
|
| 504 |
+
"status": "passed",
|
| 505 |
+
"detail": null
|
| 506 |
+
},
|
| 507 |
+
{
|
| 508 |
+
"id": "unique_id_di_4_tbutylcyclohexyl_peroxydicarbonate",
|
| 509 |
+
"status": "passed",
|
| 510 |
+
"detail": null
|
| 511 |
+
},
|
| 512 |
+
{
|
| 513 |
+
"id": "unique_cas_di_4_tbutylcyclohexyl_peroxydicarbonate",
|
| 514 |
+
"status": "passed",
|
| 515 |
+
"detail": null
|
| 516 |
+
},
|
| 517 |
+
{
|
| 518 |
+
"id": "cas_format_di_4_tbutylcyclohexyl_peroxydicarbonate",
|
| 519 |
+
"status": "passed",
|
| 520 |
+
"detail": null
|
| 521 |
+
},
|
| 522 |
+
{
|
| 523 |
+
"id": "line_values_di_4_tbutylcyclohexyl_peroxydicarbonate_0",
|
| 524 |
+
"status": "passed",
|
| 525 |
+
"detail": {
|
| 526 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 527 |
+
"line": 567,
|
| 528 |
+
"text": "Di(4-tert-butylcyclohexyl) peroxydicarbonate [15520-11-3] 398.5 4.01 ",
|
| 529 |
+
"A": "7.44E+15",
|
| 530 |
+
"Ea": 126.39,
|
| 531 |
+
"temps_C": [
|
| 532 |
+
82,
|
| 533 |
+
64,
|
| 534 |
+
48
|
| 535 |
+
]
|
| 536 |
+
}
|
| 537 |
+
},
|
| 538 |
+
{
|
| 539 |
+
"id": "name_block_di_4_tbutylcyclohexyl_peroxydicarbonate_0",
|
| 540 |
+
"status": "passed",
|
| 541 |
+
"detail": {
|
| 542 |
+
"cas": "15520-11-3"
|
| 543 |
+
}
|
| 544 |
+
},
|
| 545 |
+
{
|
| 546 |
+
"id": "half_life_consistency_di_4_tbutylcyclohexyl_peroxydicarbonate_0",
|
| 547 |
+
"status": "passed",
|
| 548 |
+
"detail": 0.491
|
| 549 |
+
},
|
| 550 |
+
{
|
| 551 |
+
"id": "primary_kinetics_is_a_measurement_di_4_tbutylcyclohexyl_peroxydicarbonate",
|
| 552 |
+
"status": "passed",
|
| 553 |
+
"detail": null
|
| 554 |
+
},
|
| 555 |
+
{
|
| 556 |
+
"id": "no_invented_heat_di_4_tbutylcyclohexyl_peroxydicarbonate",
|
| 557 |
+
"status": "passed",
|
| 558 |
+
"detail": null
|
| 559 |
+
},
|
| 560 |
+
{
|
| 561 |
+
"id": "unique_id_dimyristyl_peroxydicarbonate",
|
| 562 |
+
"status": "passed",
|
| 563 |
+
"detail": null
|
| 564 |
+
},
|
| 565 |
+
{
|
| 566 |
+
"id": "unique_cas_dimyristyl_peroxydicarbonate",
|
| 567 |
+
"status": "passed",
|
| 568 |
+
"detail": null
|
| 569 |
+
},
|
| 570 |
+
{
|
| 571 |
+
"id": "cas_format_dimyristyl_peroxydicarbonate",
|
| 572 |
+
"status": "passed",
|
| 573 |
+
"detail": null
|
| 574 |
+
},
|
| 575 |
+
{
|
| 576 |
+
"id": "line_values_dimyristyl_peroxydicarbonate_0",
|
| 577 |
+
"status": "passed",
|
| 578 |
+
"detail": {
|
| 579 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 580 |
+
"line": 619,
|
| 581 |
+
"text": "Dimyristyl peroxydicarbonate [53220-22-7] 514.8 3.11 ",
|
| 582 |
+
"A": "2.82E+15",
|
| 583 |
+
"Ea": 124.1,
|
| 584 |
+
"temps_C": [
|
| 585 |
+
84,
|
| 586 |
+
65,
|
| 587 |
+
48
|
| 588 |
+
]
|
| 589 |
+
}
|
| 590 |
+
},
|
| 591 |
+
{
|
| 592 |
+
"id": "name_block_dimyristyl_peroxydicarbonate_0",
|
| 593 |
+
"status": "passed",
|
| 594 |
+
"detail": {
|
| 595 |
+
"cas": "53220-22-7"
|
| 596 |
+
}
|
| 597 |
+
},
|
| 598 |
+
{
|
| 599 |
+
"id": "half_life_consistency_dimyristyl_peroxydicarbonate_0",
|
| 600 |
+
"status": "passed",
|
| 601 |
+
"detail": 0.491
|
| 602 |
+
},
|
| 603 |
+
{
|
| 604 |
+
"id": "primary_kinetics_is_a_measurement_dimyristyl_peroxydicarbonate",
|
| 605 |
+
"status": "passed",
|
| 606 |
+
"detail": null
|
| 607 |
+
},
|
| 608 |
+
{
|
| 609 |
+
"id": "no_invented_heat_dimyristyl_peroxydicarbonate",
|
| 610 |
+
"status": "passed",
|
| 611 |
+
"detail": null
|
| 612 |
+
},
|
| 613 |
+
{
|
| 614 |
+
"id": "unique_id_dicetyl_peroxydicarbonate",
|
| 615 |
+
"status": "passed",
|
| 616 |
+
"detail": null
|
| 617 |
+
},
|
| 618 |
+
{
|
| 619 |
+
"id": "unique_cas_dicetyl_peroxydicarbonate",
|
| 620 |
+
"status": "passed",
|
| 621 |
+
"detail": null
|
| 622 |
+
},
|
| 623 |
+
{
|
| 624 |
+
"id": "cas_format_dicetyl_peroxydicarbonate",
|
| 625 |
+
"status": "passed",
|
| 626 |
+
"detail": null
|
| 627 |
+
},
|
| 628 |
+
{
|
| 629 |
+
"id": "line_values_dicetyl_peroxydicarbonate_0",
|
| 630 |
+
"status": "passed",
|
| 631 |
+
"detail": {
|
| 632 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 633 |
+
"line": 609,
|
| 634 |
+
"text": "Dicetyl peroxydicarbonate [26322-14-5] 570.9 2.80 ",
|
| 635 |
+
"A": "3.02E+15",
|
| 636 |
+
"Ea": 124.3,
|
| 637 |
+
"temps_C": [
|
| 638 |
+
84,
|
| 639 |
+
65,
|
| 640 |
+
48
|
| 641 |
+
]
|
| 642 |
+
}
|
| 643 |
+
},
|
| 644 |
+
{
|
| 645 |
+
"id": "name_block_dicetyl_peroxydicarbonate_0",
|
| 646 |
+
"status": "passed",
|
| 647 |
+
"detail": {
|
| 648 |
+
"cas": "26322-14-5"
|
| 649 |
+
}
|
| 650 |
+
},
|
| 651 |
+
{
|
| 652 |
+
"id": "half_life_consistency_dicetyl_peroxydicarbonate_0",
|
| 653 |
+
"status": "passed",
|
| 654 |
+
"detail": 0.491
|
| 655 |
+
},
|
| 656 |
+
{
|
| 657 |
+
"id": "primary_kinetics_is_a_measurement_dicetyl_peroxydicarbonate",
|
| 658 |
+
"status": "passed",
|
| 659 |
+
"detail": null
|
| 660 |
+
},
|
| 661 |
+
{
|
| 662 |
+
"id": "no_invented_heat_dicetyl_peroxydicarbonate",
|
| 663 |
+
"status": "passed",
|
| 664 |
+
"detail": null
|
| 665 |
+
},
|
| 666 |
+
{
|
| 667 |
+
"id": "unique_id_1_1_3_3_tetramethylbutyl_peroxypivalate",
|
| 668 |
+
"status": "passed",
|
| 669 |
+
"detail": null
|
| 670 |
+
},
|
| 671 |
+
{
|
| 672 |
+
"id": "unique_cas_1_1_3_3_tetramethylbutyl_peroxypivalate",
|
| 673 |
+
"status": "passed",
|
| 674 |
+
"detail": null
|
| 675 |
+
},
|
| 676 |
+
{
|
| 677 |
+
"id": "cas_format_1_1_3_3_tetramethylbutyl_peroxypivalate",
|
| 678 |
+
"status": "passed",
|
| 679 |
+
"detail": null
|
| 680 |
+
},
|
| 681 |
+
{
|
| 682 |
+
"id": "line_values_1_1_3_3_tetramethylbutyl_peroxypivalate_0",
|
| 683 |
+
"status": "passed",
|
| 684 |
+
"detail": {
|
| 685 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 686 |
+
"line": 629,
|
| 687 |
+
"text": "1,1,3,3-Tetramethylbutyl peroxypivalate [22288-41-1] 230.3 6.95 ",
|
| 688 |
+
"A": "2.47E+14",
|
| 689 |
+
"Ea": 117.5,
|
| 690 |
+
"temps_C": [
|
| 691 |
+
86,
|
| 692 |
+
66,
|
| 693 |
+
48
|
| 694 |
+
]
|
| 695 |
+
}
|
| 696 |
+
},
|
| 697 |
+
{
|
| 698 |
+
"id": "name_block_1_1_3_3_tetramethylbutyl_peroxypivalate_0",
|
| 699 |
+
"status": "passed",
|
| 700 |
+
"detail": {
|
| 701 |
+
"cas": "22288-41-1"
|
| 702 |
+
}
|
| 703 |
+
},
|
| 704 |
+
{
|
| 705 |
+
"id": "half_life_consistency_1_1_3_3_tetramethylbutyl_peroxypivalate_0",
|
| 706 |
+
"status": "passed",
|
| 707 |
+
"detail": 0.491
|
| 708 |
+
},
|
| 709 |
+
{
|
| 710 |
+
"id": "primary_kinetics_is_a_measurement_1_1_3_3_tetramethylbutyl_peroxypivalate",
|
| 711 |
+
"status": "passed",
|
| 712 |
+
"detail": null
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
"id": "no_invented_heat_1_1_3_3_tetramethylbutyl_peroxypivalate",
|
| 716 |
+
"status": "passed",
|
| 717 |
+
"detail": null
|
| 718 |
+
},
|
| 719 |
+
{
|
| 720 |
+
"id": "unique_id_di_2_4_dichlorobenzoyl_peroxide",
|
| 721 |
+
"status": "passed",
|
| 722 |
+
"detail": null
|
| 723 |
+
},
|
| 724 |
+
{
|
| 725 |
+
"id": "unique_cas_di_2_4_dichlorobenzoyl_peroxide",
|
| 726 |
+
"status": "passed",
|
| 727 |
+
"detail": null
|
| 728 |
+
},
|
| 729 |
+
{
|
| 730 |
+
"id": "cas_format_di_2_4_dichlorobenzoyl_peroxide",
|
| 731 |
+
"status": "passed",
|
| 732 |
+
"detail": null
|
| 733 |
+
},
|
| 734 |
+
{
|
| 735 |
+
"id": "line_values_di_2_4_dichlorobenzoyl_peroxide_0",
|
| 736 |
+
"status": "passed",
|
| 737 |
+
"detail": {
|
| 738 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 739 |
+
"line": 831,
|
| 740 |
+
"text": "PERKADOX PD Di(2,4-dichlorobenzoyl) peroxide VMQ 89 68 49 112.4 3.21E+13",
|
| 741 |
+
"A": "3.21E+13",
|
| 742 |
+
"Ea": 112.4,
|
| 743 |
+
"temps_C": [
|
| 744 |
+
89,
|
| 745 |
+
68,
|
| 746 |
+
49
|
| 747 |
+
]
|
| 748 |
+
}
|
| 749 |
+
},
|
| 750 |
+
{
|
| 751 |
+
"id": "name_block_di_2_4_dichlorobenzoyl_peroxide_0",
|
| 752 |
+
"status": "passed",
|
| 753 |
+
"detail": {
|
| 754 |
+
"cas": "133-14-2"
|
| 755 |
+
}
|
| 756 |
+
},
|
| 757 |
+
{
|
| 758 |
+
"id": "half_life_consistency_di_2_4_dichlorobenzoyl_peroxide_0",
|
| 759 |
+
"status": "passed",
|
| 760 |
+
"detail": 0.491
|
| 761 |
+
},
|
| 762 |
+
{
|
| 763 |
+
"id": "primary_kinetics_is_a_measurement_di_2_4_dichlorobenzoyl_peroxide",
|
| 764 |
+
"status": "passed",
|
| 765 |
+
"detail": null
|
| 766 |
+
},
|
| 767 |
+
{
|
| 768 |
+
"id": "no_invented_heat_di_2_4_dichlorobenzoyl_peroxide",
|
| 769 |
+
"status": "passed",
|
| 770 |
+
"detail": null
|
| 771 |
+
},
|
| 772 |
+
{
|
| 773 |
+
"id": "unique_id_tamyl_peroxypivalate",
|
| 774 |
+
"status": "passed",
|
| 775 |
+
"detail": null
|
| 776 |
+
},
|
| 777 |
+
{
|
| 778 |
+
"id": "unique_cas_tamyl_peroxypivalate",
|
| 779 |
+
"status": "passed",
|
| 780 |
+
"detail": null
|
| 781 |
+
},
|
| 782 |
+
{
|
| 783 |
+
"id": "cas_format_tamyl_peroxypivalate",
|
| 784 |
+
"status": "passed",
|
| 785 |
+
"detail": null
|
| 786 |
+
},
|
| 787 |
+
{
|
| 788 |
+
"id": "line_values_tamyl_peroxypivalate_0",
|
| 789 |
+
"status": "passed",
|
| 790 |
+
"detail": {
|
| 791 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 792 |
+
"line": 638,
|
| 793 |
+
"text": "tert-Amyl peroxypivalate [29240-17-3] 188.3 8.50 ",
|
| 794 |
+
"A": "4.12E+15",
|
| 795 |
+
"Ea": 127.76,
|
| 796 |
+
"temps_C": [
|
| 797 |
+
91,
|
| 798 |
+
72,
|
| 799 |
+
55
|
| 800 |
+
]
|
| 801 |
+
}
|
| 802 |
+
},
|
| 803 |
+
{
|
| 804 |
+
"id": "name_block_tamyl_peroxypivalate_0",
|
| 805 |
+
"status": "passed",
|
| 806 |
+
"detail": {
|
| 807 |
+
"cas": "29240-17-3"
|
| 808 |
+
}
|
| 809 |
+
},
|
| 810 |
+
{
|
| 811 |
+
"id": "half_life_consistency_tamyl_peroxypivalate_0",
|
| 812 |
+
"status": "passed",
|
| 813 |
+
"detail": 0.491
|
| 814 |
+
},
|
| 815 |
+
{
|
| 816 |
+
"id": "primary_kinetics_is_a_measurement_tamyl_peroxypivalate",
|
| 817 |
+
"status": "passed",
|
| 818 |
+
"detail": null
|
| 819 |
+
},
|
| 820 |
+
{
|
| 821 |
+
"id": "no_invented_heat_tamyl_peroxypivalate",
|
| 822 |
+
"status": "passed",
|
| 823 |
+
"detail": null
|
| 824 |
+
},
|
| 825 |
+
{
|
| 826 |
+
"id": "unique_id_tbutyl_peroxypivalate",
|
| 827 |
+
"status": "passed",
|
| 828 |
+
"detail": null
|
| 829 |
+
},
|
| 830 |
+
{
|
| 831 |
+
"id": "unique_cas_tbutyl_peroxypivalate",
|
| 832 |
+
"status": "passed",
|
| 833 |
+
"detail": null
|
| 834 |
+
},
|
| 835 |
+
{
|
| 836 |
+
"id": "cas_format_tbutyl_peroxypivalate",
|
| 837 |
+
"status": "passed",
|
| 838 |
+
"detail": null
|
| 839 |
+
},
|
| 840 |
+
{
|
| 841 |
+
"id": "line_values_tbutyl_peroxypivalate_0",
|
| 842 |
+
"status": "passed",
|
| 843 |
+
"detail": {
|
| 844 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 845 |
+
"line": 662,
|
| 846 |
+
"text": "tert-Butyl peroxypivalate [927-07-1] 174.2 9.18 ",
|
| 847 |
+
"A": "7.09E+14",
|
| 848 |
+
"Ea": 123.59,
|
| 849 |
+
"temps_C": [
|
| 850 |
+
94,
|
| 851 |
+
75,
|
| 852 |
+
57
|
| 853 |
+
]
|
| 854 |
+
}
|
| 855 |
+
},
|
| 856 |
+
{
|
| 857 |
+
"id": "name_block_tbutyl_peroxypivalate_0",
|
| 858 |
+
"status": "passed",
|
| 859 |
+
"detail": {
|
| 860 |
+
"cas": "927-07-1"
|
| 861 |
+
}
|
| 862 |
+
},
|
| 863 |
+
{
|
| 864 |
+
"id": "half_life_consistency_tbutyl_peroxypivalate_0",
|
| 865 |
+
"status": "passed",
|
| 866 |
+
"detail": 0.491
|
| 867 |
+
},
|
| 868 |
+
{
|
| 869 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_peroxypivalate",
|
| 870 |
+
"status": "passed",
|
| 871 |
+
"detail": null
|
| 872 |
+
},
|
| 873 |
+
{
|
| 874 |
+
"id": "no_invented_heat_tbutyl_peroxypivalate",
|
| 875 |
+
"status": "passed",
|
| 876 |
+
"detail": null
|
| 877 |
+
},
|
| 878 |
+
{
|
| 879 |
+
"id": "unique_id_di_3_5_5_trimethylhexanoyl_peroxide",
|
| 880 |
+
"status": "passed",
|
| 881 |
+
"detail": null
|
| 882 |
+
},
|
| 883 |
+
{
|
| 884 |
+
"id": "unique_cas_di_3_5_5_trimethylhexanoyl_peroxide",
|
| 885 |
+
"status": "passed",
|
| 886 |
+
"detail": null
|
| 887 |
+
},
|
| 888 |
+
{
|
| 889 |
+
"id": "cas_format_di_3_5_5_trimethylhexanoyl_peroxide",
|
| 890 |
+
"status": "passed",
|
| 891 |
+
"detail": null
|
| 892 |
+
},
|
| 893 |
+
{
|
| 894 |
+
"id": "line_values_di_3_5_5_trimethylhexanoyl_peroxide_0",
|
| 895 |
+
"status": "passed",
|
| 896 |
+
"detail": {
|
| 897 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 898 |
+
"line": 672,
|
| 899 |
+
"text": "Di(3,5,5-trimethylhexanoyl) peroxide [3851-87-4] 314.5 5.09 ",
|
| 900 |
+
"A": "2.84E+15",
|
| 901 |
+
"Ea": 128.34,
|
| 902 |
+
"temps_C": [
|
| 903 |
+
96,
|
| 904 |
+
77,
|
| 905 |
+
59
|
| 906 |
+
]
|
| 907 |
+
}
|
| 908 |
+
},
|
| 909 |
+
{
|
| 910 |
+
"id": "name_block_di_3_5_5_trimethylhexanoyl_peroxide_0",
|
| 911 |
+
"status": "passed",
|
| 912 |
+
"detail": {
|
| 913 |
+
"cas": "3851-87-4"
|
| 914 |
+
}
|
| 915 |
+
},
|
| 916 |
+
{
|
| 917 |
+
"id": "half_life_consistency_di_3_5_5_trimethylhexanoyl_peroxide_0",
|
| 918 |
+
"status": "passed",
|
| 919 |
+
"detail": 0.491
|
| 920 |
+
},
|
| 921 |
+
{
|
| 922 |
+
"id": "primary_kinetics_is_a_measurement_di_3_5_5_trimethylhexanoyl_peroxide",
|
| 923 |
+
"status": "passed",
|
| 924 |
+
"detail": null
|
| 925 |
+
},
|
| 926 |
+
{
|
| 927 |
+
"id": "no_invented_heat_di_3_5_5_trimethylhexanoyl_peroxide",
|
| 928 |
+
"status": "passed",
|
| 929 |
+
"detail": null
|
| 930 |
+
},
|
| 931 |
+
{
|
| 932 |
+
"id": "unique_id_dilauroyl_peroxide",
|
| 933 |
+
"status": "passed",
|
| 934 |
+
"detail": null
|
| 935 |
+
},
|
| 936 |
+
{
|
| 937 |
+
"id": "unique_cas_dilauroyl_peroxide",
|
| 938 |
+
"status": "passed",
|
| 939 |
+
"detail": null
|
| 940 |
+
},
|
| 941 |
+
{
|
| 942 |
+
"id": "cas_format_dilauroyl_peroxide",
|
| 943 |
+
"status": "passed",
|
| 944 |
+
"detail": null
|
| 945 |
+
},
|
| 946 |
+
{
|
| 947 |
+
"id": "line_values_dilauroyl_peroxide_0",
|
| 948 |
+
"status": "passed",
|
| 949 |
+
"detail": {
|
| 950 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 951 |
+
"line": 684,
|
| 952 |
+
"text": "Dilauroyl peroxide [105-74-8] 398.6 4.01 ",
|
| 953 |
+
"A": "3.92E+14",
|
| 954 |
+
"Ea": 123.37,
|
| 955 |
+
"temps_C": [
|
| 956 |
+
99,
|
| 957 |
+
79,
|
| 958 |
+
61
|
| 959 |
+
]
|
| 960 |
+
}
|
| 961 |
+
},
|
| 962 |
+
{
|
| 963 |
+
"id": "name_block_dilauroyl_peroxide_0",
|
| 964 |
+
"status": "passed",
|
| 965 |
+
"detail": {
|
| 966 |
+
"cas": "105-74-8"
|
| 967 |
+
}
|
| 968 |
+
},
|
| 969 |
+
{
|
| 970 |
+
"id": "half_life_consistency_dilauroyl_peroxide_0",
|
| 971 |
+
"status": "passed",
|
| 972 |
+
"detail": 0.491
|
| 973 |
+
},
|
| 974 |
+
{
|
| 975 |
+
"id": "primary_kinetics_is_a_measurement_dilauroyl_peroxide",
|
| 976 |
+
"status": "passed",
|
| 977 |
+
"detail": null
|
| 978 |
+
},
|
| 979 |
+
{
|
| 980 |
+
"id": "no_invented_heat_dilauroyl_peroxide",
|
| 981 |
+
"status": "passed",
|
| 982 |
+
"detail": null
|
| 983 |
+
},
|
| 984 |
+
{
|
| 985 |
+
"id": "unique_id_2_2_azodi_isobutyronitrile",
|
| 986 |
+
"status": "passed",
|
| 987 |
+
"detail": null
|
| 988 |
+
},
|
| 989 |
+
{
|
| 990 |
+
"id": "unique_cas_2_2_azodi_isobutyronitrile",
|
| 991 |
+
"status": "passed",
|
| 992 |
+
"detail": null
|
| 993 |
+
},
|
| 994 |
+
{
|
| 995 |
+
"id": "cas_format_2_2_azodi_isobutyronitrile",
|
| 996 |
+
"status": "passed",
|
| 997 |
+
"detail": null
|
| 998 |
+
},
|
| 999 |
+
{
|
| 1000 |
+
"id": "line_values_2_2_azodi_isobutyronitrile_0",
|
| 1001 |
+
"status": "passed",
|
| 1002 |
+
"detail": {
|
| 1003 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1004 |
+
"line": 693,
|
| 1005 |
+
"text": "2,2’-Azodi(isobutyronitrile) [78-67-1] 164.2 ",
|
| 1006 |
+
"A": "2.89E+15",
|
| 1007 |
+
"Ea": 130.23,
|
| 1008 |
+
"temps_C": [
|
| 1009 |
+
101,
|
| 1010 |
+
82,
|
| 1011 |
+
64
|
| 1012 |
+
]
|
| 1013 |
+
}
|
| 1014 |
+
},
|
| 1015 |
+
{
|
| 1016 |
+
"id": "name_block_2_2_azodi_isobutyronitrile_0",
|
| 1017 |
+
"status": "passed",
|
| 1018 |
+
"detail": {
|
| 1019 |
+
"cas": "78-67-1"
|
| 1020 |
+
}
|
| 1021 |
+
},
|
| 1022 |
+
{
|
| 1023 |
+
"id": "half_life_consistency_2_2_azodi_isobutyronitrile_0",
|
| 1024 |
+
"status": "passed",
|
| 1025 |
+
"detail": 0.491
|
| 1026 |
+
},
|
| 1027 |
+
{
|
| 1028 |
+
"id": "primary_kinetics_is_a_measurement_2_2_azodi_isobutyronitrile",
|
| 1029 |
+
"status": "passed",
|
| 1030 |
+
"detail": null
|
| 1031 |
+
},
|
| 1032 |
+
{
|
| 1033 |
+
"id": "no_invented_heat_2_2_azodi_isobutyronitrile",
|
| 1034 |
+
"status": "passed",
|
| 1035 |
+
"detail": null
|
| 1036 |
+
},
|
| 1037 |
+
{
|
| 1038 |
+
"id": "unique_id_di_4_methylbenzoyl_peroxide",
|
| 1039 |
+
"status": "passed",
|
| 1040 |
+
"detail": null
|
| 1041 |
+
},
|
| 1042 |
+
{
|
| 1043 |
+
"id": "unique_cas_di_4_methylbenzoyl_peroxide",
|
| 1044 |
+
"status": "passed",
|
| 1045 |
+
"detail": null
|
| 1046 |
+
},
|
| 1047 |
+
{
|
| 1048 |
+
"id": "cas_format_di_4_methylbenzoyl_peroxide",
|
| 1049 |
+
"status": "passed",
|
| 1050 |
+
"detail": null
|
| 1051 |
+
},
|
| 1052 |
+
{
|
| 1053 |
+
"id": "line_values_di_4_methylbenzoyl_peroxide_0",
|
| 1054 |
+
"status": "passed",
|
| 1055 |
+
"detail": {
|
| 1056 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 1057 |
+
"line": 829,
|
| 1058 |
+
"text": "PERKADOX PM Di(4-methylbenzoyl) peroxide VMQ 106 84 64 115.6 1.69E+13",
|
| 1059 |
+
"A": "1.69E+13",
|
| 1060 |
+
"Ea": 115.6,
|
| 1061 |
+
"temps_C": [
|
| 1062 |
+
106,
|
| 1063 |
+
84,
|
| 1064 |
+
64
|
| 1065 |
+
]
|
| 1066 |
+
}
|
| 1067 |
+
},
|
| 1068 |
+
{
|
| 1069 |
+
"id": "name_block_di_4_methylbenzoyl_peroxide_0",
|
| 1070 |
+
"status": "passed",
|
| 1071 |
+
"detail": {
|
| 1072 |
+
"cas": "895-85-2"
|
| 1073 |
+
}
|
| 1074 |
+
},
|
| 1075 |
+
{
|
| 1076 |
+
"id": "half_life_consistency_di_4_methylbenzoyl_peroxide_0",
|
| 1077 |
+
"status": "passed",
|
| 1078 |
+
"detail": 0.774
|
| 1079 |
+
},
|
| 1080 |
+
{
|
| 1081 |
+
"id": "primary_kinetics_is_a_measurement_di_4_methylbenzoyl_peroxide",
|
| 1082 |
+
"status": "passed",
|
| 1083 |
+
"detail": null
|
| 1084 |
+
},
|
| 1085 |
+
{
|
| 1086 |
+
"id": "no_invented_heat_di_4_methylbenzoyl_peroxide",
|
| 1087 |
+
"status": "passed",
|
| 1088 |
+
"detail": null
|
| 1089 |
+
},
|
| 1090 |
+
{
|
| 1091 |
+
"id": "unique_id_2_2_azodi_2_methylbutyronitrile",
|
| 1092 |
+
"status": "passed",
|
| 1093 |
+
"detail": null
|
| 1094 |
+
},
|
| 1095 |
+
{
|
| 1096 |
+
"id": "unique_cas_2_2_azodi_2_methylbutyronitrile",
|
| 1097 |
+
"status": "passed",
|
| 1098 |
+
"detail": null
|
| 1099 |
+
},
|
| 1100 |
+
{
|
| 1101 |
+
"id": "cas_format_2_2_azodi_2_methylbutyronitrile",
|
| 1102 |
+
"status": "passed",
|
| 1103 |
+
"detail": null
|
| 1104 |
+
},
|
| 1105 |
+
{
|
| 1106 |
+
"id": "line_values_2_2_azodi_2_methylbutyronitrile_0",
|
| 1107 |
+
"status": "passed",
|
| 1108 |
+
"detail": {
|
| 1109 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1110 |
+
"line": 702,
|
| 1111 |
+
"text": "2,2’-Azodi(2-methylbutyronitrile) [13472-08-7] 192.3 ",
|
| 1112 |
+
"A": "1.38E+15",
|
| 1113 |
+
"Ea": 128.93,
|
| 1114 |
+
"temps_C": [
|
| 1115 |
+
104,
|
| 1116 |
+
84,
|
| 1117 |
+
66
|
| 1118 |
+
]
|
| 1119 |
+
}
|
| 1120 |
+
},
|
| 1121 |
+
{
|
| 1122 |
+
"id": "name_block_2_2_azodi_2_methylbutyronitrile_0",
|
| 1123 |
+
"status": "passed",
|
| 1124 |
+
"detail": {
|
| 1125 |
+
"cas": "13472-08-7"
|
| 1126 |
+
}
|
| 1127 |
+
},
|
| 1128 |
+
{
|
| 1129 |
+
"id": "half_life_consistency_2_2_azodi_2_methylbutyronitrile_0",
|
| 1130 |
+
"status": "passed",
|
| 1131 |
+
"detail": 0.774
|
| 1132 |
+
},
|
| 1133 |
+
{
|
| 1134 |
+
"id": "primary_kinetics_is_a_measurement_2_2_azodi_2_methylbutyronitrile",
|
| 1135 |
+
"status": "passed",
|
| 1136 |
+
"detail": null
|
| 1137 |
+
},
|
| 1138 |
+
{
|
| 1139 |
+
"id": "no_invented_heat_2_2_azodi_2_methylbutyronitrile",
|
| 1140 |
+
"status": "passed",
|
| 1141 |
+
"detail": null
|
| 1142 |
+
},
|
| 1143 |
+
{
|
| 1144 |
+
"id": "unique_id_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane",
|
| 1145 |
+
"status": "passed",
|
| 1146 |
+
"detail": null
|
| 1147 |
+
},
|
| 1148 |
+
{
|
| 1149 |
+
"id": "unique_cas_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane",
|
| 1150 |
+
"status": "passed",
|
| 1151 |
+
"detail": null
|
| 1152 |
+
},
|
| 1153 |
+
{
|
| 1154 |
+
"id": "cas_format_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane",
|
| 1155 |
+
"status": "passed",
|
| 1156 |
+
"detail": null
|
| 1157 |
+
},
|
| 1158 |
+
{
|
| 1159 |
+
"id": "line_values_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane_0",
|
| 1160 |
+
"status": "passed",
|
| 1161 |
+
"detail": {
|
| 1162 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1163 |
+
"line": 711,
|
| 1164 |
+
"text": "2,5-Dimethyl-2,5-di(2-ethylhexanoylperoxy)hexane [13052-09-0] 430.6 7.43 ",
|
| 1165 |
+
"A": "2.19E+15",
|
| 1166 |
+
"Ea": 130.88,
|
| 1167 |
+
"temps_C": [
|
| 1168 |
+
105,
|
| 1169 |
+
86,
|
| 1170 |
+
68
|
| 1171 |
+
]
|
| 1172 |
+
}
|
| 1173 |
+
},
|
| 1174 |
+
{
|
| 1175 |
+
"id": "name_block_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane_0",
|
| 1176 |
+
"status": "passed",
|
| 1177 |
+
"detail": {
|
| 1178 |
+
"cas": "13052-09-0"
|
| 1179 |
+
}
|
| 1180 |
+
},
|
| 1181 |
+
{
|
| 1182 |
+
"id": "half_life_consistency_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane_0",
|
| 1183 |
+
"status": "passed",
|
| 1184 |
+
"detail": 0.774
|
| 1185 |
+
},
|
| 1186 |
+
{
|
| 1187 |
+
"id": "primary_kinetics_is_a_measurement_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane",
|
| 1188 |
+
"status": "passed",
|
| 1189 |
+
"detail": null
|
| 1190 |
+
},
|
| 1191 |
+
{
|
| 1192 |
+
"id": "no_invented_heat_2_5_dimethyl_2_5_di_2_ethylhexanoylperoxy_hexane",
|
| 1193 |
+
"status": "passed",
|
| 1194 |
+
"detail": null
|
| 1195 |
+
},
|
| 1196 |
+
{
|
| 1197 |
+
"id": "unique_id_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate",
|
| 1198 |
+
"status": "passed",
|
| 1199 |
+
"detail": null
|
| 1200 |
+
},
|
| 1201 |
+
{
|
| 1202 |
+
"id": "unique_cas_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate",
|
| 1203 |
+
"status": "passed",
|
| 1204 |
+
"detail": null
|
| 1205 |
+
},
|
| 1206 |
+
{
|
| 1207 |
+
"id": "cas_format_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate",
|
| 1208 |
+
"status": "passed",
|
| 1209 |
+
"detail": null
|
| 1210 |
+
},
|
| 1211 |
+
{
|
| 1212 |
+
"id": "line_values_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate_0",
|
| 1213 |
+
"status": "passed",
|
| 1214 |
+
"detail": {
|
| 1215 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1216 |
+
"line": 742,
|
| 1217 |
+
"text": "1,1,3,3-Tetramethylbutyl peroxy-2-ethylhexanoate [22288-43-3] 272.4 5.87 109 88 ",
|
| 1218 |
+
"A": "1.62E+14",
|
| 1219 |
+
"Ea": 123.8,
|
| 1220 |
+
"temps_C": [
|
| 1221 |
+
109,
|
| 1222 |
+
88,
|
| 1223 |
+
69
|
| 1224 |
+
]
|
| 1225 |
+
}
|
| 1226 |
+
},
|
| 1227 |
+
{
|
| 1228 |
+
"id": "name_block_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate_0",
|
| 1229 |
+
"status": "passed",
|
| 1230 |
+
"detail": {
|
| 1231 |
+
"cas": "22288-43-3"
|
| 1232 |
+
}
|
| 1233 |
+
},
|
| 1234 |
+
{
|
| 1235 |
+
"id": "half_life_consistency_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate_0",
|
| 1236 |
+
"status": "passed",
|
| 1237 |
+
"detail": 0.774
|
| 1238 |
+
},
|
| 1239 |
+
{
|
| 1240 |
+
"id": "primary_kinetics_is_a_measurement_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate",
|
| 1241 |
+
"status": "passed",
|
| 1242 |
+
"detail": null
|
| 1243 |
+
},
|
| 1244 |
+
{
|
| 1245 |
+
"id": "no_invented_heat_1_1_3_3_tetramethylbutyl_peroxy_2_ethylhexanoate",
|
| 1246 |
+
"status": "passed",
|
| 1247 |
+
"detail": null
|
| 1248 |
+
},
|
| 1249 |
+
{
|
| 1250 |
+
"id": "unique_id_tamyl_peroxy_2_ethylhexanoate",
|
| 1251 |
+
"status": "passed",
|
| 1252 |
+
"detail": null
|
| 1253 |
+
},
|
| 1254 |
+
{
|
| 1255 |
+
"id": "unique_cas_tamyl_peroxy_2_ethylhexanoate",
|
| 1256 |
+
"status": "passed",
|
| 1257 |
+
"detail": null
|
| 1258 |
+
},
|
| 1259 |
+
{
|
| 1260 |
+
"id": "cas_format_tamyl_peroxy_2_ethylhexanoate",
|
| 1261 |
+
"status": "passed",
|
| 1262 |
+
"detail": null
|
| 1263 |
+
},
|
| 1264 |
+
{
|
| 1265 |
+
"id": "line_values_tamyl_peroxy_2_ethylhexanoate_0",
|
| 1266 |
+
"status": "passed",
|
| 1267 |
+
"detail": {
|
| 1268 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1269 |
+
"line": 752,
|
| 1270 |
+
"text": "tert-Amyl peroxy-2-ethylhexanoate [686-31-7] 230.3 6.95 111 91 ",
|
| 1271 |
+
"A": "1.77E+15",
|
| 1272 |
+
"Ea": 132.11,
|
| 1273 |
+
"temps_C": [
|
| 1274 |
+
111,
|
| 1275 |
+
91,
|
| 1276 |
+
73
|
| 1277 |
+
]
|
| 1278 |
+
}
|
| 1279 |
+
},
|
| 1280 |
+
{
|
| 1281 |
+
"id": "name_block_tamyl_peroxy_2_ethylhexanoate_0",
|
| 1282 |
+
"status": "passed",
|
| 1283 |
+
"detail": {
|
| 1284 |
+
"cas": "686-31-7"
|
| 1285 |
+
}
|
| 1286 |
+
},
|
| 1287 |
+
{
|
| 1288 |
+
"id": "half_life_consistency_tamyl_peroxy_2_ethylhexanoate_0",
|
| 1289 |
+
"status": "passed",
|
| 1290 |
+
"detail": 0.774
|
| 1291 |
+
},
|
| 1292 |
+
{
|
| 1293 |
+
"id": "primary_kinetics_is_a_measurement_tamyl_peroxy_2_ethylhexanoate",
|
| 1294 |
+
"status": "passed",
|
| 1295 |
+
"detail": null
|
| 1296 |
+
},
|
| 1297 |
+
{
|
| 1298 |
+
"id": "no_invented_heat_tamyl_peroxy_2_ethylhexanoate",
|
| 1299 |
+
"status": "passed",
|
| 1300 |
+
"detail": null
|
| 1301 |
+
},
|
| 1302 |
+
{
|
| 1303 |
+
"id": "unique_id_dibenzoyl_peroxide",
|
| 1304 |
+
"status": "passed",
|
| 1305 |
+
"detail": null
|
| 1306 |
+
},
|
| 1307 |
+
{
|
| 1308 |
+
"id": "unique_cas_dibenzoyl_peroxide",
|
| 1309 |
+
"status": "passed",
|
| 1310 |
+
"detail": null
|
| 1311 |
+
},
|
| 1312 |
+
{
|
| 1313 |
+
"id": "cas_format_dibenzoyl_peroxide",
|
| 1314 |
+
"status": "passed",
|
| 1315 |
+
"detail": null
|
| 1316 |
+
},
|
| 1317 |
+
{
|
| 1318 |
+
"id": "line_values_dibenzoyl_peroxide_0",
|
| 1319 |
+
"status": "passed",
|
| 1320 |
+
"detail": {
|
| 1321 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1322 |
+
"line": 762,
|
| 1323 |
+
"text": "Dibenzoyl peroxide [94-36-0] 242.2 6.61 113 91 ",
|
| 1324 |
+
"A": "6.94E+13",
|
| 1325 |
+
"Ea": 122.35,
|
| 1326 |
+
"temps_C": [
|
| 1327 |
+
113,
|
| 1328 |
+
91,
|
| 1329 |
+
71
|
| 1330 |
+
]
|
| 1331 |
+
}
|
| 1332 |
+
},
|
| 1333 |
+
{
|
| 1334 |
+
"id": "name_block_dibenzoyl_peroxide_0",
|
| 1335 |
+
"status": "passed",
|
| 1336 |
+
"detail": {
|
| 1337 |
+
"cas": "94-36-0"
|
| 1338 |
+
}
|
| 1339 |
+
},
|
| 1340 |
+
{
|
| 1341 |
+
"id": "half_life_consistency_dibenzoyl_peroxide_0",
|
| 1342 |
+
"status": "passed",
|
| 1343 |
+
"detail": 0.774
|
| 1344 |
+
},
|
| 1345 |
+
{
|
| 1346 |
+
"id": "line_values_dibenzoyl_peroxide_1",
|
| 1347 |
+
"status": "passed",
|
| 1348 |
+
"detail": {
|
| 1349 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 1350 |
+
"line": 830,
|
| 1351 |
+
"text": "PERKADOX L Dibenzoyl peroxide VMQ 106 83 63 112.5 5.97E+12",
|
| 1352 |
+
"A": "5.97E+12",
|
| 1353 |
+
"Ea": 112.5,
|
| 1354 |
+
"temps_C": [
|
| 1355 |
+
106,
|
| 1356 |
+
83,
|
| 1357 |
+
63
|
| 1358 |
+
]
|
| 1359 |
+
}
|
| 1360 |
+
},
|
| 1361 |
+
{
|
| 1362 |
+
"id": "name_block_dibenzoyl_peroxide_1",
|
| 1363 |
+
"status": "passed",
|
| 1364 |
+
"detail": {
|
| 1365 |
+
"cas": "94-36-0"
|
| 1366 |
+
}
|
| 1367 |
+
},
|
| 1368 |
+
{
|
| 1369 |
+
"id": "half_life_consistency_dibenzoyl_peroxide_1",
|
| 1370 |
+
"status": "passed",
|
| 1371 |
+
"detail": 0.774
|
| 1372 |
+
},
|
| 1373 |
+
{
|
| 1374 |
+
"id": "primary_kinetics_is_a_measurement_dibenzoyl_peroxide",
|
| 1375 |
+
"status": "passed",
|
| 1376 |
+
"detail": null
|
| 1377 |
+
},
|
| 1378 |
+
{
|
| 1379 |
+
"id": "no_invented_heat_dibenzoyl_peroxide",
|
| 1380 |
+
"status": "passed",
|
| 1381 |
+
"detail": null
|
| 1382 |
+
},
|
| 1383 |
+
{
|
| 1384 |
+
"id": "unique_id_tbutyl_peroxy_2_ethylhexanoate",
|
| 1385 |
+
"status": "passed",
|
| 1386 |
+
"detail": null
|
| 1387 |
+
},
|
| 1388 |
+
{
|
| 1389 |
+
"id": "unique_cas_tbutyl_peroxy_2_ethylhexanoate",
|
| 1390 |
+
"status": "passed",
|
| 1391 |
+
"detail": null
|
| 1392 |
+
},
|
| 1393 |
+
{
|
| 1394 |
+
"id": "cas_format_tbutyl_peroxy_2_ethylhexanoate",
|
| 1395 |
+
"status": "passed",
|
| 1396 |
+
"detail": null
|
| 1397 |
+
},
|
| 1398 |
+
{
|
| 1399 |
+
"id": "line_values_tbutyl_peroxy_2_ethylhexanoate_0",
|
| 1400 |
+
"status": "passed",
|
| 1401 |
+
"detail": {
|
| 1402 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1403 |
+
"line": 772,
|
| 1404 |
+
"text": "tert-Butyl peroxy-2-ethylhexanoate [3006-82-4] 216.3 7.40 113 91 ",
|
| 1405 |
+
"A": "1.54E+14",
|
| 1406 |
+
"Ea": 124.9,
|
| 1407 |
+
"temps_C": [
|
| 1408 |
+
113,
|
| 1409 |
+
91,
|
| 1410 |
+
72
|
| 1411 |
+
]
|
| 1412 |
+
}
|
| 1413 |
+
},
|
| 1414 |
+
{
|
| 1415 |
+
"id": "name_block_tbutyl_peroxy_2_ethylhexanoate_0",
|
| 1416 |
+
"status": "passed",
|
| 1417 |
+
"detail": {
|
| 1418 |
+
"cas": "3006-82-4"
|
| 1419 |
+
}
|
| 1420 |
+
},
|
| 1421 |
+
{
|
| 1422 |
+
"id": "half_life_consistency_tbutyl_peroxy_2_ethylhexanoate_0",
|
| 1423 |
+
"status": "passed",
|
| 1424 |
+
"detail": 0.774
|
| 1425 |
+
},
|
| 1426 |
+
{
|
| 1427 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_peroxy_2_ethylhexanoate",
|
| 1428 |
+
"status": "passed",
|
| 1429 |
+
"detail": null
|
| 1430 |
+
},
|
| 1431 |
+
{
|
| 1432 |
+
"id": "no_invented_heat_tbutyl_peroxy_2_ethylhexanoate",
|
| 1433 |
+
"status": "passed",
|
| 1434 |
+
"detail": null
|
| 1435 |
+
},
|
| 1436 |
+
{
|
| 1437 |
+
"id": "unique_id_tbutyl_peroxydiethylacetate",
|
| 1438 |
+
"status": "passed",
|
| 1439 |
+
"detail": null
|
| 1440 |
+
},
|
| 1441 |
+
{
|
| 1442 |
+
"id": "unique_cas_tbutyl_peroxydiethylacetate",
|
| 1443 |
+
"status": "passed",
|
| 1444 |
+
"detail": null
|
| 1445 |
+
},
|
| 1446 |
+
{
|
| 1447 |
+
"id": "cas_format_tbutyl_peroxydiethylacetate",
|
| 1448 |
+
"status": "passed",
|
| 1449 |
+
"detail": null
|
| 1450 |
+
},
|
| 1451 |
+
{
|
| 1452 |
+
"id": "line_values_tbutyl_peroxydiethylacetate_0",
|
| 1453 |
+
"status": "passed",
|
| 1454 |
+
"detail": {
|
| 1455 |
+
"file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf",
|
| 1456 |
+
"line": 556,
|
| 1457 |
+
"text": "tert-Butyl peroxydiethylacetate [2550-33-6] 188.3 8.50 113 93 ",
|
| 1458 |
+
"A": "2.45E+15",
|
| 1459 |
+
"Ea": 134.0,
|
| 1460 |
+
"temps_C": [
|
| 1461 |
+
113,
|
| 1462 |
+
93,
|
| 1463 |
+
75
|
| 1464 |
+
]
|
| 1465 |
+
}
|
| 1466 |
+
},
|
| 1467 |
+
{
|
| 1468 |
+
"id": "name_block_tbutyl_peroxydiethylacetate_0",
|
| 1469 |
+
"status": "passed",
|
| 1470 |
+
"detail": {
|
| 1471 |
+
"cas": "2550-33-6"
|
| 1472 |
+
}
|
| 1473 |
+
},
|
| 1474 |
+
{
|
| 1475 |
+
"id": "half_life_consistency_tbutyl_peroxydiethylacetate_0",
|
| 1476 |
+
"status": "passed",
|
| 1477 |
+
"detail": 0.774
|
| 1478 |
+
},
|
| 1479 |
+
{
|
| 1480 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_peroxydiethylacetate",
|
| 1481 |
+
"status": "passed",
|
| 1482 |
+
"detail": null
|
| 1483 |
+
},
|
| 1484 |
+
{
|
| 1485 |
+
"id": "no_invented_heat_tbutyl_peroxydiethylacetate",
|
| 1486 |
+
"status": "passed",
|
| 1487 |
+
"detail": null
|
| 1488 |
+
},
|
| 1489 |
+
{
|
| 1490 |
+
"id": "unique_id_tbutyl_peroxyisobutyrate",
|
| 1491 |
+
"status": "passed",
|
| 1492 |
+
"detail": null
|
| 1493 |
+
},
|
| 1494 |
+
{
|
| 1495 |
+
"id": "unique_cas_tbutyl_peroxyisobutyrate",
|
| 1496 |
+
"status": "passed",
|
| 1497 |
+
"detail": null
|
| 1498 |
+
},
|
| 1499 |
+
{
|
| 1500 |
+
"id": "cas_format_tbutyl_peroxyisobutyrate",
|
| 1501 |
+
"status": "passed",
|
| 1502 |
+
"detail": null
|
| 1503 |
+
},
|
| 1504 |
+
{
|
| 1505 |
+
"id": "line_values_tbutyl_peroxyisobutyrate_0",
|
| 1506 |
+
"status": "passed",
|
| 1507 |
+
"detail": {
|
| 1508 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1509 |
+
"line": 782,
|
| 1510 |
+
"text": "tert-Butyl peroxyisobutyrate [109-13-7] 160.2 9.99 118 98 ",
|
| 1511 |
+
"A": "2.07E+15",
|
| 1512 |
+
"Ea": 135.16,
|
| 1513 |
+
"temps_C": [
|
| 1514 |
+
118,
|
| 1515 |
+
98,
|
| 1516 |
+
79
|
| 1517 |
+
]
|
| 1518 |
+
}
|
| 1519 |
+
},
|
| 1520 |
+
{
|
| 1521 |
+
"id": "name_block_tbutyl_peroxyisobutyrate_0",
|
| 1522 |
+
"status": "passed",
|
| 1523 |
+
"detail": {
|
| 1524 |
+
"cas": "109-13-7"
|
| 1525 |
+
}
|
| 1526 |
+
},
|
| 1527 |
+
{
|
| 1528 |
+
"id": "half_life_consistency_tbutyl_peroxyisobutyrate_0",
|
| 1529 |
+
"status": "passed",
|
| 1530 |
+
"detail": 0.774
|
| 1531 |
+
},
|
| 1532 |
+
{
|
| 1533 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_peroxyisobutyrate",
|
| 1534 |
+
"status": "passed",
|
| 1535 |
+
"detail": null
|
| 1536 |
+
},
|
| 1537 |
+
{
|
| 1538 |
+
"id": "no_invented_heat_tbutyl_peroxyisobutyrate",
|
| 1539 |
+
"status": "passed",
|
| 1540 |
+
"detail": null
|
| 1541 |
+
},
|
| 1542 |
+
{
|
| 1543 |
+
"id": "unique_id_1_1_azodi_hexahydrobenzonitrile",
|
| 1544 |
+
"status": "passed",
|
| 1545 |
+
"detail": null
|
| 1546 |
+
},
|
| 1547 |
+
{
|
| 1548 |
+
"id": "unique_cas_1_1_azodi_hexahydrobenzonitrile",
|
| 1549 |
+
"status": "passed",
|
| 1550 |
+
"detail": null
|
| 1551 |
+
},
|
| 1552 |
+
{
|
| 1553 |
+
"id": "cas_format_1_1_azodi_hexahydrobenzonitrile",
|
| 1554 |
+
"status": "passed",
|
| 1555 |
+
"detail": null
|
| 1556 |
+
},
|
| 1557 |
+
{
|
| 1558 |
+
"id": "line_values_1_1_azodi_hexahydrobenzonitrile_0",
|
| 1559 |
+
"status": "passed",
|
| 1560 |
+
"detail": {
|
| 1561 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1562 |
+
"line": 806,
|
| 1563 |
+
"text": "1,1’-Azodi(hexahydrobenzonitrile) [2094-98-6] 244.3 ",
|
| 1564 |
+
"A": "1.10E+16",
|
| 1565 |
+
"Ea": 142.19,
|
| 1566 |
+
"temps_C": [
|
| 1567 |
+
123,
|
| 1568 |
+
103,
|
| 1569 |
+
85
|
| 1570 |
+
]
|
| 1571 |
+
}
|
| 1572 |
+
},
|
| 1573 |
+
{
|
| 1574 |
+
"id": "name_block_1_1_azodi_hexahydrobenzonitrile_0",
|
| 1575 |
+
"status": "passed",
|
| 1576 |
+
"detail": {
|
| 1577 |
+
"cas": "2094-98-6"
|
| 1578 |
+
}
|
| 1579 |
+
},
|
| 1580 |
+
{
|
| 1581 |
+
"id": "half_life_consistency_1_1_azodi_hexahydrobenzonitrile_0",
|
| 1582 |
+
"status": "passed",
|
| 1583 |
+
"detail": 0.774
|
| 1584 |
+
},
|
| 1585 |
+
{
|
| 1586 |
+
"id": "line_values_1_1_azodi_hexahydrobenzonitrile_1",
|
| 1587 |
+
"status": "passed",
|
| 1588 |
+
"detail": {
|
| 1589 |
+
"file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf",
|
| 1590 |
+
"line": 579,
|
| 1591 |
+
"text": "1,1’-Azodi(hexahydrobenzonitrile) [2094-98-6] 244.3 ",
|
| 1592 |
+
"A": "1.10E+16",
|
| 1593 |
+
"Ea": 142.0,
|
| 1594 |
+
"temps_C": [
|
| 1595 |
+
123,
|
| 1596 |
+
103,
|
| 1597 |
+
85
|
| 1598 |
+
]
|
| 1599 |
+
}
|
| 1600 |
+
},
|
| 1601 |
+
{
|
| 1602 |
+
"id": "name_block_1_1_azodi_hexahydrobenzonitrile_1",
|
| 1603 |
+
"status": "passed",
|
| 1604 |
+
"detail": {
|
| 1605 |
+
"cas": "2094-98-6"
|
| 1606 |
+
}
|
| 1607 |
+
},
|
| 1608 |
+
{
|
| 1609 |
+
"id": "half_life_consistency_1_1_azodi_hexahydrobenzonitrile_1",
|
| 1610 |
+
"status": "passed",
|
| 1611 |
+
"detail": 0.814
|
| 1612 |
+
},
|
| 1613 |
+
{
|
| 1614 |
+
"id": "primary_kinetics_is_a_measurement_1_1_azodi_hexahydrobenzonitrile",
|
| 1615 |
+
"status": "passed",
|
| 1616 |
+
"detail": null
|
| 1617 |
+
},
|
| 1618 |
+
{
|
| 1619 |
+
"id": "no_invented_heat_1_1_azodi_hexahydrobenzonitrile",
|
| 1620 |
+
"status": "passed",
|
| 1621 |
+
"detail": null
|
| 1622 |
+
},
|
| 1623 |
+
{
|
| 1624 |
+
"id": "unique_id_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane",
|
| 1625 |
+
"status": "passed",
|
| 1626 |
+
"detail": null
|
| 1627 |
+
},
|
| 1628 |
+
{
|
| 1629 |
+
"id": "unique_cas_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane",
|
| 1630 |
+
"status": "passed",
|
| 1631 |
+
"detail": null
|
| 1632 |
+
},
|
| 1633 |
+
{
|
| 1634 |
+
"id": "cas_format_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane",
|
| 1635 |
+
"status": "passed",
|
| 1636 |
+
"detail": null
|
| 1637 |
+
},
|
| 1638 |
+
{
|
| 1639 |
+
"id": "line_values_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_0",
|
| 1640 |
+
"status": "passed",
|
| 1641 |
+
"detail": {
|
| 1642 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1643 |
+
"line": 825,
|
| 1644 |
+
"text": "1,1-Di(tert-butylperoxy)-3,3,5-trimethylcyclohexane [6731-36-8] 302.5 10.58 ",
|
| 1645 |
+
"A": "7.59E+13",
|
| 1646 |
+
"Ea": 127.52,
|
| 1647 |
+
"temps_C": [
|
| 1648 |
+
128,
|
| 1649 |
+
105,
|
| 1650 |
+
85
|
| 1651 |
+
]
|
| 1652 |
+
}
|
| 1653 |
+
},
|
| 1654 |
+
{
|
| 1655 |
+
"id": "name_block_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_0",
|
| 1656 |
+
"status": "passed",
|
| 1657 |
+
"detail": {
|
| 1658 |
+
"cas": "6731-36-8"
|
| 1659 |
+
}
|
| 1660 |
+
},
|
| 1661 |
+
{
|
| 1662 |
+
"id": "half_life_consistency_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_0",
|
| 1663 |
+
"status": "passed",
|
| 1664 |
+
"detail": 0.814
|
| 1665 |
+
},
|
| 1666 |
+
{
|
| 1667 |
+
"id": "line_values_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_1",
|
| 1668 |
+
"status": "passed",
|
| 1669 |
+
"detail": {
|
| 1670 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 1671 |
+
"line": 827,
|
| 1672 |
+
"text": "TRIGONOX 29 1,1-Di(tert-butylperoxy)-3,3,5-trimethylcyclohexane EPDM 135 111 89 124.5 1.69E+13",
|
| 1673 |
+
"A": "1.69E+13",
|
| 1674 |
+
"Ea": 124.5,
|
| 1675 |
+
"temps_C": [
|
| 1676 |
+
135,
|
| 1677 |
+
111,
|
| 1678 |
+
89
|
| 1679 |
+
]
|
| 1680 |
+
}
|
| 1681 |
+
},
|
| 1682 |
+
{
|
| 1683 |
+
"id": "name_block_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_1",
|
| 1684 |
+
"status": "passed",
|
| 1685 |
+
"detail": {
|
| 1686 |
+
"cas": "6731-36-8"
|
| 1687 |
+
}
|
| 1688 |
+
},
|
| 1689 |
+
{
|
| 1690 |
+
"id": "half_life_consistency_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane_1",
|
| 1691 |
+
"status": "passed",
|
| 1692 |
+
"detail": 0.814
|
| 1693 |
+
},
|
| 1694 |
+
{
|
| 1695 |
+
"id": "primary_kinetics_is_a_measurement_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane",
|
| 1696 |
+
"status": "passed",
|
| 1697 |
+
"detail": null
|
| 1698 |
+
},
|
| 1699 |
+
{
|
| 1700 |
+
"id": "no_invented_heat_1_1_di_tbutylperoxy_3_3_5_trimethylcyclohexane",
|
| 1701 |
+
"status": "passed",
|
| 1702 |
+
"detail": null
|
| 1703 |
+
},
|
| 1704 |
+
{
|
| 1705 |
+
"id": "unique_id_1_1_di_tamylperoxy_cyclohexane",
|
| 1706 |
+
"status": "passed",
|
| 1707 |
+
"detail": null
|
| 1708 |
+
},
|
| 1709 |
+
{
|
| 1710 |
+
"id": "unique_cas_1_1_di_tamylperoxy_cyclohexane",
|
| 1711 |
+
"status": "passed",
|
| 1712 |
+
"detail": null
|
| 1713 |
+
},
|
| 1714 |
+
{
|
| 1715 |
+
"id": "cas_format_1_1_di_tamylperoxy_cyclohexane",
|
| 1716 |
+
"status": "passed",
|
| 1717 |
+
"detail": null
|
| 1718 |
+
},
|
| 1719 |
+
{
|
| 1720 |
+
"id": "line_values_1_1_di_tamylperoxy_cyclohexane_0",
|
| 1721 |
+
"status": "passed",
|
| 1722 |
+
"detail": {
|
| 1723 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1724 |
+
"line": 814,
|
| 1725 |
+
"text": "1,1-Di(tert-amylperoxy)cyclohexane [15667-10-4] 288.4 11.09 ",
|
| 1726 |
+
"A": "3.29E+15",
|
| 1727 |
+
"Ea": 139.46,
|
| 1728 |
+
"temps_C": [
|
| 1729 |
+
126,
|
| 1730 |
+
106,
|
| 1731 |
+
87
|
| 1732 |
+
]
|
| 1733 |
+
}
|
| 1734 |
+
},
|
| 1735 |
+
{
|
| 1736 |
+
"id": "name_block_1_1_di_tamylperoxy_cyclohexane_0",
|
| 1737 |
+
"status": "passed",
|
| 1738 |
+
"detail": {
|
| 1739 |
+
"cas": "15667-10-4"
|
| 1740 |
+
}
|
| 1741 |
+
},
|
| 1742 |
+
{
|
| 1743 |
+
"id": "half_life_consistency_1_1_di_tamylperoxy_cyclohexane_0",
|
| 1744 |
+
"status": "passed",
|
| 1745 |
+
"detail": 0.814
|
| 1746 |
+
},
|
| 1747 |
+
{
|
| 1748 |
+
"id": "primary_kinetics_is_a_measurement_1_1_di_tamylperoxy_cyclohexane",
|
| 1749 |
+
"status": "passed",
|
| 1750 |
+
"detail": null
|
| 1751 |
+
},
|
| 1752 |
+
{
|
| 1753 |
+
"id": "no_invented_heat_1_1_di_tamylperoxy_cyclohexane",
|
| 1754 |
+
"status": "passed",
|
| 1755 |
+
"detail": null
|
| 1756 |
+
},
|
| 1757 |
+
{
|
| 1758 |
+
"id": "unique_id_1_1_di_tbutylperoxy_cyclohexane",
|
| 1759 |
+
"status": "passed",
|
| 1760 |
+
"detail": null
|
| 1761 |
+
},
|
| 1762 |
+
{
|
| 1763 |
+
"id": "unique_cas_1_1_di_tbutylperoxy_cyclohexane",
|
| 1764 |
+
"status": "passed",
|
| 1765 |
+
"detail": null
|
| 1766 |
+
},
|
| 1767 |
+
{
|
| 1768 |
+
"id": "cas_format_1_1_di_tbutylperoxy_cyclohexane",
|
| 1769 |
+
"status": "passed",
|
| 1770 |
+
"detail": null
|
| 1771 |
+
},
|
| 1772 |
+
{
|
| 1773 |
+
"id": "line_values_1_1_di_tbutylperoxy_cyclohexane_0",
|
| 1774 |
+
"status": "passed",
|
| 1775 |
+
"detail": {
|
| 1776 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1777 |
+
"line": 839,
|
| 1778 |
+
"text": "1,1-Di(tert-butylperoxy)cyclohexane [3006-86-8] 260.4 12.29 ",
|
| 1779 |
+
"A": "3.47E+15",
|
| 1780 |
+
"Ea": 142.4,
|
| 1781 |
+
"temps_C": [
|
| 1782 |
+
134,
|
| 1783 |
+
113,
|
| 1784 |
+
94
|
| 1785 |
+
]
|
| 1786 |
+
}
|
| 1787 |
+
},
|
| 1788 |
+
{
|
| 1789 |
+
"id": "name_block_1_1_di_tbutylperoxy_cyclohexane_0",
|
| 1790 |
+
"status": "passed",
|
| 1791 |
+
"detail": {
|
| 1792 |
+
"cas": "3006-86-8"
|
| 1793 |
+
}
|
| 1794 |
+
},
|
| 1795 |
+
{
|
| 1796 |
+
"id": "half_life_consistency_1_1_di_tbutylperoxy_cyclohexane_0",
|
| 1797 |
+
"status": "passed",
|
| 1798 |
+
"detail": 0.814
|
| 1799 |
+
},
|
| 1800 |
+
{
|
| 1801 |
+
"id": "primary_kinetics_is_a_measurement_1_1_di_tbutylperoxy_cyclohexane",
|
| 1802 |
+
"status": "passed",
|
| 1803 |
+
"detail": null
|
| 1804 |
+
},
|
| 1805 |
+
{
|
| 1806 |
+
"id": "no_invented_heat_1_1_di_tbutylperoxy_cyclohexane",
|
| 1807 |
+
"status": "passed",
|
| 1808 |
+
"detail": null
|
| 1809 |
+
},
|
| 1810 |
+
{
|
| 1811 |
+
"id": "unique_id_tamylperoxy_2_ethylhexyl_carbonate",
|
| 1812 |
+
"status": "passed",
|
| 1813 |
+
"detail": null
|
| 1814 |
+
},
|
| 1815 |
+
{
|
| 1816 |
+
"id": "unique_cas_tamylperoxy_2_ethylhexyl_carbonate",
|
| 1817 |
+
"status": "passed",
|
| 1818 |
+
"detail": null
|
| 1819 |
+
},
|
| 1820 |
+
{
|
| 1821 |
+
"id": "cas_format_tamylperoxy_2_ethylhexyl_carbonate",
|
| 1822 |
+
"status": "passed",
|
| 1823 |
+
"detail": null
|
| 1824 |
+
},
|
| 1825 |
+
{
|
| 1826 |
+
"id": "line_values_tamylperoxy_2_ethylhexyl_carbonate_0",
|
| 1827 |
+
"status": "passed",
|
| 1828 |
+
"detail": {
|
| 1829 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1830 |
+
"line": 850,
|
| 1831 |
+
"text": "tert-Amylperoxy 2-ethylhexyl carbonate [70833-40-8] 260.4 6.14 ",
|
| 1832 |
+
"A": "2.22E+16",
|
| 1833 |
+
"Ea": 148.41,
|
| 1834 |
+
"temps_C": [
|
| 1835 |
+
134,
|
| 1836 |
+
113,
|
| 1837 |
+
95
|
| 1838 |
+
]
|
| 1839 |
+
}
|
| 1840 |
+
},
|
| 1841 |
+
{
|
| 1842 |
+
"id": "name_block_tamylperoxy_2_ethylhexyl_carbonate_0",
|
| 1843 |
+
"status": "passed",
|
| 1844 |
+
"detail": {
|
| 1845 |
+
"cas": "70833-40-8"
|
| 1846 |
+
}
|
| 1847 |
+
},
|
| 1848 |
+
{
|
| 1849 |
+
"id": "half_life_consistency_tamylperoxy_2_ethylhexyl_carbonate_0",
|
| 1850 |
+
"status": "passed",
|
| 1851 |
+
"detail": 0.814
|
| 1852 |
+
},
|
| 1853 |
+
{
|
| 1854 |
+
"id": "line_values_tamylperoxy_2_ethylhexyl_carbonate_1",
|
| 1855 |
+
"status": "passed",
|
| 1856 |
+
"detail": {
|
| 1857 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 1858 |
+
"line": 828,
|
| 1859 |
+
"text": "TRIGONOX 131 tert-amylperoxy 2-ethylhexyl carbonate EVA 129 103 80 112.1 7.29E+11",
|
| 1860 |
+
"A": "7.29E+11",
|
| 1861 |
+
"Ea": 112.1,
|
| 1862 |
+
"temps_C": [
|
| 1863 |
+
129,
|
| 1864 |
+
103,
|
| 1865 |
+
80
|
| 1866 |
+
]
|
| 1867 |
+
}
|
| 1868 |
+
},
|
| 1869 |
+
{
|
| 1870 |
+
"id": "name_block_tamylperoxy_2_ethylhexyl_carbonate_1",
|
| 1871 |
+
"status": "passed",
|
| 1872 |
+
"detail": {
|
| 1873 |
+
"cas": "70833-40-8"
|
| 1874 |
+
}
|
| 1875 |
+
},
|
| 1876 |
+
{
|
| 1877 |
+
"id": "half_life_consistency_tamylperoxy_2_ethylhexyl_carbonate_1",
|
| 1878 |
+
"status": "passed",
|
| 1879 |
+
"detail": 0.814
|
| 1880 |
+
},
|
| 1881 |
+
{
|
| 1882 |
+
"id": "primary_kinetics_is_a_measurement_tamylperoxy_2_ethylhexyl_carbonate",
|
| 1883 |
+
"status": "passed",
|
| 1884 |
+
"detail": null
|
| 1885 |
+
},
|
| 1886 |
+
{
|
| 1887 |
+
"id": "no_invented_heat_tamylperoxy_2_ethylhexyl_carbonate",
|
| 1888 |
+
"status": "passed",
|
| 1889 |
+
"detail": null
|
| 1890 |
+
},
|
| 1891 |
+
{
|
| 1892 |
+
"id": "unique_id_tbutyl_peroxy_3_5_5_trimethylhexanoate",
|
| 1893 |
+
"status": "passed",
|
| 1894 |
+
"detail": null
|
| 1895 |
+
},
|
| 1896 |
+
{
|
| 1897 |
+
"id": "unique_cas_tbutyl_peroxy_3_5_5_trimethylhexanoate",
|
| 1898 |
+
"status": "passed",
|
| 1899 |
+
"detail": null
|
| 1900 |
+
},
|
| 1901 |
+
{
|
| 1902 |
+
"id": "cas_format_tbutyl_peroxy_3_5_5_trimethylhexanoate",
|
| 1903 |
+
"status": "passed",
|
| 1904 |
+
"detail": null
|
| 1905 |
+
},
|
| 1906 |
+
{
|
| 1907 |
+
"id": "line_values_tbutyl_peroxy_3_5_5_trimethylhexanoate_0",
|
| 1908 |
+
"status": "passed",
|
| 1909 |
+
"detail": {
|
| 1910 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 1911 |
+
"line": 860,
|
| 1912 |
+
"text": "tert-Butyl peroxy-3,5,5-trimethylhexanoate [13122-18-4] 230.3 6.95 ",
|
| 1913 |
+
"A": "1.94E+15",
|
| 1914 |
+
"Ea": 140.78,
|
| 1915 |
+
"temps_C": [
|
| 1916 |
+
135,
|
| 1917 |
+
114,
|
| 1918 |
+
94
|
| 1919 |
+
]
|
| 1920 |
+
}
|
| 1921 |
+
},
|
| 1922 |
+
{
|
| 1923 |
+
"id": "name_block_tbutyl_peroxy_3_5_5_trimethylhexanoate_0",
|
| 1924 |
+
"status": "passed",
|
| 1925 |
+
"detail": {
|
| 1926 |
+
"cas": "13122-18-4"
|
| 1927 |
+
}
|
| 1928 |
+
},
|
| 1929 |
+
{
|
| 1930 |
+
"id": "half_life_consistency_tbutyl_peroxy_3_5_5_trimethylhexanoate_0",
|
| 1931 |
+
"status": "passed",
|
| 1932 |
+
"detail": 0.814
|
| 1933 |
+
},
|
| 1934 |
+
{
|
| 1935 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_peroxy_3_5_5_trimethylhexanoate",
|
| 1936 |
+
"status": "passed",
|
| 1937 |
+
"detail": null
|
| 1938 |
+
},
|
| 1939 |
+
{
|
| 1940 |
+
"id": "no_invented_heat_tbutyl_peroxy_3_5_5_trimethylhexanoate",
|
| 1941 |
+
"status": "passed",
|
| 1942 |
+
"detail": null
|
| 1943 |
+
},
|
| 1944 |
+
{
|
| 1945 |
+
"id": "unique_id_tamyl_peroxyacetate",
|
| 1946 |
+
"status": "passed",
|
| 1947 |
+
"detail": null
|
| 1948 |
+
},
|
| 1949 |
+
{
|
| 1950 |
+
"id": "unique_cas_tamyl_peroxyacetate",
|
| 1951 |
+
"status": "passed",
|
| 1952 |
+
"detail": null
|
| 1953 |
+
},
|
| 1954 |
+
{
|
| 1955 |
+
"id": "cas_format_tamyl_peroxyacetate",
|
| 1956 |
+
"status": "passed",
|
| 1957 |
+
"detail": null
|
| 1958 |
+
},
|
| 1959 |
+
{
|
| 1960 |
+
"id": "line_values_tamyl_peroxyacetate_0",
|
| 1961 |
+
"status": "passed",
|
| 1962 |
+
"detail": {
|
| 1963 |
+
"file": "nouryon_brochure-initiators-for-acrylics-manufacturing-en_us.pdf",
|
| 1964 |
+
"line": 634,
|
| 1965 |
+
"text": "tert-Amyl peroxyacetate [690-83-5] 146.2 10.94 ",
|
| 1966 |
+
"A": "6.59E+16",
|
| 1967 |
+
"Ea": 152.16,
|
| 1968 |
+
"temps_C": [
|
| 1969 |
+
134,
|
| 1970 |
+
114,
|
| 1971 |
+
96
|
| 1972 |
+
]
|
| 1973 |
+
}
|
| 1974 |
+
},
|
| 1975 |
+
{
|
| 1976 |
+
"id": "name_block_tamyl_peroxyacetate_0",
|
| 1977 |
+
"status": "passed",
|
| 1978 |
+
"detail": {
|
| 1979 |
+
"cas": "690-83-5"
|
| 1980 |
+
}
|
| 1981 |
+
},
|
| 1982 |
+
{
|
| 1983 |
+
"id": "half_life_consistency_tamyl_peroxyacetate_0",
|
| 1984 |
+
"status": "passed",
|
| 1985 |
+
"detail": 0.814
|
| 1986 |
+
},
|
| 1987 |
+
{
|
| 1988 |
+
"id": "primary_kinetics_is_a_measurement_tamyl_peroxyacetate",
|
| 1989 |
+
"status": "passed",
|
| 1990 |
+
"detail": null
|
| 1991 |
+
},
|
| 1992 |
+
{
|
| 1993 |
+
"id": "no_invented_heat_tamyl_peroxyacetate",
|
| 1994 |
+
"status": "passed",
|
| 1995 |
+
"detail": null
|
| 1996 |
+
},
|
| 1997 |
+
{
|
| 1998 |
+
"id": "unique_id_2_2_di_tbutylperoxy_butane",
|
| 1999 |
+
"status": "passed",
|
| 2000 |
+
"detail": null
|
| 2001 |
+
},
|
| 2002 |
+
{
|
| 2003 |
+
"id": "unique_cas_2_2_di_tbutylperoxy_butane",
|
| 2004 |
+
"status": "passed",
|
| 2005 |
+
"detail": null
|
| 2006 |
+
},
|
| 2007 |
+
{
|
| 2008 |
+
"id": "cas_format_2_2_di_tbutylperoxy_butane",
|
| 2009 |
+
"status": "passed",
|
| 2010 |
+
"detail": null
|
| 2011 |
+
},
|
| 2012 |
+
{
|
| 2013 |
+
"id": "line_values_2_2_di_tbutylperoxy_butane_0",
|
| 2014 |
+
"status": "passed",
|
| 2015 |
+
"detail": {
|
| 2016 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2017 |
+
"line": 884,
|
| 2018 |
+
"text": "2,2-Di(tert-butylperoxy)butane [2167-23-9] 234.3 13.66 136 ",
|
| 2019 |
+
"A": "9.30E+16",
|
| 2020 |
+
"Ea": 154.08,
|
| 2021 |
+
"temps_C": [
|
| 2022 |
+
136,
|
| 2023 |
+
116,
|
| 2024 |
+
98
|
| 2025 |
+
]
|
| 2026 |
+
}
|
| 2027 |
+
},
|
| 2028 |
+
{
|
| 2029 |
+
"id": "name_block_2_2_di_tbutylperoxy_butane_0",
|
| 2030 |
+
"status": "passed",
|
| 2031 |
+
"detail": {
|
| 2032 |
+
"cas": "2167-23-9"
|
| 2033 |
+
}
|
| 2034 |
+
},
|
| 2035 |
+
{
|
| 2036 |
+
"id": "half_life_consistency_2_2_di_tbutylperoxy_butane_0",
|
| 2037 |
+
"status": "passed",
|
| 2038 |
+
"detail": 0.814
|
| 2039 |
+
},
|
| 2040 |
+
{
|
| 2041 |
+
"id": "primary_kinetics_is_a_measurement_2_2_di_tbutylperoxy_butane",
|
| 2042 |
+
"status": "passed",
|
| 2043 |
+
"detail": null
|
| 2044 |
+
},
|
| 2045 |
+
{
|
| 2046 |
+
"id": "no_invented_heat_2_2_di_tbutylperoxy_butane",
|
| 2047 |
+
"status": "passed",
|
| 2048 |
+
"detail": null
|
| 2049 |
+
},
|
| 2050 |
+
{
|
| 2051 |
+
"id": "unique_id_tbutylperoxy_2_ethylhexyl_carbonate",
|
| 2052 |
+
"status": "passed",
|
| 2053 |
+
"detail": null
|
| 2054 |
+
},
|
| 2055 |
+
{
|
| 2056 |
+
"id": "unique_cas_tbutylperoxy_2_ethylhexyl_carbonate",
|
| 2057 |
+
"status": "passed",
|
| 2058 |
+
"detail": null
|
| 2059 |
+
},
|
| 2060 |
+
{
|
| 2061 |
+
"id": "cas_format_tbutylperoxy_2_ethylhexyl_carbonate",
|
| 2062 |
+
"status": "passed",
|
| 2063 |
+
"detail": null
|
| 2064 |
+
},
|
| 2065 |
+
{
|
| 2066 |
+
"id": "line_values_tbutylperoxy_2_ethylhexyl_carbonate_0",
|
| 2067 |
+
"status": "passed",
|
| 2068 |
+
"detail": {
|
| 2069 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2070 |
+
"line": 904,
|
| 2071 |
+
"text": "tert-Butylperoxy 2-ethylhexyl carbonate [34443-12-4] 246.3 6.49 137 ",
|
| 2072 |
+
"A": "4.07E+16",
|
| 2073 |
+
"Ea": 151.72,
|
| 2074 |
+
"temps_C": [
|
| 2075 |
+
137,
|
| 2076 |
+
117,
|
| 2077 |
+
98
|
| 2078 |
+
]
|
| 2079 |
+
}
|
| 2080 |
+
},
|
| 2081 |
+
{
|
| 2082 |
+
"id": "name_block_tbutylperoxy_2_ethylhexyl_carbonate_0",
|
| 2083 |
+
"status": "passed",
|
| 2084 |
+
"detail": {
|
| 2085 |
+
"cas": "34443-12-4"
|
| 2086 |
+
}
|
| 2087 |
+
},
|
| 2088 |
+
{
|
| 2089 |
+
"id": "half_life_consistency_tbutylperoxy_2_ethylhexyl_carbonate_0",
|
| 2090 |
+
"status": "passed",
|
| 2091 |
+
"detail": 0.814
|
| 2092 |
+
},
|
| 2093 |
+
{
|
| 2094 |
+
"id": "line_values_tbutylperoxy_2_ethylhexyl_carbonate_1",
|
| 2095 |
+
"status": "passed",
|
| 2096 |
+
"detail": {
|
| 2097 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2098 |
+
"line": 826,
|
| 2099 |
+
"text": "TRIGONOX 117 tert-Butylperoxy 2-ethylhexyl carbonate EVA 139 114 92 124.0 1.04E+13",
|
| 2100 |
+
"A": "1.04E+13",
|
| 2101 |
+
"Ea": 124.0,
|
| 2102 |
+
"temps_C": [
|
| 2103 |
+
139,
|
| 2104 |
+
114,
|
| 2105 |
+
92
|
| 2106 |
+
]
|
| 2107 |
+
}
|
| 2108 |
+
},
|
| 2109 |
+
{
|
| 2110 |
+
"id": "name_block_tbutylperoxy_2_ethylhexyl_carbonate_1",
|
| 2111 |
+
"status": "passed",
|
| 2112 |
+
"detail": {
|
| 2113 |
+
"cas": "34443-12-4"
|
| 2114 |
+
}
|
| 2115 |
+
},
|
| 2116 |
+
{
|
| 2117 |
+
"id": "half_life_consistency_tbutylperoxy_2_ethylhexyl_carbonate_1",
|
| 2118 |
+
"status": "passed",
|
| 2119 |
+
"detail": 0.814
|
| 2120 |
+
},
|
| 2121 |
+
{
|
| 2122 |
+
"id": "primary_kinetics_is_a_measurement_tbutylperoxy_2_ethylhexyl_carbonate",
|
| 2123 |
+
"status": "passed",
|
| 2124 |
+
"detail": null
|
| 2125 |
+
},
|
| 2126 |
+
{
|
| 2127 |
+
"id": "no_invented_heat_tbutylperoxy_2_ethylhexyl_carbonate",
|
| 2128 |
+
"status": "passed",
|
| 2129 |
+
"detail": null
|
| 2130 |
+
},
|
| 2131 |
+
{
|
| 2132 |
+
"id": "unique_id_tbutylperoxy_isopropyl_carbonate",
|
| 2133 |
+
"status": "passed",
|
| 2134 |
+
"detail": null
|
| 2135 |
+
},
|
| 2136 |
+
{
|
| 2137 |
+
"id": "unique_cas_tbutylperoxy_isopropyl_carbonate",
|
| 2138 |
+
"status": "passed",
|
| 2139 |
+
"detail": null
|
| 2140 |
+
},
|
| 2141 |
+
{
|
| 2142 |
+
"id": "cas_format_tbutylperoxy_isopropyl_carbonate",
|
| 2143 |
+
"status": "passed",
|
| 2144 |
+
"detail": null
|
| 2145 |
+
},
|
| 2146 |
+
{
|
| 2147 |
+
"id": "line_values_tbutylperoxy_isopropyl_carbonate_0",
|
| 2148 |
+
"status": "passed",
|
| 2149 |
+
"detail": {
|
| 2150 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2151 |
+
"line": 894,
|
| 2152 |
+
"text": "tert-Butylperoxy isopropyl carbonate [2372-21-6] 176.2 9.08 137 ",
|
| 2153 |
+
"A": "2.49E+16",
|
| 2154 |
+
"Ea": 150.15,
|
| 2155 |
+
"temps_C": [
|
| 2156 |
+
137,
|
| 2157 |
+
117,
|
| 2158 |
+
98
|
| 2159 |
+
]
|
| 2160 |
+
}
|
| 2161 |
+
},
|
| 2162 |
+
{
|
| 2163 |
+
"id": "name_block_tbutylperoxy_isopropyl_carbonate_0",
|
| 2164 |
+
"status": "passed",
|
| 2165 |
+
"detail": {
|
| 2166 |
+
"cas": "2372-21-6"
|
| 2167 |
+
}
|
| 2168 |
+
},
|
| 2169 |
+
{
|
| 2170 |
+
"id": "half_life_consistency_tbutylperoxy_isopropyl_carbonate_0",
|
| 2171 |
+
"status": "passed",
|
| 2172 |
+
"detail": 0.814
|
| 2173 |
+
},
|
| 2174 |
+
{
|
| 2175 |
+
"id": "primary_kinetics_is_a_measurement_tbutylperoxy_isopropyl_carbonate",
|
| 2176 |
+
"status": "passed",
|
| 2177 |
+
"detail": null
|
| 2178 |
+
},
|
| 2179 |
+
{
|
| 2180 |
+
"id": "no_invented_heat_tbutylperoxy_isopropyl_carbonate",
|
| 2181 |
+
"status": "passed",
|
| 2182 |
+
"detail": null
|
| 2183 |
+
},
|
| 2184 |
+
{
|
| 2185 |
+
"id": "unique_id_tamyl_peroxybenzoate",
|
| 2186 |
+
"status": "passed",
|
| 2187 |
+
"detail": null
|
| 2188 |
+
},
|
| 2189 |
+
{
|
| 2190 |
+
"id": "unique_cas_tamyl_peroxybenzoate",
|
| 2191 |
+
"status": "passed",
|
| 2192 |
+
"detail": null
|
| 2193 |
+
},
|
| 2194 |
+
{
|
| 2195 |
+
"id": "cas_format_tamyl_peroxybenzoate",
|
| 2196 |
+
"status": "passed",
|
| 2197 |
+
"detail": null
|
| 2198 |
+
},
|
| 2199 |
+
{
|
| 2200 |
+
"id": "line_values_tamyl_peroxybenzoate_0",
|
| 2201 |
+
"status": "passed",
|
| 2202 |
+
"detail": {
|
| 2203 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2204 |
+
"line": 914,
|
| 2205 |
+
"text": "tert-Amyl peroxybenzoate [4511-39-1] 208.3 7.68 139 ",
|
| 2206 |
+
"A": "8.38E+15",
|
| 2207 |
+
"Ea": 147.02,
|
| 2208 |
+
"temps_C": [
|
| 2209 |
+
139,
|
| 2210 |
+
118,
|
| 2211 |
+
99
|
| 2212 |
+
]
|
| 2213 |
+
}
|
| 2214 |
+
},
|
| 2215 |
+
{
|
| 2216 |
+
"id": "name_block_tamyl_peroxybenzoate_0",
|
| 2217 |
+
"status": "passed",
|
| 2218 |
+
"detail": {
|
| 2219 |
+
"cas": "4511-39-1"
|
| 2220 |
+
}
|
| 2221 |
+
},
|
| 2222 |
+
{
|
| 2223 |
+
"id": "half_life_consistency_tamyl_peroxybenzoate_0",
|
| 2224 |
+
"status": "passed",
|
| 2225 |
+
"detail": 0.814
|
| 2226 |
+
},
|
| 2227 |
+
{
|
| 2228 |
+
"id": "primary_kinetics_is_a_measurement_tamyl_peroxybenzoate",
|
| 2229 |
+
"status": "passed",
|
| 2230 |
+
"detail": null
|
| 2231 |
+
},
|
| 2232 |
+
{
|
| 2233 |
+
"id": "no_invented_heat_tamyl_peroxybenzoate",
|
| 2234 |
+
"status": "passed",
|
| 2235 |
+
"detail": null
|
| 2236 |
+
},
|
| 2237 |
+
{
|
| 2238 |
+
"id": "unique_id_tbutyl_peroxyacetate",
|
| 2239 |
+
"status": "passed",
|
| 2240 |
+
"detail": null
|
| 2241 |
+
},
|
| 2242 |
+
{
|
| 2243 |
+
"id": "unique_cas_tbutyl_peroxyacetate",
|
| 2244 |
+
"status": "passed",
|
| 2245 |
+
"detail": null
|
| 2246 |
+
},
|
| 2247 |
+
{
|
| 2248 |
+
"id": "cas_format_tbutyl_peroxyacetate",
|
| 2249 |
+
"status": "passed",
|
| 2250 |
+
"detail": null
|
| 2251 |
+
},
|
| 2252 |
+
{
|
| 2253 |
+
"id": "line_values_tbutyl_peroxyacetate_0",
|
| 2254 |
+
"status": "passed",
|
| 2255 |
+
"detail": {
|
| 2256 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2257 |
+
"line": 924,
|
| 2258 |
+
"text": "tert-Butyl peroxyacetate [107-71-1] 132.2 12.11 139 ",
|
| 2259 |
+
"A": "1.57E+16",
|
| 2260 |
+
"Ea": 149.36,
|
| 2261 |
+
"temps_C": [
|
| 2262 |
+
139,
|
| 2263 |
+
119,
|
| 2264 |
+
100
|
| 2265 |
+
]
|
| 2266 |
+
}
|
| 2267 |
+
},
|
| 2268 |
+
{
|
| 2269 |
+
"id": "name_block_tbutyl_peroxyacetate_0",
|
| 2270 |
+
"status": "passed",
|
| 2271 |
+
"detail": {
|
| 2272 |
+
"cas": "107-71-1"
|
| 2273 |
+
}
|
| 2274 |
+
},
|
| 2275 |
+
{
|
| 2276 |
+
"id": "half_life_consistency_tbutyl_peroxyacetate_0",
|
| 2277 |
+
"status": "passed",
|
| 2278 |
+
"detail": 0.814
|
| 2279 |
+
},
|
| 2280 |
+
{
|
| 2281 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_peroxyacetate",
|
| 2282 |
+
"status": "passed",
|
| 2283 |
+
"detail": null
|
| 2284 |
+
},
|
| 2285 |
+
{
|
| 2286 |
+
"id": "no_invented_heat_tbutyl_peroxyacetate",
|
| 2287 |
+
"status": "passed",
|
| 2288 |
+
"detail": null
|
| 2289 |
+
},
|
| 2290 |
+
{
|
| 2291 |
+
"id": "unique_id_tbutyl_peroxybenzoate",
|
| 2292 |
+
"status": "passed",
|
| 2293 |
+
"detail": null
|
| 2294 |
+
},
|
| 2295 |
+
{
|
| 2296 |
+
"id": "unique_cas_tbutyl_peroxybenzoate",
|
| 2297 |
+
"status": "passed",
|
| 2298 |
+
"detail": null
|
| 2299 |
+
},
|
| 2300 |
+
{
|
| 2301 |
+
"id": "cas_format_tbutyl_peroxybenzoate",
|
| 2302 |
+
"status": "passed",
|
| 2303 |
+
"detail": null
|
| 2304 |
+
},
|
| 2305 |
+
{
|
| 2306 |
+
"id": "line_values_tbutyl_peroxybenzoate_0",
|
| 2307 |
+
"status": "passed",
|
| 2308 |
+
"detail": {
|
| 2309 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2310 |
+
"line": 934,
|
| 2311 |
+
"text": "tert-Butyl peroxybenzoate [614-45-9] 194.2 8.24 142 ",
|
| 2312 |
+
"A": "2.23E+16",
|
| 2313 |
+
"Ea": 151.59,
|
| 2314 |
+
"temps_C": [
|
| 2315 |
+
142,
|
| 2316 |
+
122,
|
| 2317 |
+
103
|
| 2318 |
+
]
|
| 2319 |
+
}
|
| 2320 |
+
},
|
| 2321 |
+
{
|
| 2322 |
+
"id": "name_block_tbutyl_peroxybenzoate_0",
|
| 2323 |
+
"status": "passed",
|
| 2324 |
+
"detail": {
|
| 2325 |
+
"cas": "614-45-9"
|
| 2326 |
+
}
|
| 2327 |
+
},
|
| 2328 |
+
{
|
| 2329 |
+
"id": "half_life_consistency_tbutyl_peroxybenzoate_0",
|
| 2330 |
+
"status": "passed",
|
| 2331 |
+
"detail": 0.814
|
| 2332 |
+
},
|
| 2333 |
+
{
|
| 2334 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_peroxybenzoate",
|
| 2335 |
+
"status": "passed",
|
| 2336 |
+
"detail": null
|
| 2337 |
+
},
|
| 2338 |
+
{
|
| 2339 |
+
"id": "no_invented_heat_tbutyl_peroxybenzoate",
|
| 2340 |
+
"status": "passed",
|
| 2341 |
+
"detail": null
|
| 2342 |
+
},
|
| 2343 |
+
{
|
| 2344 |
+
"id": "unique_id_butyl_4_4_di_tbutylperoxy_valerate",
|
| 2345 |
+
"status": "passed",
|
| 2346 |
+
"detail": null
|
| 2347 |
+
},
|
| 2348 |
+
{
|
| 2349 |
+
"id": "unique_cas_butyl_4_4_di_tbutylperoxy_valerate",
|
| 2350 |
+
"status": "passed",
|
| 2351 |
+
"detail": null
|
| 2352 |
+
},
|
| 2353 |
+
{
|
| 2354 |
+
"id": "cas_format_butyl_4_4_di_tbutylperoxy_valerate",
|
| 2355 |
+
"status": "passed",
|
| 2356 |
+
"detail": null
|
| 2357 |
+
},
|
| 2358 |
+
{
|
| 2359 |
+
"id": "line_values_butyl_4_4_di_tbutylperoxy_valerate_0",
|
| 2360 |
+
"status": "passed",
|
| 2361 |
+
"detail": {
|
| 2362 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2363 |
+
"line": 825,
|
| 2364 |
+
"text": "TRIGONOX 17 Butyl 4,4-di(tert-butylperoxy)valerate EPDM 149 125 103 134.2 8.23E+13",
|
| 2365 |
+
"A": "8.23E+13",
|
| 2366 |
+
"Ea": 134.2,
|
| 2367 |
+
"temps_C": [
|
| 2368 |
+
149,
|
| 2369 |
+
125,
|
| 2370 |
+
103
|
| 2371 |
+
]
|
| 2372 |
+
}
|
| 2373 |
+
},
|
| 2374 |
+
{
|
| 2375 |
+
"id": "name_block_butyl_4_4_di_tbutylperoxy_valerate_0",
|
| 2376 |
+
"status": "passed",
|
| 2377 |
+
"detail": {
|
| 2378 |
+
"cas": "995-33-5"
|
| 2379 |
+
}
|
| 2380 |
+
},
|
| 2381 |
+
{
|
| 2382 |
+
"id": "half_life_consistency_butyl_4_4_di_tbutylperoxy_valerate_0",
|
| 2383 |
+
"status": "passed",
|
| 2384 |
+
"detail": 0.814
|
| 2385 |
+
},
|
| 2386 |
+
{
|
| 2387 |
+
"id": "primary_kinetics_is_a_measurement_butyl_4_4_di_tbutylperoxy_valerate",
|
| 2388 |
+
"status": "passed",
|
| 2389 |
+
"detail": null
|
| 2390 |
+
},
|
| 2391 |
+
{
|
| 2392 |
+
"id": "no_invented_heat_butyl_4_4_di_tbutylperoxy_valerate",
|
| 2393 |
+
"status": "passed",
|
| 2394 |
+
"detail": null
|
| 2395 |
+
},
|
| 2396 |
+
{
|
| 2397 |
+
"id": "unique_id_dicumyl_peroxide",
|
| 2398 |
+
"status": "passed",
|
| 2399 |
+
"detail": null
|
| 2400 |
+
},
|
| 2401 |
+
{
|
| 2402 |
+
"id": "unique_cas_dicumyl_peroxide",
|
| 2403 |
+
"status": "passed",
|
| 2404 |
+
"detail": null
|
| 2405 |
+
},
|
| 2406 |
+
{
|
| 2407 |
+
"id": "cas_format_dicumyl_peroxide",
|
| 2408 |
+
"status": "passed",
|
| 2409 |
+
"detail": null
|
| 2410 |
+
},
|
| 2411 |
+
{
|
| 2412 |
+
"id": "line_values_dicumyl_peroxide_0",
|
| 2413 |
+
"status": "passed",
|
| 2414 |
+
"detail": {
|
| 2415 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2416 |
+
"line": 958,
|
| 2417 |
+
"text": "Dicumyl peroxide [80-43-3] 270.4 5.92 154 13",
|
| 2418 |
+
"A": "9.24E+15",
|
| 2419 |
+
"Ea": 152.67,
|
| 2420 |
+
"temps_C": [
|
| 2421 |
+
154,
|
| 2422 |
+
132,
|
| 2423 |
+
112
|
| 2424 |
+
]
|
| 2425 |
+
}
|
| 2426 |
+
},
|
| 2427 |
+
{
|
| 2428 |
+
"id": "name_block_dicumyl_peroxide_0",
|
| 2429 |
+
"status": "passed",
|
| 2430 |
+
"detail": {
|
| 2431 |
+
"cas": "80-43-3"
|
| 2432 |
+
}
|
| 2433 |
+
},
|
| 2434 |
+
{
|
| 2435 |
+
"id": "half_life_consistency_dicumyl_peroxide_0",
|
| 2436 |
+
"status": "passed",
|
| 2437 |
+
"detail": 0.814
|
| 2438 |
+
},
|
| 2439 |
+
{
|
| 2440 |
+
"id": "line_values_dicumyl_peroxide_1",
|
| 2441 |
+
"status": "passed",
|
| 2442 |
+
"detail": {
|
| 2443 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2444 |
+
"line": 824,
|
| 2445 |
+
"text": "PERKADOX BC Dicumyl peroxide EPDM 158 134 112 137.8 9.77E+13",
|
| 2446 |
+
"A": "9.77E+13",
|
| 2447 |
+
"Ea": 137.8,
|
| 2448 |
+
"temps_C": [
|
| 2449 |
+
158,
|
| 2450 |
+
134,
|
| 2451 |
+
112
|
| 2452 |
+
]
|
| 2453 |
+
}
|
| 2454 |
+
},
|
| 2455 |
+
{
|
| 2456 |
+
"id": "name_block_dicumyl_peroxide_1",
|
| 2457 |
+
"status": "passed",
|
| 2458 |
+
"detail": {
|
| 2459 |
+
"cas": "80-43-3"
|
| 2460 |
+
}
|
| 2461 |
+
},
|
| 2462 |
+
{
|
| 2463 |
+
"id": "half_life_consistency_dicumyl_peroxide_1",
|
| 2464 |
+
"status": "passed",
|
| 2465 |
+
"detail": 0.814
|
| 2466 |
+
},
|
| 2467 |
+
{
|
| 2468 |
+
"id": "primary_kinetics_is_a_measurement_dicumyl_peroxide",
|
| 2469 |
+
"status": "passed",
|
| 2470 |
+
"detail": null
|
| 2471 |
+
},
|
| 2472 |
+
{
|
| 2473 |
+
"id": "no_invented_heat_dicumyl_peroxide",
|
| 2474 |
+
"status": "passed",
|
| 2475 |
+
"detail": null
|
| 2476 |
+
},
|
| 2477 |
+
{
|
| 2478 |
+
"id": "unique_id_di_tbutylperoxyisopropyl_benzene",
|
| 2479 |
+
"status": "passed",
|
| 2480 |
+
"detail": null
|
| 2481 |
+
},
|
| 2482 |
+
{
|
| 2483 |
+
"id": "unique_cas_di_tbutylperoxyisopropyl_benzene",
|
| 2484 |
+
"status": "passed",
|
| 2485 |
+
"detail": null
|
| 2486 |
+
},
|
| 2487 |
+
{
|
| 2488 |
+
"id": "cas_format_di_tbutylperoxyisopropyl_benzene",
|
| 2489 |
+
"status": "passed",
|
| 2490 |
+
"detail": null
|
| 2491 |
+
},
|
| 2492 |
+
{
|
| 2493 |
+
"id": "line_values_di_tbutylperoxyisopropyl_benzene_0",
|
| 2494 |
+
"status": "passed",
|
| 2495 |
+
"detail": {
|
| 2496 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2497 |
+
"line": 968,
|
| 2498 |
+
"text": "Di(tert-butylperoxyisopropyl)benzene [25155-25-3] 338.5 9.45 156 13",
|
| 2499 |
+
"A": "7.65E+15",
|
| 2500 |
+
"Ea": 152.69,
|
| 2501 |
+
"temps_C": [
|
| 2502 |
+
156,
|
| 2503 |
+
134,
|
| 2504 |
+
114
|
| 2505 |
+
]
|
| 2506 |
+
}
|
| 2507 |
+
},
|
| 2508 |
+
{
|
| 2509 |
+
"id": "name_block_di_tbutylperoxyisopropyl_benzene_0",
|
| 2510 |
+
"status": "passed",
|
| 2511 |
+
"detail": {
|
| 2512 |
+
"cas": "25155-25-3"
|
| 2513 |
+
}
|
| 2514 |
+
},
|
| 2515 |
+
{
|
| 2516 |
+
"id": "half_life_consistency_di_tbutylperoxyisopropyl_benzene_0",
|
| 2517 |
+
"status": "passed",
|
| 2518 |
+
"detail": 0.814
|
| 2519 |
+
},
|
| 2520 |
+
{
|
| 2521 |
+
"id": "line_values_di_tbutylperoxyisopropyl_benzene_1",
|
| 2522 |
+
"status": "passed",
|
| 2523 |
+
"detail": {
|
| 2524 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2525 |
+
"line": 823,
|
| 2526 |
+
"text": "PERKADOX 14 Di-tert-butylperoxyisopropyl)benzene EPDM 164 140 118 143.5 2.68E+14",
|
| 2527 |
+
"A": "2.68E+14",
|
| 2528 |
+
"Ea": 143.5,
|
| 2529 |
+
"temps_C": [
|
| 2530 |
+
164,
|
| 2531 |
+
140,
|
| 2532 |
+
118
|
| 2533 |
+
]
|
| 2534 |
+
}
|
| 2535 |
+
},
|
| 2536 |
+
{
|
| 2537 |
+
"id": "name_block_di_tbutylperoxyisopropyl_benzene_1",
|
| 2538 |
+
"status": "passed",
|
| 2539 |
+
"detail": {
|
| 2540 |
+
"cas": "25155-25-3"
|
| 2541 |
+
}
|
| 2542 |
+
},
|
| 2543 |
+
{
|
| 2544 |
+
"id": "half_life_consistency_di_tbutylperoxyisopropyl_benzene_1",
|
| 2545 |
+
"status": "passed",
|
| 2546 |
+
"detail": 0.814
|
| 2547 |
+
},
|
| 2548 |
+
{
|
| 2549 |
+
"id": "primary_kinetics_is_a_measurement_di_tbutylperoxyisopropyl_benzene",
|
| 2550 |
+
"status": "passed",
|
| 2551 |
+
"detail": null
|
| 2552 |
+
},
|
| 2553 |
+
{
|
| 2554 |
+
"id": "no_invented_heat_di_tbutylperoxyisopropyl_benzene",
|
| 2555 |
+
"status": "passed",
|
| 2556 |
+
"detail": null
|
| 2557 |
+
},
|
| 2558 |
+
{
|
| 2559 |
+
"id": "unique_id_2_5_dimethyl_2_5_di_tbutylperoxy_hexane",
|
| 2560 |
+
"status": "passed",
|
| 2561 |
+
"detail": null
|
| 2562 |
+
},
|
| 2563 |
+
{
|
| 2564 |
+
"id": "unique_cas_2_5_dimethyl_2_5_di_tbutylperoxy_hexane",
|
| 2565 |
+
"status": "passed",
|
| 2566 |
+
"detail": null
|
| 2567 |
+
},
|
| 2568 |
+
{
|
| 2569 |
+
"id": "cas_format_2_5_dimethyl_2_5_di_tbutylperoxy_hexane",
|
| 2570 |
+
"status": "passed",
|
| 2571 |
+
"detail": null
|
| 2572 |
+
},
|
| 2573 |
+
{
|
| 2574 |
+
"id": "line_values_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_0",
|
| 2575 |
+
"status": "passed",
|
| 2576 |
+
"detail": {
|
| 2577 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2578 |
+
"line": 978,
|
| 2579 |
+
"text": "2,5-Dimethyl-2,5-di(tert-butylperoxy)hexane [78-63-7] 290.4 11.02 156 13",
|
| 2580 |
+
"A": "1.68E+16",
|
| 2581 |
+
"Ea": 155.49,
|
| 2582 |
+
"temps_C": [
|
| 2583 |
+
156,
|
| 2584 |
+
134,
|
| 2585 |
+
115
|
| 2586 |
+
]
|
| 2587 |
+
}
|
| 2588 |
+
},
|
| 2589 |
+
{
|
| 2590 |
+
"id": "name_block_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_0",
|
| 2591 |
+
"status": "passed",
|
| 2592 |
+
"detail": {
|
| 2593 |
+
"cas": "78-63-7"
|
| 2594 |
+
}
|
| 2595 |
+
},
|
| 2596 |
+
{
|
| 2597 |
+
"id": "half_life_consistency_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_0",
|
| 2598 |
+
"status": "passed",
|
| 2599 |
+
"detail": 0.814
|
| 2600 |
+
},
|
| 2601 |
+
{
|
| 2602 |
+
"id": "line_values_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_1",
|
| 2603 |
+
"status": "passed",
|
| 2604 |
+
"detail": {
|
| 2605 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2606 |
+
"line": 820,
|
| 2607 |
+
"text": "TRIGONOX 101 2,5-Dimethyl-2,5-di(tert-butylperoxy)hexane EPDM 166 143 121 147.4 6.41E+14",
|
| 2608 |
+
"A": "6.41E+14",
|
| 2609 |
+
"Ea": 147.4,
|
| 2610 |
+
"temps_C": [
|
| 2611 |
+
166,
|
| 2612 |
+
143,
|
| 2613 |
+
121
|
| 2614 |
+
]
|
| 2615 |
+
}
|
| 2616 |
+
},
|
| 2617 |
+
{
|
| 2618 |
+
"id": "name_block_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_1",
|
| 2619 |
+
"status": "passed",
|
| 2620 |
+
"detail": {
|
| 2621 |
+
"cas": "78-63-7"
|
| 2622 |
+
}
|
| 2623 |
+
},
|
| 2624 |
+
{
|
| 2625 |
+
"id": "half_life_consistency_2_5_dimethyl_2_5_di_tbutylperoxy_hexane_1",
|
| 2626 |
+
"status": "passed",
|
| 2627 |
+
"detail": 0.814
|
| 2628 |
+
},
|
| 2629 |
+
{
|
| 2630 |
+
"id": "primary_kinetics_is_a_measurement_2_5_dimethyl_2_5_di_tbutylperoxy_hexane",
|
| 2631 |
+
"status": "passed",
|
| 2632 |
+
"detail": null
|
| 2633 |
+
},
|
| 2634 |
+
{
|
| 2635 |
+
"id": "no_invented_heat_2_5_dimethyl_2_5_di_tbutylperoxy_hexane",
|
| 2636 |
+
"status": "passed",
|
| 2637 |
+
"detail": null
|
| 2638 |
+
},
|
| 2639 |
+
{
|
| 2640 |
+
"id": "unique_id_tbutyl_cumyl_peroxide",
|
| 2641 |
+
"status": "passed",
|
| 2642 |
+
"detail": null
|
| 2643 |
+
},
|
| 2644 |
+
{
|
| 2645 |
+
"id": "unique_cas_tbutyl_cumyl_peroxide",
|
| 2646 |
+
"status": "passed",
|
| 2647 |
+
"detail": null
|
| 2648 |
+
},
|
| 2649 |
+
{
|
| 2650 |
+
"id": "cas_format_tbutyl_cumyl_peroxide",
|
| 2651 |
+
"status": "passed",
|
| 2652 |
+
"detail": null
|
| 2653 |
+
},
|
| 2654 |
+
{
|
| 2655 |
+
"id": "line_values_tbutyl_cumyl_peroxide_0",
|
| 2656 |
+
"status": "passed",
|
| 2657 |
+
"detail": {
|
| 2658 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2659 |
+
"line": 821,
|
| 2660 |
+
"text": "TRIGONOX T tert-Butyl cumyl peroxide EPDM 164 140 118 142.9 2.30E+14",
|
| 2661 |
+
"A": "2.30E+14",
|
| 2662 |
+
"Ea": 142.9,
|
| 2663 |
+
"temps_C": [
|
| 2664 |
+
164,
|
| 2665 |
+
140,
|
| 2666 |
+
118
|
| 2667 |
+
]
|
| 2668 |
+
}
|
| 2669 |
+
},
|
| 2670 |
+
{
|
| 2671 |
+
"id": "name_block_tbutyl_cumyl_peroxide_0",
|
| 2672 |
+
"status": "passed",
|
| 2673 |
+
"detail": {
|
| 2674 |
+
"cas": "3457-61-2"
|
| 2675 |
+
}
|
| 2676 |
+
},
|
| 2677 |
+
{
|
| 2678 |
+
"id": "half_life_consistency_tbutyl_cumyl_peroxide_0",
|
| 2679 |
+
"status": "passed",
|
| 2680 |
+
"detail": 0.814
|
| 2681 |
+
},
|
| 2682 |
+
{
|
| 2683 |
+
"id": "line_values_tbutyl_cumyl_peroxide_1",
|
| 2684 |
+
"status": "passed",
|
| 2685 |
+
"detail": {
|
| 2686 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2687 |
+
"line": 822,
|
| 2688 |
+
"text": "TRIGONOX T tert-Butyl cumyl peroxide LDPE 172 146 123 138.9 3.55E+13",
|
| 2689 |
+
"A": "3.55E+13",
|
| 2690 |
+
"Ea": 138.9,
|
| 2691 |
+
"temps_C": [
|
| 2692 |
+
172,
|
| 2693 |
+
146,
|
| 2694 |
+
123
|
| 2695 |
+
]
|
| 2696 |
+
}
|
| 2697 |
+
},
|
| 2698 |
+
{
|
| 2699 |
+
"id": "name_block_tbutyl_cumyl_peroxide_1",
|
| 2700 |
+
"status": "passed",
|
| 2701 |
+
"detail": {
|
| 2702 |
+
"cas": "3457-61-2"
|
| 2703 |
+
}
|
| 2704 |
+
},
|
| 2705 |
+
{
|
| 2706 |
+
"id": "half_life_consistency_tbutyl_cumyl_peroxide_1",
|
| 2707 |
+
"status": "passed",
|
| 2708 |
+
"detail": 1.062
|
| 2709 |
+
},
|
| 2710 |
+
{
|
| 2711 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_cumyl_peroxide",
|
| 2712 |
+
"status": "passed",
|
| 2713 |
+
"detail": null
|
| 2714 |
+
},
|
| 2715 |
+
{
|
| 2716 |
+
"id": "no_invented_heat_tbutyl_cumyl_peroxide",
|
| 2717 |
+
"status": "passed",
|
| 2718 |
+
"detail": null
|
| 2719 |
+
},
|
| 2720 |
+
{
|
| 2721 |
+
"id": "unique_id_di_tbutyl_peroxide",
|
| 2722 |
+
"status": "passed",
|
| 2723 |
+
"detail": null
|
| 2724 |
+
},
|
| 2725 |
+
{
|
| 2726 |
+
"id": "unique_cas_di_tbutyl_peroxide",
|
| 2727 |
+
"status": "passed",
|
| 2728 |
+
"detail": null
|
| 2729 |
+
},
|
| 2730 |
+
{
|
| 2731 |
+
"id": "cas_format_di_tbutyl_peroxide",
|
| 2732 |
+
"status": "passed",
|
| 2733 |
+
"detail": null
|
| 2734 |
+
},
|
| 2735 |
+
{
|
| 2736 |
+
"id": "line_values_di_tbutyl_peroxide_0",
|
| 2737 |
+
"status": "passed",
|
| 2738 |
+
"detail": {
|
| 2739 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2740 |
+
"line": 987,
|
| 2741 |
+
"text": "Di-tert-butyl peroxide [110-05-4] 146.2 10.94 164 14",
|
| 2742 |
+
"A": "4.20E+15",
|
| 2743 |
+
"Ea": 153.46,
|
| 2744 |
+
"temps_C": [
|
| 2745 |
+
164,
|
| 2746 |
+
141,
|
| 2747 |
+
121
|
| 2748 |
+
]
|
| 2749 |
+
}
|
| 2750 |
+
},
|
| 2751 |
+
{
|
| 2752 |
+
"id": "name_block_di_tbutyl_peroxide_0",
|
| 2753 |
+
"status": "passed",
|
| 2754 |
+
"detail": {
|
| 2755 |
+
"cas": "110-05-4"
|
| 2756 |
+
}
|
| 2757 |
+
},
|
| 2758 |
+
{
|
| 2759 |
+
"id": "half_life_consistency_di_tbutyl_peroxide_0",
|
| 2760 |
+
"status": "passed",
|
| 2761 |
+
"detail": 1.062
|
| 2762 |
+
},
|
| 2763 |
+
{
|
| 2764 |
+
"id": "line_values_di_tbutyl_peroxide_1",
|
| 2765 |
+
"status": "passed",
|
| 2766 |
+
"detail": {
|
| 2767 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2768 |
+
"line": 819,
|
| 2769 |
+
"text": "TRIGONOX B 3 Di-tert-butyl peroxide HDPE 176 151 129 146.3 1.98E+14",
|
| 2770 |
+
"A": "1.98E+14",
|
| 2771 |
+
"Ea": 146.3,
|
| 2772 |
+
"temps_C": [
|
| 2773 |
+
176,
|
| 2774 |
+
151,
|
| 2775 |
+
129
|
| 2776 |
+
]
|
| 2777 |
+
}
|
| 2778 |
+
},
|
| 2779 |
+
{
|
| 2780 |
+
"id": "name_block_di_tbutyl_peroxide_1",
|
| 2781 |
+
"status": "passed",
|
| 2782 |
+
"detail": {
|
| 2783 |
+
"cas": "110-05-4"
|
| 2784 |
+
}
|
| 2785 |
+
},
|
| 2786 |
+
{
|
| 2787 |
+
"id": "half_life_consistency_di_tbutyl_peroxide_1",
|
| 2788 |
+
"status": "passed",
|
| 2789 |
+
"detail": 1.062
|
| 2790 |
+
},
|
| 2791 |
+
{
|
| 2792 |
+
"id": "primary_kinetics_is_a_measurement_di_tbutyl_peroxide",
|
| 2793 |
+
"status": "passed",
|
| 2794 |
+
"detail": null
|
| 2795 |
+
},
|
| 2796 |
+
{
|
| 2797 |
+
"id": "no_invented_heat_di_tbutyl_peroxide",
|
| 2798 |
+
"status": "passed",
|
| 2799 |
+
"detail": null
|
| 2800 |
+
},
|
| 2801 |
+
{
|
| 2802 |
+
"id": "unique_id_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane",
|
| 2803 |
+
"status": "passed",
|
| 2804 |
+
"detail": null
|
| 2805 |
+
},
|
| 2806 |
+
{
|
| 2807 |
+
"id": "unique_cas_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane",
|
| 2808 |
+
"status": "passed",
|
| 2809 |
+
"detail": null
|
| 2810 |
+
},
|
| 2811 |
+
{
|
| 2812 |
+
"id": "cas_format_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane",
|
| 2813 |
+
"status": "passed",
|
| 2814 |
+
"detail": null
|
| 2815 |
+
},
|
| 2816 |
+
{
|
| 2817 |
+
"id": "line_values_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_0",
|
| 2818 |
+
"status": "passed",
|
| 2819 |
+
"detail": {
|
| 2820 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2821 |
+
"line": 997,
|
| 2822 |
+
"text": "3,6,9-Triethyl-3,6,9-trimethyl-1,4,7-triperoxonane [24748-23-0] 264.3 18.16 170 14",
|
| 2823 |
+
"A": "1.02E+15",
|
| 2824 |
+
"Ea": 150.23,
|
| 2825 |
+
"temps_C": [
|
| 2826 |
+
170,
|
| 2827 |
+
146,
|
| 2828 |
+
125
|
| 2829 |
+
]
|
| 2830 |
+
}
|
| 2831 |
+
},
|
| 2832 |
+
{
|
| 2833 |
+
"id": "name_block_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_0",
|
| 2834 |
+
"status": "passed",
|
| 2835 |
+
"detail": {
|
| 2836 |
+
"cas": "24748-23-0"
|
| 2837 |
+
}
|
| 2838 |
+
},
|
| 2839 |
+
{
|
| 2840 |
+
"id": "half_life_consistency_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_0",
|
| 2841 |
+
"status": "passed",
|
| 2842 |
+
"detail": 1.062
|
| 2843 |
+
},
|
| 2844 |
+
{
|
| 2845 |
+
"id": "line_values_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_1",
|
| 2846 |
+
"status": "passed",
|
| 2847 |
+
"detail": {
|
| 2848 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2849 |
+
"line": 817,
|
| 2850 |
+
"text": "TRIGONOX 301 3,6,9-Triethyl-3,6,9-trimethyl-1,4,7-triperoxonane HDPE 181 156 134 150.8 4.35E+14",
|
| 2851 |
+
"A": "4.35E+14",
|
| 2852 |
+
"Ea": 150.8,
|
| 2853 |
+
"temps_C": [
|
| 2854 |
+
181,
|
| 2855 |
+
156,
|
| 2856 |
+
134
|
| 2857 |
+
]
|
| 2858 |
+
}
|
| 2859 |
+
},
|
| 2860 |
+
{
|
| 2861 |
+
"id": "name_block_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_1",
|
| 2862 |
+
"status": "passed",
|
| 2863 |
+
"detail": {
|
| 2864 |
+
"cas": "24748-23-0"
|
| 2865 |
+
}
|
| 2866 |
+
},
|
| 2867 |
+
{
|
| 2868 |
+
"id": "half_life_consistency_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane_1",
|
| 2869 |
+
"status": "passed",
|
| 2870 |
+
"detail": 1.062
|
| 2871 |
+
},
|
| 2872 |
+
{
|
| 2873 |
+
"id": "primary_kinetics_is_a_measurement_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane",
|
| 2874 |
+
"status": "passed",
|
| 2875 |
+
"detail": null
|
| 2876 |
+
},
|
| 2877 |
+
{
|
| 2878 |
+
"id": "no_invented_heat_3_6_9_triethyl_3_6_9_trimethyl_1_4_7_triperoxonane",
|
| 2879 |
+
"status": "passed",
|
| 2880 |
+
"detail": null
|
| 2881 |
+
},
|
| 2882 |
+
{
|
| 2883 |
+
"id": "unique_id_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3",
|
| 2884 |
+
"status": "passed",
|
| 2885 |
+
"detail": null
|
| 2886 |
+
},
|
| 2887 |
+
{
|
| 2888 |
+
"id": "unique_cas_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3",
|
| 2889 |
+
"status": "passed",
|
| 2890 |
+
"detail": null
|
| 2891 |
+
},
|
| 2892 |
+
{
|
| 2893 |
+
"id": "cas_format_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3",
|
| 2894 |
+
"status": "passed",
|
| 2895 |
+
"detail": null
|
| 2896 |
+
},
|
| 2897 |
+
{
|
| 2898 |
+
"id": "line_values_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3_0",
|
| 2899 |
+
"status": "passed",
|
| 2900 |
+
"detail": {
|
| 2901 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 2902 |
+
"line": 818,
|
| 2903 |
+
"text": "TRIGONOX 145 2,5-Dimethyl-2,5-di(tert-butylperoxy)hexyne-3 EPDM 177 152 130 148.7 3.49E+14",
|
| 2904 |
+
"A": "3.49E+14",
|
| 2905 |
+
"Ea": 148.7,
|
| 2906 |
+
"temps_C": [
|
| 2907 |
+
177,
|
| 2908 |
+
152,
|
| 2909 |
+
130
|
| 2910 |
+
]
|
| 2911 |
+
}
|
| 2912 |
+
},
|
| 2913 |
+
{
|
| 2914 |
+
"id": "name_block_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3_0",
|
| 2915 |
+
"status": "passed",
|
| 2916 |
+
"detail": {
|
| 2917 |
+
"cas": "1068-27-5"
|
| 2918 |
+
}
|
| 2919 |
+
},
|
| 2920 |
+
{
|
| 2921 |
+
"id": "half_life_consistency_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3_0",
|
| 2922 |
+
"status": "passed",
|
| 2923 |
+
"detail": 1.062
|
| 2924 |
+
},
|
| 2925 |
+
{
|
| 2926 |
+
"id": "primary_kinetics_is_a_measurement_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3",
|
| 2927 |
+
"status": "passed",
|
| 2928 |
+
"detail": null
|
| 2929 |
+
},
|
| 2930 |
+
{
|
| 2931 |
+
"id": "no_invented_heat_2_5_dimethyl_2_5_di_tbutylperoxy_hexyne_3",
|
| 2932 |
+
"status": "passed",
|
| 2933 |
+
"detail": null
|
| 2934 |
+
},
|
| 2935 |
+
{
|
| 2936 |
+
"id": "unique_id_cumyl_hydroperoxide",
|
| 2937 |
+
"status": "passed",
|
| 2938 |
+
"detail": null
|
| 2939 |
+
},
|
| 2940 |
+
{
|
| 2941 |
+
"id": "unique_cas_cumyl_hydroperoxide",
|
| 2942 |
+
"status": "passed",
|
| 2943 |
+
"detail": null
|
| 2944 |
+
},
|
| 2945 |
+
{
|
| 2946 |
+
"id": "cas_format_cumyl_hydroperoxide",
|
| 2947 |
+
"status": "passed",
|
| 2948 |
+
"detail": null
|
| 2949 |
+
},
|
| 2950 |
+
{
|
| 2951 |
+
"id": "line_values_cumyl_hydroperoxide_0",
|
| 2952 |
+
"status": "passed",
|
| 2953 |
+
"detail": {
|
| 2954 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 2955 |
+
"line": 1041,
|
| 2956 |
+
"text": "Cumyl hydroperoxide [80-15-9] 152.2 10.51 195 166 140 1.15E+12 13",
|
| 2957 |
+
"A": "1.15E+12",
|
| 2958 |
+
"Ea": 132.56,
|
| 2959 |
+
"temps_C": [
|
| 2960 |
+
195,
|
| 2961 |
+
166,
|
| 2962 |
+
140
|
| 2963 |
+
]
|
| 2964 |
+
}
|
| 2965 |
+
},
|
| 2966 |
+
{
|
| 2967 |
+
"id": "name_block_cumyl_hydroperoxide_0",
|
| 2968 |
+
"status": "passed",
|
| 2969 |
+
"detail": {
|
| 2970 |
+
"cas": "80-15-9"
|
| 2971 |
+
}
|
| 2972 |
+
},
|
| 2973 |
+
{
|
| 2974 |
+
"id": "half_life_consistency_cumyl_hydroperoxide_0",
|
| 2975 |
+
"status": "passed",
|
| 2976 |
+
"detail": 1.062
|
| 2977 |
+
},
|
| 2978 |
+
{
|
| 2979 |
+
"id": "primary_kinetics_is_a_measurement_cumyl_hydroperoxide",
|
| 2980 |
+
"status": "passed",
|
| 2981 |
+
"detail": null
|
| 2982 |
+
},
|
| 2983 |
+
{
|
| 2984 |
+
"id": "no_invented_heat_cumyl_hydroperoxide",
|
| 2985 |
+
"status": "passed",
|
| 2986 |
+
"detail": null
|
| 2987 |
+
},
|
| 2988 |
+
{
|
| 2989 |
+
"id": "unique_id_3_3_5_7_7_pentamethyl_1_2_4_trioxepane",
|
| 2990 |
+
"status": "passed",
|
| 2991 |
+
"detail": null
|
| 2992 |
+
},
|
| 2993 |
+
{
|
| 2994 |
+
"id": "unique_cas_3_3_5_7_7_pentamethyl_1_2_4_trioxepane",
|
| 2995 |
+
"status": "passed",
|
| 2996 |
+
"detail": null
|
| 2997 |
+
},
|
| 2998 |
+
{
|
| 2999 |
+
"id": "cas_format_3_3_5_7_7_pentamethyl_1_2_4_trioxepane",
|
| 3000 |
+
"status": "passed",
|
| 3001 |
+
"detail": null
|
| 3002 |
+
},
|
| 3003 |
+
{
|
| 3004 |
+
"id": "line_values_3_3_5_7_7_pentamethyl_1_2_4_trioxepane_0",
|
| 3005 |
+
"status": "passed",
|
| 3006 |
+
"detail": {
|
| 3007 |
+
"file": "nouryon_brochure-crosslinking-peroxides-emeia-booklet-en_us.pdf",
|
| 3008 |
+
"line": 816,
|
| 3009 |
+
"text": "TRIGONOX 311 3,3,5,7,7-Pentamethyl-1,2,4-trioxepane HDPE 213 184 158 144.6 6.58E+12",
|
| 3010 |
+
"A": "6.58E+12",
|
| 3011 |
+
"Ea": 144.6,
|
| 3012 |
+
"temps_C": [
|
| 3013 |
+
213,
|
| 3014 |
+
184,
|
| 3015 |
+
158
|
| 3016 |
+
]
|
| 3017 |
+
}
|
| 3018 |
+
},
|
| 3019 |
+
{
|
| 3020 |
+
"id": "name_block_3_3_5_7_7_pentamethyl_1_2_4_trioxepane_0",
|
| 3021 |
+
"status": "passed",
|
| 3022 |
+
"detail": {
|
| 3023 |
+
"cas": "215877-64-8"
|
| 3024 |
+
}
|
| 3025 |
+
},
|
| 3026 |
+
{
|
| 3027 |
+
"id": "half_life_consistency_3_3_5_7_7_pentamethyl_1_2_4_trioxepane_0",
|
| 3028 |
+
"status": "passed",
|
| 3029 |
+
"detail": 1.062
|
| 3030 |
+
},
|
| 3031 |
+
{
|
| 3032 |
+
"id": "primary_kinetics_is_a_measurement_3_3_5_7_7_pentamethyl_1_2_4_trioxepane",
|
| 3033 |
+
"status": "passed",
|
| 3034 |
+
"detail": null
|
| 3035 |
+
},
|
| 3036 |
+
{
|
| 3037 |
+
"id": "no_invented_heat_3_3_5_7_7_pentamethyl_1_2_4_trioxepane",
|
| 3038 |
+
"status": "passed",
|
| 3039 |
+
"detail": null
|
| 3040 |
+
},
|
| 3041 |
+
{
|
| 3042 |
+
"id": "unique_id_tbutyl_hydroperoxide",
|
| 3043 |
+
"status": "passed",
|
| 3044 |
+
"detail": null
|
| 3045 |
+
},
|
| 3046 |
+
{
|
| 3047 |
+
"id": "unique_cas_tbutyl_hydroperoxide",
|
| 3048 |
+
"status": "passed",
|
| 3049 |
+
"detail": null
|
| 3050 |
+
},
|
| 3051 |
+
{
|
| 3052 |
+
"id": "cas_format_tbutyl_hydroperoxide",
|
| 3053 |
+
"status": "passed",
|
| 3054 |
+
"detail": null
|
| 3055 |
+
},
|
| 3056 |
+
{
|
| 3057 |
+
"id": "line_values_tbutyl_hydroperoxide_0",
|
| 3058 |
+
"status": "passed",
|
| 3059 |
+
"detail": {
|
| 3060 |
+
"file": "nouryon_brochure-initiators-for-thermoplastics-en_us.pdf",
|
| 3061 |
+
"line": 1050,
|
| 3062 |
+
"text": "tert-Butyl hydroperoxide [75-91-2] 90.1 17.75 207 185 164 3.18E+17 18",
|
| 3063 |
+
"A": "3.18E+17",
|
| 3064 |
+
"Ea": 186.01,
|
| 3065 |
+
"temps_C": [
|
| 3066 |
+
207,
|
| 3067 |
+
185,
|
| 3068 |
+
164
|
| 3069 |
+
]
|
| 3070 |
+
}
|
| 3071 |
+
},
|
| 3072 |
+
{
|
| 3073 |
+
"id": "name_block_tbutyl_hydroperoxide_0",
|
| 3074 |
+
"status": "passed",
|
| 3075 |
+
"detail": {
|
| 3076 |
+
"cas": "75-91-2"
|
| 3077 |
+
}
|
| 3078 |
+
},
|
| 3079 |
+
{
|
| 3080 |
+
"id": "half_life_consistency_tbutyl_hydroperoxide_0",
|
| 3081 |
+
"status": "passed",
|
| 3082 |
+
"detail": 1.062
|
| 3083 |
+
},
|
| 3084 |
+
{
|
| 3085 |
+
"id": "primary_kinetics_is_a_measurement_tbutyl_hydroperoxide",
|
| 3086 |
+
"status": "passed",
|
| 3087 |
+
"detail": null
|
| 3088 |
+
},
|
| 3089 |
+
{
|
| 3090 |
+
"id": "no_invented_heat_tbutyl_hydroperoxide",
|
| 3091 |
+
"status": "passed",
|
| 3092 |
+
"detail": null
|
| 3093 |
+
},
|
| 3094 |
+
{
|
| 3095 |
+
"id": "at_least_50_distinct_substances",
|
| 3096 |
+
"status": "passed",
|
| 3097 |
+
"detail": 51
|
| 3098 |
+
},
|
| 3099 |
+
{
|
| 3100 |
+
"id": "dtbp_text_5.74_g_of_20%_di-tert-butyl-pe",
|
| 3101 |
+
"status": "passed",
|
| 3102 |
+
"detail": null
|
| 3103 |
+
},
|
| 3104 |
+
{
|
| 3105 |
+
"id": "dtbp_text_mass_10.028_g",
|
| 3106 |
+
"status": "passed",
|
| 3107 |
+
"detail": null
|
| 3108 |
+
},
|
| 3109 |
+
{
|
| 3110 |
+
"id": "dtbp_text_exothermal_threshold",
|
| 3111 |
+
"status": "passed",
|
| 3112 |
+
"detail": null
|
| 3113 |
+
},
|
| 3114 |
+
{
|
| 3115 |
+
"id": "dtbp_text_1.480",
|
| 3116 |
+
"status": "passed",
|
| 3117 |
+
"detail": null
|
| 3118 |
+
},
|
| 3119 |
+
{
|
| 3120 |
+
"id": "dtbp_text_90.3_K",
|
| 3121 |
+
"status": "passed",
|
| 3122 |
+
"detail": null
|
| 3123 |
+
},
|
| 3124 |
+
{
|
| 3125 |
+
"id": "dtbp_text_133.7_K",
|
| 3126 |
+
"status": "passed",
|
| 3127 |
+
"detail": null
|
| 3128 |
+
},
|
| 3129 |
+
{
|
| 3130 |
+
"id": "dtbp_text_280.675_J/g",
|
| 3131 |
+
"status": "passed",
|
| 3132 |
+
"detail": null
|
| 3133 |
+
},
|
| 3134 |
+
{
|
| 3135 |
+
"id": "dtbp_text_1611.075_J",
|
| 3136 |
+
"status": "passed",
|
| 3137 |
+
"detail": null
|
| 3138 |
+
},
|
| 3139 |
+
{
|
| 3140 |
+
"id": "dtbp_text_15.152_log_(1/s)",
|
| 3141 |
+
"status": "passed",
|
| 3142 |
+
"detail": null
|
| 3143 |
+
},
|
| 3144 |
+
{
|
| 3145 |
+
"id": "dtbp_text_151.039_kJ/mol",
|
| 3146 |
+
"status": "passed",
|
| 3147 |
+
"detail": null
|
| 3148 |
+
},
|
| 3149 |
+
{
|
| 3150 |
+
"id": "dtbp_text_42.7_bar",
|
| 3151 |
+
"status": "passed",
|
| 3152 |
+
"detail": null
|
| 3153 |
+
},
|
| 3154 |
+
{
|
| 3155 |
+
"id": "dtbp_text_At_110°C",
|
| 3156 |
+
"status": "passed",
|
| 3157 |
+
"detail": null
|
| 3158 |
+
},
|
| 3159 |
+
{
|
| 3160 |
+
"id": "dtbp_phi_consistency",
|
| 3161 |
+
"status": "passed",
|
| 3162 |
+
"detail": 1.4806201550387597
|
| 3163 |
+
},
|
| 3164 |
+
{
|
| 3165 |
+
"id": "dtbp_total_heat_consistency",
|
| 3166 |
+
"status": "passed",
|
| 3167 |
+
"detail": null
|
| 3168 |
+
},
|
| 3169 |
+
{
|
| 3170 |
+
"id": "pubchem_cas_all_confirmed",
|
| 3171 |
+
"status": "passed",
|
| 3172 |
+
"detail": null
|
| 3173 |
+
},
|
| 3174 |
+
{
|
| 3175 |
+
"id": "antoine_273.13",
|
| 3176 |
+
"status": "passed",
|
| 3177 |
+
"detail": null
|
| 3178 |
+
},
|
| 3179 |
+
{
|
| 3180 |
+
"id": "antoine_303.0",
|
| 3181 |
+
"status": "passed",
|
| 3182 |
+
"detail": null
|
| 3183 |
+
},
|
| 3184 |
+
{
|
| 3185 |
+
"id": "antoine_420.0",
|
| 3186 |
+
"status": "passed",
|
| 3187 |
+
"detail": null
|
| 3188 |
+
},
|
| 3189 |
+
{
|
| 3190 |
+
"id": "antoine_308.52",
|
| 3191 |
+
"status": "passed",
|
| 3192 |
+
"detail": null
|
| 3193 |
+
},
|
| 3194 |
+
{
|
| 3195 |
+
"id": "antoine_273.0",
|
| 3196 |
+
"status": "passed",
|
| 3197 |
+
"detail": null
|
| 3198 |
+
}
|
| 3199 |
+
],
|
| 3200 |
+
"failed": []
|
| 3201 |
+
}
|
outputs/expansion_batch04/t1_thermal/zwick_mflow/interface_definition.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM-146 Mflow 1128610 shared interface geometry (SI, +Z up, +Y rear, origin = bench footprint centre).
|
| 2 |
+
|
| 3 |
+
Single source for build_geometry.py, build_blender.py, verify_geometry.py and the Matterix scripts. The runtime
|
| 4 |
+
(scripts/asset_runtime/zwick_mflow.py) keeps its own copies of the physical constants and the tests compare them.
|
| 5 |
+
|
| 6 |
+
Manufacturer facts (PI 434 725, item 1128610 column): body 479 x 524 x 548 mm (W x D x H), 55 kg without test weights,
|
| 7 |
+
7" capacitive touch display, displacement transducer and automatic extrudate cutter included, barrel 1128612 bore
|
| 8 |
+
9.55 mm, die 312342 2.095 mm x 8 mm, piston 1128614 = 0.325 kg test load. Every other number below is a photo /
|
| 9 |
+
engineering estimate from the manufacturer photographs (evidence = photo_estimate or engineering_assumption).
|
| 10 |
+
"""
|
| 11 |
+
import math
|
| 12 |
+
|
| 13 |
+
# ---------------------------------------------------------------- envelope and barrel column
|
| 14 |
+
ENVELOPE_M = (0.479, 0.524, 0.548)
|
| 15 |
+
BARREL_XY = (-0.080, -0.125) # barrel / piston / die axis (photo estimate: ~65 % across the furnace cover)
|
| 16 |
+
BARREL_BORE_DIAMETER_M = 0.00955 # 1128612, documented
|
| 17 |
+
PISTON_HEAD_DIAMETER_M = 0.009474 # ISO 1133-1 piston head (engineering reference to the standard)
|
| 18 |
+
PISTON_HEAD_LENGTH_M = 0.00635
|
| 19 |
+
DIE_DIAMETER_M = 0.002095 # 312342, documented
|
| 20 |
+
DIE_LENGTH_M = 0.008 # 312342, documented
|
| 21 |
+
DIE_EXIT_Z = 0.228 # die exit face (underside of the furnace die plate)
|
| 22 |
+
DIE_TOP_Z = DIE_EXIT_Z + DIE_LENGTH_M # 0.236: piston position 0 = piston bottom on the die top
|
| 23 |
+
BARREL_LENGTH_M = 0.180
|
| 24 |
+
BARREL_TOP_Z = DIE_TOP_Z + BARREL_LENGTH_M # 0.416
|
| 25 |
+
FURNACE_TOP_Z = 0.430
|
| 26 |
+
PISTON_TRAVEL_M = BARREL_LENGTH_M # joint 0 .. 0.180 (withdrawn = piston bottom at the barrel top)
|
| 27 |
+
PISTON_SEAT_LOCAL_Z = 0.246 # weight seat above the piston bottom
|
| 28 |
+
WEIGHT_HEIGHT_M = 0.066 # standard 2.16 kg load stage weight (1.835 kg on top of the 0.325 kg piston)
|
| 29 |
+
PISTON_MASS_KG = 0.325 # documented: piston alone = 0.325 kg test load
|
| 30 |
+
STANDARD_WEIGHT_MASS_KG = 2.16 - 0.325 # documented load stage 2.16 kg minus the piston
|
| 31 |
+
assert abs(DIE_TOP_Z + PISTON_SEAT_LOCAL_Z + WEIGHT_HEIGHT_M - ENVELOPE_M[2]) < 1e-12
|
| 32 |
+
|
| 33 |
+
# ---------------------------------------------------------------- displacement transducer (rotary arm on a collar)
|
| 34 |
+
SENSOR_COLLAR_LOCAL_Z = 0.218 # top of the transducer collar on the piston stem
|
| 35 |
+
SENSOR_COLLAR_THICKNESS_M = 0.004
|
| 36 |
+
SENSOR_COLLAR_RADIUS_M = 0.016
|
| 37 |
+
SENSOR_ROLLER_RADIUS_M = 0.003 # two rollers, spring-loaded upward against the collar underside
|
| 38 |
+
SENSOR_ARM_LENGTH_M = 0.140
|
| 39 |
+
SENSOR_PIVOT_XY = (BARREL_XY[0] - SENSOR_ARM_LENGTH_M / math.sqrt(2.0), BARREL_XY[1] + SENSOR_ARM_LENGTH_M / math.sqrt(2.0))
|
| 40 |
+
SENSOR_ZERO_POSITION_M = 0.050 # arm horizontal when the piston bottom is 50 mm above the die (ISO start)
|
| 41 |
+
SENSOR_PIVOT_Z = DIE_TOP_Z + SENSOR_ZERO_POSITION_M + SENSOR_COLLAR_LOCAL_Z - SENSOR_COLLAR_THICKNESS_M - SENSOR_ROLLER_RADIUS_M
|
| 42 |
+
SENSOR_ARM_DIRECTION = (math.sqrt(0.5), -math.sqrt(0.5), 0.0) # horizontal, pivot -> piston axis
|
| 43 |
+
SENSOR_ARM_AXIS = (-math.sqrt(0.5), -math.sqrt(0.5), 0.0) # = direction x Z, positive angle lifts the tip
|
| 44 |
+
SENSOR_ELEVATION_MAX_RAD = 0.42 # upper stop of the arm (tip lifted)
|
| 45 |
+
SENSOR_REFERENCE_ELEVATION_RAD = math.asin(-SENSOR_ZERO_POSITION_M / SENSOR_ARM_LENGTH_M) # arm on the collar, piston on the die
|
| 46 |
+
SENSOR_ARM_LIMITS_RAD = (0.0, SENSOR_ELEVATION_MAX_RAD - SENSOR_REFERENCE_ELEVATION_RAD) # joint 0 = reference pose
|
| 47 |
+
SENSOR_CONTACT_RANGE_M = (0.0, SENSOR_ZERO_POSITION_M + SENSOR_ARM_LENGTH_M * math.sin(SENSOR_ELEVATION_MAX_RAD))
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def sensor_arm_angle(piston_position_m):
|
| 51 |
+
"""Joint angle of the transducer arm for a piston position (0 = reference pose, piston on the die).
|
| 52 |
+
|
| 53 |
+
The roller tops (on the arm centre line at 140 mm, radius 3 mm) press against the collar underside, so exactly
|
| 54 |
+
elevation = asin((position - 0.050) / 0.140). Beyond the reach (~107 mm) the arm rests on its upper stop below the
|
| 55 |
+
collar and has no contact (the encoder then reports out of range).
|
| 56 |
+
"""
|
| 57 |
+
s = (piston_position_m - SENSOR_ZERO_POSITION_M) / SENSOR_ARM_LENGTH_M
|
| 58 |
+
elevation = SENSOR_ELEVATION_MAX_RAD if s >= math.sin(SENSOR_ELEVATION_MAX_RAD) else math.asin(max(s, math.sin(SENSOR_REFERENCE_ELEVATION_RAD)))
|
| 59 |
+
return elevation - SENSOR_REFERENCE_ELEVATION_RAD
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
# ---------------------------------------------------------------- automatic extrudate cutter
|
| 63 |
+
CUTTER_PIVOT_XY = (BARREL_XY[0] - 0.040, BARREL_XY[1])
|
| 64 |
+
CUTTER_BLADE_Z = (0.2244, 0.2254) # blade plane 2.6-3.6 mm below the die exit
|
| 65 |
+
CUTTER_LIMITS_RAD = (0.0, math.pi) # alternate half turns 0 -> pi -> 0; crossing pi/2 severs the strand
|
| 66 |
+
|
| 67 |
+
# ---------------------------------------------------------------- tilted 7" touch display and illuminated keys
|
| 68 |
+
PANEL_TILT_RAD = math.radians(75.0) # face tilted 15 deg back from vertical
|
| 69 |
+
U = [1.0, 0.0, 0.0]
|
| 70 |
+
V = [0.0, math.cos(PANEL_TILT_RAD), math.sin(PANEL_TILT_RAD)]
|
| 71 |
+
N = [0.0, -math.sin(PANEL_TILT_RAD), math.cos(PANEL_TILT_RAD)]
|
| 72 |
+
PANEL_BOTTOM = (0.1145, -0.2046, 0.240) # centre of the lower face edge
|
| 73 |
+
PANEL_HEIGHT_M = 0.1915
|
| 74 |
+
PANEL_WIDTH_M = 0.225
|
| 75 |
+
PANEL_CENTER = [PANEL_BOTTOM[0], PANEL_BOTTOM[1] + V[1] * PANEL_HEIGHT_M / 2, PANEL_BOTTOM[2] + V[2] * PANEL_HEIGHT_M / 2]
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def panel_point(u, v, n=0.0):
|
| 79 |
+
"""Face-local (u right, v up the face, n outward) -> asset frame."""
|
| 80 |
+
return [PANEL_CENTER[i] + u * U[i] + v * V[i] + n * N[i] for i in range(3)]
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
SCREEN_CENTER_UV = (0.0, 0.032)
|
| 84 |
+
SCREEN_SIZE_M = (0.158, 0.094)
|
| 85 |
+
BAND_CENTER_UV = (0.0, -0.034)
|
| 86 |
+
KEY_ROW_V = -0.066
|
| 87 |
+
KEYS = [('button_up', -0.080, 'up'), ('button_down', -0.054, 'down'), ('button_cycle', -0.014, 'cycle'),
|
| 88 |
+
('button_start', 0.030, 'start'), ('button_stop', 0.058, 'stop')]
|
| 89 |
+
KEY_COMMANDS = {'button_start': 'acquisition.start', 'button_stop': 'acquisition.stop', 'button_cycle': 'cutter.cut'}
|
| 90 |
+
|
| 91 |
+
PORTS = [('sample_loading', 'barrel', 'mechanical'), ('die_outlet', 'die', 'liquid'), ('die_mount', 'die', 'mechanical'),
|
| 92 |
+
('piston_coupling', 'piston', 'mechanical'), ('weight_stack', 'test_weight', 'mechanical'), ('thermal_boundary', 'heater', 'thermal'),
|
| 93 |
+
('cut_collection', 'collection_tray', 'mechanical'), ('analytical_balance', 'balance_rs232', 'data'), ('raw_data', 'raw_rs232', 'data'),
|
| 94 |
+
('ethernet_host', 'ethernet_host', 'data'), ('usb_1', 'usb_1', 'data'), ('usb_2', 'usb_2', 'data'),
|
| 95 |
+
('line_power', 'line_power', 'electrical'), ('protective_ground', 'protective_ground', 'electrical')]
|
| 96 |
+
# (part, state_id, capability, blender attribute, unit, upper) ; joints are process authoritative mirrors
|
| 97 |
+
MOTION = [('piston', 'piston.position_m', 'piston.insert', 'location[2]', 'm', PISTON_TRAVEL_M),
|
| 98 |
+
('sensor_arm', 'sensor_arm.angle_rad', 'piston.insert', 'rotation_axis_angle', 'rad', SENSOR_ARM_LIMITS_RAD[1]),
|
| 99 |
+
('cutter', 'cutter.angle_rad', 'cutter.cut', 'rotation_euler[2]', 'rad', math.pi),
|
| 100 |
+
('power_switch', 'power.angle_rad', 'power.set', 'rotation_euler[0]', 'rad', 0.28)]
|
| 101 |
+
|
| 102 |
+
LED_BG = (0.018, 0.034, 0.044)
|
| 103 |
+
READOUTS = [dict(name='temperature_sim', part='temperature_digits', face='N', digits=5, decimals=1, unit='C', on=(0.95, 0.96, 0.97), off=LED_BG,
|
| 104 |
+
blank_channel=None, source={'bridge': ['thermal.indicated_k'], 'offset': -273.15}),
|
| 105 |
+
dict(name='piston_position_sim', part='position_digits', face='N', digits=6, decimals=3, unit='mm', on=(0.40, 0.84, 0.98), off=LED_BG,
|
| 106 |
+
blank_channel=None, source={'bridge': ['encoder.position_m'], 'scale': 1000.0}),
|
| 107 |
+
dict(name='live_mvr_sim', part='mvr_digits', face='N', digits=6, decimals=2, unit='cm3/10min', on=(0.55, 0.93, 0.55), off=LED_BG,
|
| 108 |
+
blank_channel=None, source={'bridge': ['measurement.live_mvr_m3_s'], 'scale': 6.0e8})]
|
| 109 |
+
READOUT_LINES_V = {'temperature_digits': 0.058, 'position_digits': 0.030, 'mvr_digits': 0.002}
|
| 110 |
+
READOUT_BASIS = {r['name']: dict(u=U, v=V, normal=N) for r in READOUTS}
|
| 111 |
+
READOUT_NOTE_ZH = ('厂家1128610确有7寸倾斜电容触屏(照片界面显示温度与活塞位置数值);本资产在屏上叠加三行工程七段读数:炉温°C(0.1 K显示)、'
|
| 112 |
+
'活塞底距口模上表面mm(0.003 mm量化)、实时MVR cm³/10min,均来自公开传感状态,不是原厂界面、字体或驱动。'
|
| 113 |
+
'面板基向量U=+X,V=[0,cos75°,sin75°],N=[0,-sin75°,cos75°]。未配气动升降/自动选重,上下箭头键保留为无指令弹簧键;'
|
| 114 |
+
'开始/停止/切刀键经宿主能力触发。称量只经外部天平RS232语义口,不造内置天平。挤出丝与末段切段为本任务场景适配器的可视缩放,不是CFD或接触求解。')
|
| 115 |
+
|
| 116 |
+
REAR_Y = 0.256
|
| 117 |
+
PORT_GEOMETRY = {
|
| 118 |
+
'sample_loading': dict(pos=[BARREL_XY[0], BARREL_XY[1], FURNACE_TOP_Z + 0.006], insert_axis=[0, 0, 1], radius=BARREL_BORE_DIAMETER_M / 2, capture=0.002),
|
| 119 |
+
'die_outlet': dict(pos=[BARREL_XY[0], BARREL_XY[1], DIE_EXIT_Z], insert_axis=[0, 0, -1], radius=DIE_DIAMETER_M / 2, capture=0.001),
|
| 120 |
+
'die_mount': dict(pos=[BARREL_XY[0], BARREL_XY[1], DIE_EXIT_Z - 0.0005], insert_axis=[0, 0, -1], radius=0.009, capture=0.002),
|
| 121 |
+
'piston_coupling': dict(pos=[BARREL_XY[0], BARREL_XY[1], DIE_TOP_Z + PISTON_SEAT_LOCAL_Z], insert_axis=[0, 0, 1], radius=0.007, capture=0.002),
|
| 122 |
+
'weight_stack': dict(pos=[BARREL_XY[0], BARREL_XY[1], ENVELOPE_M[2]], insert_axis=[0, 0, 1], radius=0.037, capture=0.003),
|
| 123 |
+
'thermal_boundary': dict(pos=[BARREL_XY[0], BARREL_XY[1], 0.330], insert_axis=[0, -1, 0], radius=0.030, capture=0.003),
|
| 124 |
+
'cut_collection': dict(pos=[BARREL_XY[0], BARREL_XY[1] - 0.020, 0.0342], insert_axis=[0, 0, 1], radius=0.060, capture=0.01),
|
| 125 |
+
}
|
| 126 |
+
REAR_CONNECTORS = [('line_power', 0.190, 0.105), ('protective_ground', 0.150, 0.105), ('ethernet_host', 0.080, 0.110), ('usb_1', 0.040, 0.110),
|
| 127 |
+
('usb_2', 0.040, 0.128), ('raw_rs232', -0.030, 0.110), ('balance_rs232', -0.100, 0.110)]
|
| 128 |
+
CONNECTOR_PORT = {part: port for port, part, medium in PORTS if medium in ('data', 'electrical')}
|
| 129 |
+
for _name, _x, _z in REAR_CONNECTORS:
|
| 130 |
+
PORT_GEOMETRY[CONNECTOR_PORT[_name]] = dict(pos=[_x, 0.262, _z], insert_axis=[0, 1, 0], radius=0.004, capture=0.002)
|
| 131 |
+
for _row in PORT_GEOMETRY.values():
|
| 132 |
+
_row.update(position_evidence='geometry_derived_simulation_assumption', capture_evidence='simulation_assumption',
|
| 133 |
+
note='接口插入轴为向外预放置方向;局部接口布局和捕获半径为工程几何,物理pinout/机器人接触未验证。')
|
| 134 |
+
|
| 135 |
+
EXTRUDATE_RADIUS_M = 0.00115 # die radius 1.0475 mm x assumed swell 1.10 (visual only)
|
| 136 |
+
EXTRUDATE_VISUAL_SPEC = dict(
|
| 137 |
+
reference_length_m=0.020, radius_m=EXTRUDATE_RADIUS_M, max_visual_length_m=0.150,
|
| 138 |
+
strand=dict(part='extrudate_strand', anchor=[BARREL_XY[0], BARREL_XY[1], DIE_EXIT_Z], axis=[0, 0, -1], state='extrudate.length_m'),
|
| 139 |
+
segment=dict(part='extrudate_segment', anchor=[BARREL_XY[0] - 0.010, BARREL_XY[1] - 0.040, 0.0342 + EXTRUDATE_RADIUS_M], axis=[1, 0, 0],
|
| 140 |
+
state='extrudate.last_cut_length_m'),
|
| 141 |
+
scope='asset-local visual vertex scaling and visibility only; strand clipped to 150 mm (drop height to the plate ~194 mm); '
|
| 142 |
+
'no CFD, die-swell measurement, coiling, contact or automatic transfer to the balance')
|
outputs/expansion_batch04/t3_analytical/evident_bx53p/source_cache/cvrl_ciexyz31_1.csv
ADDED
|
@@ -0,0 +1,471 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
360,0.000129900000,0.000003917000,0.000606100000
|
| 2 |
+
361,0.000145847000,0.000004393581,0.000680879200
|
| 3 |
+
362,0.000163802100,0.000004929604,0.000765145600
|
| 4 |
+
363,0.000184003700,0.000005532136,0.000860012400
|
| 5 |
+
364,0.000206690200,0.000006208245,0.000966592800
|
| 6 |
+
365,0.000232100000,0.000006965000,0.001086000000
|
| 7 |
+
366,0.000260728000,0.000007813219,0.001220586000
|
| 8 |
+
367,0.000293075000,0.000008767336,0.001372729000
|
| 9 |
+
368,0.000329388000,0.000009839844,0.001543579000
|
| 10 |
+
369,0.000369914000,0.000011043230,0.001734286000
|
| 11 |
+
370,0.000414900000,0.000012390000,0.001946000000
|
| 12 |
+
371,0.000464158700,0.000013886410,0.002177777000
|
| 13 |
+
372,0.000518986000,0.000015557280,0.002435809000
|
| 14 |
+
373,0.000581854000,0.000017442960,0.002731953000
|
| 15 |
+
374,0.000655234700,0.000019583750,0.003078064000
|
| 16 |
+
375,0.000741600000,0.000022020000,0.003486000000
|
| 17 |
+
376,0.000845029600,0.000024839650,0.003975227000
|
| 18 |
+
377,0.000964526800,0.000028041260,0.004540880000
|
| 19 |
+
378,0.001094949000,0.000031531040,0.005158320000
|
| 20 |
+
379,0.001231154000,0.000035215210,0.005802907000
|
| 21 |
+
380,0.001368000000,0.000039000000,0.006450001000
|
| 22 |
+
381,0.001502050000,0.000042826400,0.007083216000
|
| 23 |
+
382,0.001642328000,0.000046914600,0.007745488000
|
| 24 |
+
383,0.001802382000,0.000051589600,0.008501152000
|
| 25 |
+
384,0.001995757000,0.000057176400,0.009414544000
|
| 26 |
+
385,0.002236000000,0.000064000000,0.010549990000
|
| 27 |
+
386,0.002535385000,0.000072344210,0.011965800000
|
| 28 |
+
387,0.002892603000,0.000082212240,0.013655870000
|
| 29 |
+
388,0.003300829000,0.000093508160,0.015588050000
|
| 30 |
+
389,0.003753236000,0.000106136100,0.017730150000
|
| 31 |
+
390,0.004243000000,0.000120000000,0.020050010000
|
| 32 |
+
391,0.004762389000,0.000134984000,0.022511360000
|
| 33 |
+
392,0.005330048000,0.000151492000,0.025202880000
|
| 34 |
+
393,0.005978712000,0.000170208000,0.028279720000
|
| 35 |
+
394,0.006741117000,0.000191816000,0.031897040000
|
| 36 |
+
395,0.007650000000,0.000217000000,0.036210000000
|
| 37 |
+
396,0.008751373000,0.000246906700,0.041437710000
|
| 38 |
+
397,0.010028880000,0.000281240000,0.047503720000
|
| 39 |
+
398,0.011421700000,0.000318520000,0.054119880000
|
| 40 |
+
399,0.012869010000,0.000357266700,0.060998030000
|
| 41 |
+
400,0.014310000000,0.000396000000,0.067850010000
|
| 42 |
+
401,0.015704430000,0.000433714700,0.074486320000
|
| 43 |
+
402,0.017147440000,0.000473024000,0.081361560000
|
| 44 |
+
403,0.018781220000,0.000517876000,0.089153640000
|
| 45 |
+
404,0.020748010000,0.000572218700,0.098540480000
|
| 46 |
+
405,0.023190000000,0.000640000000,0.110200000000
|
| 47 |
+
406,0.026207360000,0.000724560000,0.124613300000
|
| 48 |
+
407,0.029782480000,0.000825500000,0.141701700000
|
| 49 |
+
408,0.033880920000,0.000941160000,0.161303500000
|
| 50 |
+
409,0.038468240000,0.001069880000,0.183256800000
|
| 51 |
+
410,0.043510000000,0.001210000000,0.207400000000
|
| 52 |
+
411,0.048995600000,0.001362091000,0.233692100000
|
| 53 |
+
412,0.055022600000,0.001530752000,0.262611400000
|
| 54 |
+
413,0.061718800000,0.001720368000,0.294774600000
|
| 55 |
+
414,0.069212000000,0.001935323000,0.330798500000
|
| 56 |
+
415,0.077630000000,0.002180000000,0.371300000000
|
| 57 |
+
416,0.086958110000,0.002454800000,0.416209100000
|
| 58 |
+
417,0.097176720000,0.002764000000,0.465464200000
|
| 59 |
+
418,0.108406300000,0.003117800000,0.519694800000
|
| 60 |
+
419,0.120767200000,0.003526400000,0.579530300000
|
| 61 |
+
420,0.134380000000,0.004000000000,0.645600000000
|
| 62 |
+
421,0.149358200000,0.004546240000,0.718483800000
|
| 63 |
+
422,0.165395700000,0.005159320000,0.796713300000
|
| 64 |
+
423,0.181983100000,0.005829280000,0.877845900000
|
| 65 |
+
424,0.198611000000,0.006546160000,0.959439000000
|
| 66 |
+
425,0.214770000000,0.007300000000,1.039050100000
|
| 67 |
+
426,0.230186800000,0.008086507000,1.115367300000
|
| 68 |
+
427,0.244879700000,0.008908720000,1.188497100000
|
| 69 |
+
428,0.258777300000,0.009767680000,1.258123300000
|
| 70 |
+
429,0.271807900000,0.010664430000,1.323929600000
|
| 71 |
+
430,0.283900000000,0.011600000000,1.385600000000
|
| 72 |
+
431,0.294943800000,0.012573170000,1.442635200000
|
| 73 |
+
432,0.304896500000,0.013582720000,1.494803500000
|
| 74 |
+
433,0.313787300000,0.014629680000,1.542190300000
|
| 75 |
+
434,0.321645400000,0.015715090000,1.584880700000
|
| 76 |
+
435,0.328500000000,0.016840000000,1.622960000000
|
| 77 |
+
436,0.334351300000,0.018007360000,1.656404800000
|
| 78 |
+
437,0.339210100000,0.019214480000,1.685295900000
|
| 79 |
+
438,0.343121300000,0.020453920000,1.709874500000
|
| 80 |
+
439,0.346129600000,0.021718240000,1.730382100000
|
| 81 |
+
440,0.348280000000,0.023000000000,1.747060000000
|
| 82 |
+
441,0.349599900000,0.024294610000,1.760044600000
|
| 83 |
+
442,0.350147400000,0.025610240000,1.769623300000
|
| 84 |
+
443,0.350013000000,0.026958570000,1.776263700000
|
| 85 |
+
444,0.349287000000,0.028351250000,1.780433400000
|
| 86 |
+
445,0.348060000000,0.029800000000,1.782600000000
|
| 87 |
+
446,0.346373300000,0.031310830000,1.782968200000
|
| 88 |
+
447,0.344262400000,0.032883680000,1.781699800000
|
| 89 |
+
448,0.341808800000,0.034521120000,1.779198200000
|
| 90 |
+
449,0.339094100000,0.036225710000,1.775867100000
|
| 91 |
+
450,0.336200000000,0.038000000000,1.772110000000
|
| 92 |
+
451,0.333197700000,0.039846670000,1.768258900000
|
| 93 |
+
452,0.330041100000,0.041768000000,1.764039000000
|
| 94 |
+
453,0.326635700000,0.043766000000,1.758943800000
|
| 95 |
+
454,0.322886800000,0.045842670000,1.752466300000
|
| 96 |
+
455,0.318700000000,0.048000000000,1.744100000000
|
| 97 |
+
456,0.314025100000,0.050243680000,1.733559500000
|
| 98 |
+
457,0.308884000000,0.052573040000,1.720858100000
|
| 99 |
+
458,0.303290400000,0.054980560000,1.705936900000
|
| 100 |
+
459,0.297257900000,0.057458720000,1.688737200000
|
| 101 |
+
460,0.290800000000,0.060000000000,1.669200000000
|
| 102 |
+
461,0.283970100000,0.062601970000,1.647528700000
|
| 103 |
+
462,0.276721400000,0.065277520000,1.623412700000
|
| 104 |
+
463,0.268917800000,0.068042080000,1.596022300000
|
| 105 |
+
464,0.260422700000,0.070911090000,1.564528000000
|
| 106 |
+
465,0.251100000000,0.073900000000,1.528100000000
|
| 107 |
+
466,0.240847500000,0.077016000000,1.486111400000
|
| 108 |
+
467,0.229851200000,0.080266400000,1.439521500000
|
| 109 |
+
468,0.218407200000,0.083666800000,1.389879900000
|
| 110 |
+
469,0.206811500000,0.087232800000,1.338736200000
|
| 111 |
+
470,0.195360000000,0.090980000000,1.287640000000
|
| 112 |
+
471,0.184213600000,0.094917550000,1.237422300000
|
| 113 |
+
472,0.173327300000,0.099045840000,1.187824300000
|
| 114 |
+
473,0.162688100000,0.103367400000,1.138761100000
|
| 115 |
+
474,0.152283300000,0.107884600000,1.090148000000
|
| 116 |
+
475,0.142100000000,0.112600000000,1.041900000000
|
| 117 |
+
476,0.132178600000,0.117532000000,0.994197600000
|
| 118 |
+
477,0.122569600000,0.122674400000,0.947347300000
|
| 119 |
+
478,0.113275200000,0.127992800000,0.901453100000
|
| 120 |
+
479,0.104297900000,0.133452800000,0.856619300000
|
| 121 |
+
480,0.095640000000,0.139020000000,0.812950100000
|
| 122 |
+
481,0.087299550000,0.144676400000,0.770517300000
|
| 123 |
+
482,0.079308040000,0.150469300000,0.729444800000
|
| 124 |
+
483,0.071717760000,0.156461900000,0.689913600000
|
| 125 |
+
484,0.064580990000,0.162717700000,0.652104900000
|
| 126 |
+
485,0.057950010000,0.169300000000,0.616200000000
|
| 127 |
+
486,0.051862110000,0.176243100000,0.582328600000
|
| 128 |
+
487,0.046281520000,0.183558100000,0.550416200000
|
| 129 |
+
488,0.041150880000,0.191273500000,0.520337600000
|
| 130 |
+
489,0.036412830000,0.199418000000,0.491967300000
|
| 131 |
+
490,0.032010000000,0.208020000000,0.465180000000
|
| 132 |
+
491,0.027917200000,0.217119900000,0.439924600000
|
| 133 |
+
492,0.024144400000,0.226734500000,0.416183600000
|
| 134 |
+
493,0.020687000000,0.236857100000,0.393882200000
|
| 135 |
+
494,0.017540400000,0.247481200000,0.372945900000
|
| 136 |
+
495,0.014700000000,0.258600000000,0.353300000000
|
| 137 |
+
496,0.012161790000,0.270184900000,0.334857800000
|
| 138 |
+
497,0.009919960000,0.282293900000,0.317552100000
|
| 139 |
+
498,0.007967240000,0.295050500000,0.301337500000
|
| 140 |
+
499,0.006296346000,0.308578000000,0.286168600000
|
| 141 |
+
500,0.004900000000,0.323000000000,0.272000000000
|
| 142 |
+
501,0.003777173000,0.338402100000,0.258817100000
|
| 143 |
+
502,0.002945320000,0.354685800000,0.246483800000
|
| 144 |
+
503,0.002424880000,0.371698600000,0.234771800000
|
| 145 |
+
504,0.002236293000,0.389287500000,0.223453300000
|
| 146 |
+
505,0.002400000000,0.407300000000,0.212300000000
|
| 147 |
+
506,0.002925520000,0.425629900000,0.201169200000
|
| 148 |
+
507,0.003836560000,0.444309600000,0.190119600000
|
| 149 |
+
508,0.005174840000,0.463394400000,0.179225400000
|
| 150 |
+
509,0.006982080000,0.482939500000,0.168560800000
|
| 151 |
+
510,0.009300000000,0.503000000000,0.158200000000
|
| 152 |
+
511,0.012149490000,0.523569300000,0.148138300000
|
| 153 |
+
512,0.015535880000,0.544512000000,0.138375800000
|
| 154 |
+
513,0.019477520000,0.565690000000,0.128994200000
|
| 155 |
+
514,0.023992770000,0.586965300000,0.120075100000
|
| 156 |
+
515,0.029100000000,0.608200000000,0.111700000000
|
| 157 |
+
516,0.034814850000,0.629345600000,0.103904800000
|
| 158 |
+
517,0.041120160000,0.650306800000,0.096667480000
|
| 159 |
+
518,0.047985040000,0.670875200000,0.089982720000
|
| 160 |
+
519,0.055378610000,0.690842400000,0.083845310000
|
| 161 |
+
520,0.063270000000,0.710000000000,0.078249990000
|
| 162 |
+
521,0.071635010000,0.728185200000,0.073208990000
|
| 163 |
+
522,0.080462240000,0.745463600000,0.068678160000
|
| 164 |
+
523,0.089739960000,0.761969400000,0.064567840000
|
| 165 |
+
524,0.099456450000,0.777836800000,0.060788350000
|
| 166 |
+
525,0.109600000000,0.793200000000,0.057250010000
|
| 167 |
+
526,0.120167400000,0.808110400000,0.053904350000
|
| 168 |
+
527,0.131114500000,0.822496200000,0.050746640000
|
| 169 |
+
528,0.142367900000,0.836306800000,0.047752760000
|
| 170 |
+
529,0.153854200000,0.849491600000,0.044898590000
|
| 171 |
+
530,0.165500000000,0.862000000000,0.042160000000
|
| 172 |
+
531,0.177257100000,0.873810800000,0.039507280000
|
| 173 |
+
532,0.189140000000,0.884962400000,0.036935640000
|
| 174 |
+
533,0.201169400000,0.895493600000,0.034458360000
|
| 175 |
+
534,0.213365800000,0.905443200000,0.032088720000
|
| 176 |
+
535,0.225749900000,0.914850100000,0.029840000000
|
| 177 |
+
536,0.238320900000,0.923734800000,0.027711810000
|
| 178 |
+
537,0.251066800000,0.932092400000,0.025694440000
|
| 179 |
+
538,0.263992200000,0.939922600000,0.023787160000
|
| 180 |
+
539,0.277101700000,0.947225200000,0.021989250000
|
| 181 |
+
540,0.290400000000,0.954000000000,0.020300000000
|
| 182 |
+
541,0.303891200000,0.960256100000,0.018718050000
|
| 183 |
+
542,0.317572600000,0.966007400000,0.017240360000
|
| 184 |
+
543,0.331438400000,0.971260600000,0.015863640000
|
| 185 |
+
544,0.345482800000,0.976022500000,0.014584610000
|
| 186 |
+
545,0.359700000000,0.980300000000,0.013400000000
|
| 187 |
+
546,0.374083900000,0.984092400000,0.012307230000
|
| 188 |
+
547,0.388639600000,0.987418200000,0.011301880000
|
| 189 |
+
548,0.403378400000,0.990312800000,0.010377920000
|
| 190 |
+
549,0.418311500000,0.992811600000,0.009529306000
|
| 191 |
+
550,0.433449900000,0.994950100000,0.008749999000
|
| 192 |
+
551,0.448795300000,0.996710800000,0.008035200000
|
| 193 |
+
552,0.464336000000,0.998098300000,0.007381600000
|
| 194 |
+
553,0.480064000000,0.999112000000,0.006785400000
|
| 195 |
+
554,0.495971300000,0.999748200000,0.006242800000
|
| 196 |
+
555,0.512050100000,1.000000000000,0.005749999000
|
| 197 |
+
556,0.528295900000,0.999856700000,0.005303600000
|
| 198 |
+
557,0.544691600000,0.999304600000,0.004899800000
|
| 199 |
+
558,0.561209400000,0.998325500000,0.004534200000
|
| 200 |
+
559,0.577821500000,0.996898700000,0.004202400000
|
| 201 |
+
560,0.594500000000,0.995000000000,0.003900000000
|
| 202 |
+
561,0.611220900000,0.992600500000,0.003623200000
|
| 203 |
+
562,0.627975800000,0.989742600000,0.003370600000
|
| 204 |
+
563,0.644760200000,0.986444400000,0.003141400000
|
| 205 |
+
564,0.661569700000,0.982724100000,0.002934800000
|
| 206 |
+
565,0.678400000000,0.978600000000,0.002749999000
|
| 207 |
+
566,0.695239200000,0.974083700000,0.002585200000
|
| 208 |
+
567,0.712058600000,0.969171200000,0.002438600000
|
| 209 |
+
568,0.728828400000,0.963856800000,0.002309400000
|
| 210 |
+
569,0.745518800000,0.958134900000,0.002196800000
|
| 211 |
+
570,0.762100000000,0.952000000000,0.002100000000
|
| 212 |
+
571,0.778543200000,0.945450400000,0.002017733000
|
| 213 |
+
572,0.794825600000,0.938499200000,0.001948200000
|
| 214 |
+
573,0.810926400000,0.931162800000,0.001889800000
|
| 215 |
+
574,0.826824800000,0.923457600000,0.001840933000
|
| 216 |
+
575,0.842500000000,0.915400000000,0.001800000000
|
| 217 |
+
576,0.857932500000,0.907006400000,0.001766267000
|
| 218 |
+
577,0.873081600000,0.898277200000,0.001737800000
|
| 219 |
+
578,0.887894400000,0.889204800000,0.001711200000
|
| 220 |
+
579,0.902318100000,0.879781600000,0.001683067000
|
| 221 |
+
580,0.916300000000,0.870000000000,0.001650001000
|
| 222 |
+
581,0.929799500000,0.859861300000,0.001610133000
|
| 223 |
+
582,0.942798400000,0.849392000000,0.001564400000
|
| 224 |
+
583,0.955277600000,0.838622000000,0.001513600000
|
| 225 |
+
584,0.967217900000,0.827581300000,0.001458533000
|
| 226 |
+
585,0.978600000000,0.816300000000,0.001400000000
|
| 227 |
+
586,0.989385600000,0.804794700000,0.001336667000
|
| 228 |
+
587,0.999548800000,0.793082000000,0.001270000000
|
| 229 |
+
588,1.009089200000,0.781192000000,0.001205000000
|
| 230 |
+
589,1.018006400000,0.769154700000,0.001146667000
|
| 231 |
+
590,1.026300000000,0.757000000000,0.001100000000
|
| 232 |
+
591,1.033982700000,0.744754100000,0.001068800000
|
| 233 |
+
592,1.040986000000,0.732422400000,0.001049400000
|
| 234 |
+
593,1.047188000000,0.720003600000,0.001035600000
|
| 235 |
+
594,1.052466700000,0.707496500000,0.001021200000
|
| 236 |
+
595,1.056700000000,0.694900000000,0.001000000000
|
| 237 |
+
596,1.059794400000,0.682219200000,0.000968640000
|
| 238 |
+
597,1.061799200000,0.669471600000,0.000929920000
|
| 239 |
+
598,1.062806800000,0.656674400000,0.000886880000
|
| 240 |
+
599,1.062909600000,0.643844800000,0.000842560000
|
| 241 |
+
600,1.062200000000,0.631000000000,0.000800000000
|
| 242 |
+
601,1.060735200000,0.618155500000,0.000760960000
|
| 243 |
+
602,1.058443600000,0.605314400000,0.000723680000
|
| 244 |
+
603,1.055224400000,0.592475600000,0.000685920000
|
| 245 |
+
604,1.050976800000,0.579637900000,0.000645440000
|
| 246 |
+
605,1.045600000000,0.566800000000,0.000600000000
|
| 247 |
+
606,1.039036900000,0.553961100000,0.000547866700
|
| 248 |
+
607,1.031360800000,0.541137200000,0.000491600000
|
| 249 |
+
608,1.022666200000,0.528352800000,0.000435400000
|
| 250 |
+
609,1.013047700000,0.515632300000,0.000383466700
|
| 251 |
+
610,1.002600000000,0.503000000000,0.000340000000
|
| 252 |
+
611,0.991367500000,0.490468800000,0.000307253300
|
| 253 |
+
612,0.979331400000,0.478030400000,0.000283160000
|
| 254 |
+
613,0.966491600000,0.465677600000,0.000265440000
|
| 255 |
+
614,0.952847900000,0.453403200000,0.000251813300
|
| 256 |
+
615,0.938400000000,0.441200000000,0.000240000000
|
| 257 |
+
616,0.923194000000,0.429080000000,0.000229546700
|
| 258 |
+
617,0.907244000000,0.417036000000,0.000220640000
|
| 259 |
+
618,0.890502000000,0.405032000000,0.000211960000
|
| 260 |
+
619,0.872920000000,0.393032000000,0.000202186700
|
| 261 |
+
620,0.854449900000,0.381000000000,0.000190000000
|
| 262 |
+
621,0.835084000000,0.368918400000,0.000174213300
|
| 263 |
+
622,0.814946000000,0.356827200000,0.000155640000
|
| 264 |
+
623,0.794186000000,0.344776800000,0.000135960000
|
| 265 |
+
624,0.772954000000,0.332817600000,0.000116853300
|
| 266 |
+
625,0.751400000000,0.321000000000,0.000100000000
|
| 267 |
+
626,0.729583600000,0.309338100000,0.000086133330
|
| 268 |
+
627,0.707588800000,0.297850400000,0.000074600000
|
| 269 |
+
628,0.685602200000,0.286593600000,0.000065000000
|
| 270 |
+
629,0.663810400000,0.275624500000,0.000056933330
|
| 271 |
+
630,0.642400000000,0.265000000000,0.000049999990
|
| 272 |
+
631,0.621514900000,0.254763200000,0.000044160000
|
| 273 |
+
632,0.601113800000,0.244889600000,0.000039480000
|
| 274 |
+
633,0.581105200000,0.235334400000,0.000035720000
|
| 275 |
+
634,0.561397700000,0.226052800000,0.000032640000
|
| 276 |
+
635,0.541900000000,0.217000000000,0.000030000000
|
| 277 |
+
636,0.522599500000,0.208161600000,0.000027653330
|
| 278 |
+
637,0.503546400000,0.199548800000,0.000025560000
|
| 279 |
+
638,0.484743600000,0.191155200000,0.000023640000
|
| 280 |
+
639,0.466193900000,0.182974400000,0.000021813330
|
| 281 |
+
640,0.447900000000,0.175000000000,0.000020000000
|
| 282 |
+
641,0.429861300000,0.167223500000,0.000018133330
|
| 283 |
+
642,0.412098000000,0.159646400000,0.000016200000
|
| 284 |
+
643,0.394644000000,0.152277600000,0.000014200000
|
| 285 |
+
644,0.377533300000,0.145125900000,0.000012133330
|
| 286 |
+
645,0.360800000000,0.138200000000,0.000010000000
|
| 287 |
+
646,0.344456300000,0.131500300000,0.000007733333
|
| 288 |
+
647,0.328516800000,0.125024800000,0.000005400000
|
| 289 |
+
648,0.313019200000,0.118779200000,0.000003200000
|
| 290 |
+
649,0.298001100000,0.112769100000,0.000001333333
|
| 291 |
+
650,0.283500000000,0.107000000000,0.000000000000
|
| 292 |
+
651,0.269544800000,0.101476200000,0.000000000000
|
| 293 |
+
652,0.256118400000,0.096188640000,0.000000000000
|
| 294 |
+
653,0.243189600000,0.091122960000,0.000000000000
|
| 295 |
+
654,0.230727200000,0.086264850000,0.000000000000
|
| 296 |
+
655,0.218700000000,0.081600000000,0.000000000000
|
| 297 |
+
656,0.207097100000,0.077120640000,0.000000000000
|
| 298 |
+
657,0.195923200000,0.072825520000,0.000000000000
|
| 299 |
+
658,0.185170800000,0.068710080000,0.000000000000
|
| 300 |
+
659,0.174832300000,0.064769760000,0.000000000000
|
| 301 |
+
660,0.164900000000,0.061000000000,0.000000000000
|
| 302 |
+
661,0.155366700000,0.057396210000,0.000000000000
|
| 303 |
+
662,0.146230000000,0.053955040000,0.000000000000
|
| 304 |
+
663,0.137490000000,0.050673760000,0.000000000000
|
| 305 |
+
664,0.129146700000,0.047549650000,0.000000000000
|
| 306 |
+
665,0.121200000000,0.044580000000,0.000000000000
|
| 307 |
+
666,0.113639700000,0.041758720000,0.000000000000
|
| 308 |
+
667,0.106465000000,0.039084960000,0.000000000000
|
| 309 |
+
668,0.099690440000,0.036563840000,0.000000000000
|
| 310 |
+
669,0.093330610000,0.034200480000,0.000000000000
|
| 311 |
+
670,0.087400000000,0.032000000000,0.000000000000
|
| 312 |
+
671,0.081900960000,0.029962610000,0.000000000000
|
| 313 |
+
672,0.076804280000,0.028076640000,0.000000000000
|
| 314 |
+
673,0.072077120000,0.026329360000,0.000000000000
|
| 315 |
+
674,0.067686640000,0.024708050000,0.000000000000
|
| 316 |
+
675,0.063600000000,0.023200000000,0.000000000000
|
| 317 |
+
676,0.059806850000,0.021800770000,0.000000000000
|
| 318 |
+
677,0.056282160000,0.020501120000,0.000000000000
|
| 319 |
+
678,0.052971040000,0.019281080000,0.000000000000
|
| 320 |
+
679,0.049818610000,0.018120690000,0.000000000000
|
| 321 |
+
680,0.046770000000,0.017000000000,0.000000000000
|
| 322 |
+
681,0.043784050000,0.015903790000,0.000000000000
|
| 323 |
+
682,0.040875360000,0.014837180000,0.000000000000
|
| 324 |
+
683,0.038072640000,0.013810680000,0.000000000000
|
| 325 |
+
684,0.035404610000,0.012834780000,0.000000000000
|
| 326 |
+
685,0.032900000000,0.011920000000,0.000000000000
|
| 327 |
+
686,0.030564190000,0.011068310000,0.000000000000
|
| 328 |
+
687,0.028380560000,0.010273390000,0.000000000000
|
| 329 |
+
688,0.026344840000,0.009533311000,0.000000000000
|
| 330 |
+
689,0.024452750000,0.008846157000,0.000000000000
|
| 331 |
+
690,0.022700000000,0.008210000000,0.000000000000
|
| 332 |
+
691,0.021084290000,0.007623781000,0.000000000000
|
| 333 |
+
692,0.019599880000,0.007085424000,0.000000000000
|
| 334 |
+
693,0.018237320000,0.006591476000,0.000000000000
|
| 335 |
+
694,0.016987170000,0.006138485000,0.000000000000
|
| 336 |
+
695,0.015840000000,0.005723000000,0.000000000000
|
| 337 |
+
696,0.014790640000,0.005343059000,0.000000000000
|
| 338 |
+
697,0.013831320000,0.004995796000,0.000000000000
|
| 339 |
+
698,0.012948680000,0.004676404000,0.000000000000
|
| 340 |
+
699,0.012129200000,0.004380075000,0.000000000000
|
| 341 |
+
700,0.011359160000,0.004102000000,0.000000000000
|
| 342 |
+
701,0.010629350000,0.003838453000,0.000000000000
|
| 343 |
+
702,0.009938846000,0.003589099000,0.000000000000
|
| 344 |
+
703,0.009288422000,0.003354219000,0.000000000000
|
| 345 |
+
704,0.008678854000,0.003134093000,0.000000000000
|
| 346 |
+
705,0.008110916000,0.002929000000,0.000000000000
|
| 347 |
+
706,0.007582388000,0.002738139000,0.000000000000
|
| 348 |
+
707,0.007088746000,0.002559876000,0.000000000000
|
| 349 |
+
708,0.006627313000,0.002393244000,0.000000000000
|
| 350 |
+
709,0.006195408000,0.002237275000,0.000000000000
|
| 351 |
+
710,0.005790346000,0.002091000000,0.000000000000
|
| 352 |
+
711,0.005409826000,0.001953587000,0.000000000000
|
| 353 |
+
712,0.005052583000,0.001824580000,0.000000000000
|
| 354 |
+
713,0.004717512000,0.001703580000,0.000000000000
|
| 355 |
+
714,0.004403507000,0.001590187000,0.000000000000
|
| 356 |
+
715,0.004109457000,0.001484000000,0.000000000000
|
| 357 |
+
716,0.003833913000,0.001384496000,0.000000000000
|
| 358 |
+
717,0.003575748000,0.001291268000,0.000000000000
|
| 359 |
+
718,0.003334342000,0.001204092000,0.000000000000
|
| 360 |
+
719,0.003109075000,0.001122744000,0.000000000000
|
| 361 |
+
720,0.002899327000,0.001047000000,0.000000000000
|
| 362 |
+
721,0.002704348000,0.000976589600,0.000000000000
|
| 363 |
+
722,0.002523020000,0.000911108800,0.000000000000
|
| 364 |
+
723,0.002354168000,0.000850133200,0.000000000000
|
| 365 |
+
724,0.002196616000,0.000793238400,0.000000000000
|
| 366 |
+
725,0.002049190000,0.000740000000,0.000000000000
|
| 367 |
+
726,0.001910960000,0.000690082700,0.000000000000
|
| 368 |
+
727,0.001781438000,0.000643310000,0.000000000000
|
| 369 |
+
728,0.001660110000,0.000599496000,0.000000000000
|
| 370 |
+
729,0.001546459000,0.000558454700,0.000000000000
|
| 371 |
+
730,0.001439971000,0.000520000000,0.000000000000
|
| 372 |
+
731,0.001340042000,0.000483913600,0.000000000000
|
| 373 |
+
732,0.001246275000,0.000450052800,0.000000000000
|
| 374 |
+
733,0.001158471000,0.000418345200,0.000000000000
|
| 375 |
+
734,0.001076430000,0.000388718400,0.000000000000
|
| 376 |
+
735,0.000999949300,0.000361100000,0.000000000000
|
| 377 |
+
736,0.000928735800,0.000335383500,0.000000000000
|
| 378 |
+
737,0.000862433200,0.000311440400,0.000000000000
|
| 379 |
+
738,0.000800750300,0.000289165600,0.000000000000
|
| 380 |
+
739,0.000743396000,0.000268453900,0.000000000000
|
| 381 |
+
740,0.000690078600,0.000249200000,0.000000000000
|
| 382 |
+
741,0.000640515600,0.000231301900,0.000000000000
|
| 383 |
+
742,0.000594502100,0.000214685600,0.000000000000
|
| 384 |
+
743,0.000551864600,0.000199288400,0.000000000000
|
| 385 |
+
744,0.000512429000,0.000185047500,0.000000000000
|
| 386 |
+
745,0.000476021300,0.000171900000,0.000000000000
|
| 387 |
+
746,0.000442453600,0.000159778100,0.000000000000
|
| 388 |
+
747,0.000411511700,0.000148604400,0.000000000000
|
| 389 |
+
748,0.000382981400,0.000138301600,0.000000000000
|
| 390 |
+
749,0.000356649100,0.000128792500,0.000000000000
|
| 391 |
+
750,0.000332301100,0.000120000000,0.000000000000
|
| 392 |
+
751,0.000309758600,0.000111859500,0.000000000000
|
| 393 |
+
752,0.000288887100,0.000104322400,0.000000000000
|
| 394 |
+
753,0.000269539400,0.000097335600,0.000000000000
|
| 395 |
+
754,0.000251568200,0.000090845870,0.000000000000
|
| 396 |
+
755,0.000234826100,0.000084800000,0.000000000000
|
| 397 |
+
756,0.000219171000,0.000079146670,0.000000000000
|
| 398 |
+
757,0.000204525800,0.000073858000,0.000000000000
|
| 399 |
+
758,0.000190840500,0.000068916000,0.000000000000
|
| 400 |
+
759,0.000178065400,0.000064302670,0.000000000000
|
| 401 |
+
760,0.000166150500,0.000060000000,0.000000000000
|
| 402 |
+
761,0.000155023600,0.000055981870,0.000000000000
|
| 403 |
+
762,0.000144621900,0.000052225600,0.000000000000
|
| 404 |
+
763,0.000134909800,0.000048718400,0.000000000000
|
| 405 |
+
764,0.000125852000,0.000045447470,0.000000000000
|
| 406 |
+
765,0.000117413000,0.000042400000,0.000000000000
|
| 407 |
+
766,0.000109551500,0.000039561040,0.000000000000
|
| 408 |
+
767,0.000102224500,0.000036915120,0.000000000000
|
| 409 |
+
768,0.000095394450,0.000034448680,0.000000000000
|
| 410 |
+
769,0.000089023900,0.000032148160,0.000000000000
|
| 411 |
+
770,0.000083075270,0.000030000000,0.000000000000
|
| 412 |
+
771,0.000077512690,0.000027991250,0.000000000000
|
| 413 |
+
772,0.000072313040,0.000026113560,0.000000000000
|
| 414 |
+
773,0.000067457780,0.000024360240,0.000000000000
|
| 415 |
+
774,0.000062928440,0.000022724610,0.000000000000
|
| 416 |
+
775,0.000058706520,0.000021200000,0.000000000000
|
| 417 |
+
776,0.000054770280,0.000019778550,0.000000000000
|
| 418 |
+
777,0.000051099180,0.000018452850,0.000000000000
|
| 419 |
+
778,0.000047676540,0.000017216870,0.000000000000
|
| 420 |
+
779,0.000044485670,0.000016064590,0.000000000000
|
| 421 |
+
780,0.000041509940,0.000014990000,0.000000000000
|
| 422 |
+
781,0.000038733240,0.000013987280,0.000000000000
|
| 423 |
+
782,0.000036142030,0.000013051550,0.000000000000
|
| 424 |
+
783,0.000033723520,0.000012178180,0.000000000000
|
| 425 |
+
784,0.000031464870,0.000011362540,0.000000000000
|
| 426 |
+
785,0.000029353260,0.000010600000,0.000000000000
|
| 427 |
+
786,0.000027375730,0.000009885877,0.000000000000
|
| 428 |
+
787,0.000025524330,0.000009217304,0.000000000000
|
| 429 |
+
788,0.000023793760,0.000008592362,0.000000000000
|
| 430 |
+
789,0.000022178700,0.000008009133,0.000000000000
|
| 431 |
+
790,0.000020673830,0.000007465700,0.000000000000
|
| 432 |
+
791,0.000019272260,0.000006959567,0.000000000000
|
| 433 |
+
792,0.000017966400,0.000006487995,0.000000000000
|
| 434 |
+
793,0.000016749910,0.000006048699,0.000000000000
|
| 435 |
+
794,0.000015616480,0.000005639396,0.000000000000
|
| 436 |
+
795,0.000014559770,0.000005257800,0.000000000000
|
| 437 |
+
796,0.000013573870,0.000004901771,0.000000000000
|
| 438 |
+
797,0.000012654360,0.000004569720,0.000000000000
|
| 439 |
+
798,0.000011797230,0.000004260194,0.000000000000
|
| 440 |
+
799,0.000010998440,0.000003971739,0.000000000000
|
| 441 |
+
800,0.000010253980,0.000003702900,0.000000000000
|
| 442 |
+
801,0.000009559646,0.000003452163,0.000000000000
|
| 443 |
+
802,0.000008912044,0.000003218302,0.000000000000
|
| 444 |
+
803,0.000008308358,0.000003000300,0.000000000000
|
| 445 |
+
804,0.000007745769,0.000002797139,0.000000000000
|
| 446 |
+
805,0.000007221456,0.000002607800,0.000000000000
|
| 447 |
+
806,0.000006732475,0.000002431220,0.000000000000
|
| 448 |
+
807,0.000006276423,0.000002266531,0.000000000000
|
| 449 |
+
808,0.000005851304,0.000002113013,0.000000000000
|
| 450 |
+
809,0.000005455118,0.000001969943,0.000000000000
|
| 451 |
+
810,0.000005085868,0.000001836600,0.000000000000
|
| 452 |
+
811,0.000004741466,0.000001712230,0.000000000000
|
| 453 |
+
812,0.000004420236,0.000001596228,0.000000000000
|
| 454 |
+
813,0.000004120783,0.000001488090,0.000000000000
|
| 455 |
+
814,0.000003841716,0.000001387314,0.000000000000
|
| 456 |
+
815,0.000003581652,0.000001293400,0.000000000000
|
| 457 |
+
816,0.000003339127,0.000001205820,0.000000000000
|
| 458 |
+
817,0.000003112949,0.000001124143,0.000000000000
|
| 459 |
+
818,0.000002902121,0.000001048009,0.000000000000
|
| 460 |
+
819,0.000002705645,0.000000977058,0.000000000000
|
| 461 |
+
820,0.000002522525,0.000000910930,0.000000000000
|
| 462 |
+
821,0.000002351726,0.000000849251,0.000000000000
|
| 463 |
+
822,0.000002192415,0.000000791721,0.000000000000
|
| 464 |
+
823,0.000002043902,0.000000738090,0.000000000000
|
| 465 |
+
824,0.000001905497,0.000000688110,0.000000000000
|
| 466 |
+
825,0.000001776509,0.000000641530,0.000000000000
|
| 467 |
+
826,0.000001656215,0.000000598090,0.000000000000
|
| 468 |
+
827,0.000001544022,0.000000557575,0.000000000000
|
| 469 |
+
828,0.000001439440,0.000000519808,0.000000000000
|
| 470 |
+
829,0.000001341977,0.000000484612,0.000000000000
|
| 471 |
+
830,0.000001251141,0.000000451810,0.000000000000
|
outputs/expansion_batch04/t3_analytical/jeol_jsmit200/optics_fit.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"catalog_id": "CHEM-151",
|
| 3 |
+
"built_at": "2026-09-26T00:05:56.714310+00:00",
|
| 4 |
+
"script": "derive_optics_parameters.py",
|
| 5 |
+
"model": "d^2 = 4I/(pi^2 beta a^2) + (Cs a^3/2)^2 + (Cc a dE/E0)^2 + (1.22 lambda/a)^2 at the optimum a; quoted resolution = K_RES d",
|
| 6 |
+
"fixed": {
|
| 7 |
+
"beta_reduced_A_m2_sr_V": 33333.333333333336,
|
| 8 |
+
"energy_spread_eV": 1.5,
|
| 9 |
+
"test_probe_current_A": 3e-12,
|
| 10 |
+
"edge_resolution_factor": 0.6,
|
| 11 |
+
"lens_gap_m": 0.002
|
| 12 |
+
},
|
| 13 |
+
"fitted": {
|
| 14 |
+
"c_s": 0.9315669301523783,
|
| 15 |
+
"c_c": 0.1320663205093771,
|
| 16 |
+
"Cs_at_8mm_m": 0.009315669301523784,
|
| 17 |
+
"Cc_at_8mm_m": 0.001320663205093771,
|
| 18 |
+
"rms_log_error": 0.026419401556548577
|
| 19 |
+
},
|
| 20 |
+
"bed_lv_resolution_factor": 1.430569028448803,
|
| 21 |
+
"reproduced": [
|
| 22 |
+
{
|
| 23 |
+
"kv": 30.0,
|
| 24 |
+
"wd_mm": 8.0,
|
| 25 |
+
"catalogue_nm": 3.0,
|
| 26 |
+
"model_nm": 3.0619849421713834,
|
| 27 |
+
"probe_nm": 5.103308236952305,
|
| 28 |
+
"alpha_mrad": 8.151742790420595,
|
| 29 |
+
"rel_error": 0.020661647390461058
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"kv": 3.0,
|
| 33 |
+
"wd_mm": 6.0,
|
| 34 |
+
"catalogue_nm": 8.0,
|
| 35 |
+
"model_nm": 7.707058783048531,
|
| 36 |
+
"probe_nm": 12.845097971747553,
|
| 37 |
+
"alpha_mrad": 10.985859336200035,
|
| 38 |
+
"rel_error": -0.03661765211893364
|
| 39 |
+
},
|
| 40 |
+
{
|
| 41 |
+
"kv": 1.0,
|
| 42 |
+
"wd_mm": 6.0,
|
| 43 |
+
"catalogue_nm": 14.999999999999998,
|
| 44 |
+
"model_nm": 15.254949626593532,
|
| 45 |
+
"probe_nm": 25.424916044322558,
|
| 46 |
+
"alpha_mrad": 10.62139488762313,
|
| 47 |
+
"rel_error": 0.016996641772902388
|
| 48 |
+
}
|
| 49 |
+
],
|
| 50 |
+
"lv": {
|
| 51 |
+
"catalogue_nm": 4.0,
|
| 52 |
+
"wd_m": 0.005,
|
| 53 |
+
"pressure_pa": 10.0,
|
| 54 |
+
"hv_model_nm_at_that_wd": 2.7960901714314943
|
| 55 |
+
},
|
| 56 |
+
"caveat_zh": "β与Cs、ΔE与Cc互相替代,拟合不唯一;常数是能复现目录分辨率的等效模型,不是实测透镜数据。",
|
| 57 |
+
"environment": {
|
| 58 |
+
"python": "3.12.14",
|
| 59 |
+
"numpy": "2.3.1",
|
| 60 |
+
"platform": "Linux-x86_64"
|
| 61 |
+
},
|
| 62 |
+
"checks": [
|
| 63 |
+
{
|
| 64 |
+
"id": "fit_within_5_percent",
|
| 65 |
+
"ok": true,
|
| 66 |
+
"detail": [
|
| 67 |
+
0.0207,
|
| 68 |
+
-0.0366,
|
| 69 |
+
0.017
|
| 70 |
+
]
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"id": "cs_cc_positive_and_finite",
|
| 74 |
+
"ok": true,
|
| 75 |
+
"detail": [
|
| 76 |
+
0.9315669301523783,
|
| 77 |
+
0.1320663205093771
|
| 78 |
+
]
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"id": "bed_factor_above_one",
|
| 82 |
+
"ok": true,
|
| 83 |
+
"detail": 1.430569028448803
|
| 84 |
+
}
|
| 85 |
+
],
|
| 86 |
+
"status": "passed"
|
| 87 |
+
}
|
scripts/asset_runtime/ametek_oxtran.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
scripts/asset_runtime/lakeshore_8604vsm.py
ADDED
|
@@ -0,0 +1,518 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Lake Shore8604, room-temperature86-LC/standard poles/ExactGAP2.
|
| 2 |
+
SI magnetic moment A m2 (1 emu=1e-3 A m2). Rate-limited external B,
|
| 3 |
+
explicit interval-mean lock-in observations, synthetic Preisach memory when
|
| 4 |
+
requested, and separately conserved electrical/magnetic/passive-thermal energy.
|
| 5 |
+
"""
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
import copy,importlib.util,json,math
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
import numpy as np
|
| 10 |
+
PROTOCOL_VERSION='1.0.0';SLUG='lakeshore_8604vsm';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-143'
|
| 11 |
+
ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'magnetic_library.json'
|
| 12 |
+
MU0=4e-7*math.pi;MAX_FIELD_T=2.37;FIELD_RESOLUTION_T=1e-7;MIN_MOMENT_A_M2=2.5e-11;MAX_MOMENT_A_M2=1.
|
| 13 |
+
class ActionRejected(ValueError):pass
|
| 14 |
+
|
| 15 |
+
def number(unit='1',lo=None,hi=None):
|
| 16 |
+
s={'type':'number','x-unit':unit}
|
| 17 |
+
if lo is not None:s['minimum']=lo
|
| 18 |
+
if hi is not None:s['maximum']=hi
|
| 19 |
+
return s
|
| 20 |
+
|
| 21 |
+
def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False)
|
| 22 |
+
def nullable(s):return {'anyOf':[s,{'type':'null'}]}
|
| 23 |
+
def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum)
|
| 24 |
+
def enum(items):return {'type':'string','enum':items}
|
| 25 |
+
BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed'])
|
| 26 |
+
|
| 27 |
+
def validate(s,v):
|
| 28 |
+
if 'anyOf' in s:
|
| 29 |
+
for o in s['anyOf']:
|
| 30 |
+
try:validate(o,v);return
|
| 31 |
+
except ActionRejected:pass
|
| 32 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 33 |
+
k=s.get('type')
|
| 34 |
+
if k in ('number','integer'):
|
| 35 |
+
if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 36 |
+
elif k=='object':
|
| 37 |
+
if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT')
|
| 38 |
+
for key,value in v.items():validate(s['properties'][key],value)
|
| 39 |
+
elif k=='array':
|
| 40 |
+
if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 41 |
+
for x in v:validate(s['items'],x)
|
| 42 |
+
elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT')
|
| 43 |
+
elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT')
|
| 44 |
+
elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT')
|
| 45 |
+
if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT')
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def library():return {x['id']:x for x in json.loads(LIBRARY_PATH.read_text())['templates']}
|
| 49 |
+
def quant(value,resolution):return float(round(value/resolution)*resolution)
|
| 50 |
+
def weighted_exponential_integrals(dt,tau):
|
| 51 |
+
x=dt/tau
|
| 52 |
+
if x<.5:
|
| 53 |
+
out=[]
|
| 54 |
+
for n in range(3):
|
| 55 |
+
term=1/(n+1);total=term
|
| 56 |
+
for k in range(1,30):term*=-x/(n+k+1);total+=term
|
| 57 |
+
out.append(dt**(n+1)*total)
|
| 58 |
+
return out
|
| 59 |
+
j0=-tau*math.expm1(-x);j1=tau*dt-tau*j0;return j0,j1,tau*dt*dt-2*tau*j1
|
| 60 |
+
|
| 61 |
+
def infer_moment(voltage_v,sensitivity_v_per_a_m2,calibration_gain,calibration_offset_v):
|
| 62 |
+
if sensitivity_v_per_a_m2<=0 or calibration_gain<=0:raise ActionRejected('CALIBRATION_INVALID')
|
| 63 |
+
return (voltage_v-calibration_offset_v)*calibration_gain/sensitivity_v_per_a_m2
|
| 64 |
+
|
| 65 |
+
def analyze_loop(rows):
|
| 66 |
+
if len(rows)<3 or any(x['moment_a_m2'] is None for x in rows):raise ActionRejected('INVALID_OBSERVATIONS')
|
| 67 |
+
crossings=[];remanence=[]
|
| 68 |
+
for a,b in zip(rows,rows[1:]):
|
| 69 |
+
b0,b1=a['field_t'],b['field_t'];m0,m1=a['moment_a_m2'],b['moment_a_m2'];direction='ascending' if b1>b0 else 'descending'
|
| 70 |
+
if b0==b1:continue
|
| 71 |
+
if m0*m1<=0 and m0!=m1:
|
| 72 |
+
value=b0-m0*(b1-b0)/(m1-m0);crossings.append(dict(field_t=value,external_h_a_m=value/MU0,direction=direction))
|
| 73 |
+
if b0*b1<=0:
|
| 74 |
+
value=m0-b0*(m1-m0)/(b1-b0);remanence.append(dict(moment_a_m2=value,direction=direction))
|
| 75 |
+
area=float(sum((a['field_t']+b['field_t'])*.5*(b['moment_a_m2']-a['moment_a_m2']) for a,b in zip(rows,rows[1:])))
|
| 76 |
+
return dict(coercive_crossings=crossings,remanence_estimates=remanence,observed_b_dm_j=area,evidence='external_observations_linear_zero_crossings; applied_B_over_mu0_is_external_H_not_demagnetization_corrected_internal_H; open_path_integral_not_necessarily_cycle_loss')
|
| 77 |
+
|
| 78 |
+
def analyze_forc(rows):
|
| 79 |
+
valid=[r for r in rows if r['reversal_field_t'] is not None]
|
| 80 |
+
if len(valid)<6 or any(r['moment_a_m2'] is None for r in valid):raise ActionRejected('INVALID_OBSERVATIONS')
|
| 81 |
+
x=np.array([[r['field_t'],r['reversal_field_t']] for r in valid]);y=np.array([r['moment_a_m2'] for r in valid]);scale=float(np.ptp(x,axis=0).max())
|
| 82 |
+
if scale<=0 or len(set(x[:,1]))<3:raise ActionRejected('FORC_GRID_REQUIRED')
|
| 83 |
+
out=[]
|
| 84 |
+
for i,point in enumerate(x):
|
| 85 |
+
ids=np.argsort(np.linalg.norm(x-point,axis=1))[:min(15,len(x))];q=(x[ids]-point)/scale;A=np.column_stack([np.ones(len(q)),q[:,0],q[:,1],q[:,0]**2,q[:,0]*q[:,1],q[:,1]**2])
|
| 86 |
+
if np.linalg.matrix_rank(A)<6:continue
|
| 87 |
+
c=np.linalg.lstsq(A,y[ids],rcond=None)[0];out.append(dict(field_t=float(point[0]),reversal_field_t=float(point[1]),coercive_coordinate_t=float((point[0]-point[1])/2),interaction_coordinate_t=float((point[0]+point[1])/2),density_a_m2_per_t2=float(-.5*c[4]/scale**2),fit_residual_a_m2=float(np.sqrt(np.mean((A@c-y[ids])**2))),neighbours=len(ids)))
|
| 88 |
+
if not out:raise ActionRejected('FORC_GRID_REQUIRED')
|
| 89 |
+
return dict(distribution=out,evidence='local_quadratic_fit_to_external_FORC_observations; rho=-0.5*d2m/(dB*dBr); SI_A_m2_per_T2; not_unique_material_microstructure_or_FORCinel_reproduction')
|
| 90 |
+
|
| 91 |
+
PLANT_EXAMPLE=dict(ambient_k=300.,field_per_current_t_a=.04,coil_inductance_h=.05,coil_resistance_ohm=.25,magnet_thermal_capacity_j_k=5000.,magnet_cooling_conductance_w_k=50.,sample_local_capacity_j_k=.01,sample_conductance_w_k=.01,pickup_coupling_wb_per_a_m3=.1,voltage_gain=1.03,voltage_offset_v=2e-7,detector_tau_s=.01,lift_speed_m_s=.1,rotation_speed_rad_s=1.,drawer_speed_m_s=.1,accept_engineering=True)
|
| 92 |
+
PLANT=obj({k:(BOOL if type(v) is bool else number({'ambient_k':'K','field_per_current_t_a':'T/A','coil_inductance_h':'H','coil_resistance_ohm':'ohm','magnet_thermal_capacity_j_k':'J/K','magnet_cooling_conductance_w_k':'W/K','sample_local_capacity_j_k':'J/K','sample_conductance_w_k':'W/K','pickup_coupling_wb_per_a_m3':'Wb/(A*m^3)','voltage_gain':'1','voltage_offset_v':'V','detector_tau_s':'s','lift_speed_m_s':'m/s','rotation_speed_rad_s':'rad/s','drawer_speed_m_s':'m/s'}[k], -1. if k=='voltage_offset_v' else 1e-12)) for k,v in PLANT_EXAMPLE.items()})
|
| 93 |
+
PLANT['properties']['ambient_k']=number('K',285,303)
|
| 94 |
+
VIBRATION_EXAMPLE=dict(enabled=True,amplitude_m=.0005,frequency_hz=82.)
|
| 95 |
+
VIBRATION=obj(dict(enabled=BOOL,amplitude_m=number('m',1e-6,.001),frequency_hz=number('Hz',1,200)))
|
| 96 |
+
COIL_EXAMPLE=dict(nominal_coupling_wb_per_a_m3=.1,moment_range_a_m2=.01)
|
| 97 |
+
COIL=obj(dict(nominal_coupling_wb_per_a_m3=number('Wb/(A*m^3)',1e-10,1e6),moment_range_a_m2=number('A*m^2',MIN_MOMENT_A_M2,MAX_MOMENT_A_M2)))
|
| 98 |
+
RELAY=obj(dict(coercive_field_t=number('T',1e-8,10),bias_field_t=number('T',-10,10),weight=number('1',1e-12,1),initial_sign={'type':'integer','enum':[-1,1],'x-unit':'1'}))
|
| 99 |
+
RELAYS_EXAMPLE=[dict(coercive_field_t=v,bias_field_t=0.,weight=1/5,initial_sign=-1) for v in [.02,.035,.05,.065,.08]]
|
| 100 |
+
SAMPLE_EXAMPLE=dict(reference_id='kuleuven_cf_300k',mass_kg=5e-5,volume_m3=math.pi*(.001)**2*.002,specific_heat_capacity_j_kg_k=650.,initial_temperature_k=300.,temperature_tolerance_k=.5,linear_valid_max_field_t=.6,magnetic_model='preisach_proxy',proxy_specific_moment_a_m2_kg=None,relays=RELAYS_EXAMPLE,accept_engineering_assumptions=True)
|
| 101 |
+
SAMPLE=obj(dict(reference_id=TEXT,mass_kg=number('kg',0,.01),volume_m3=number('m^3',1e-15,1e-5),specific_heat_capacity_j_kg_k=number('J/(kg*K)',1,1e5),initial_temperature_k=number('K',285,303),temperature_tolerance_k=number('K',0,5),linear_valid_max_field_t=number('T',1e-7,MAX_FIELD_T),magnetic_model=enum(['linear_susceptibility','preisach_proxy']),proxy_specific_moment_a_m2_kg=nullable(number('A*m^2/kg',0,1e5)),relays=array(RELAY,1,1000),accept_engineering_assumptions=BOOL))
|
| 102 |
+
STANDARD_EXAMPLE=dict(mass_kg=.00006316,volume_m3=math.pi/6*.002383**3,specific_heat_capacity_j_kg_k=440.,initial_temperature_k=298.,reference_field_t=MU0*398000.,reference_moment_a_m2=.00347,accept_host_standard_proxy=True)
|
| 103 |
+
STANDARD=obj(dict(mass_kg=number('kg',0,.01),volume_m3=number('m^3',1e-15,1e-5),specific_heat_capacity_j_kg_k=number('J/(kg*K)',1,1e5),initial_temperature_k=number('K',285,303),reference_field_t=number('T',1e-7,MAX_FIELD_T),reference_moment_a_m2=number('A*m^2',MIN_MOMENT_A_M2,MAX_MOMENT_A_M2),accept_host_standard_proxy=BOOL))
|
| 104 |
+
METHOD_EXAMPLE=dict(field_points_t=[.2,.1,.075,.05,.025,0.,-.025,-.05,-.075,-.1,-.2,-.1,-.075,-.05,-.025,0.,.025,.05,.075,.1,.2],ramp_rate_t_s=1.,averaging_time_s=.05,settling_time_s=.05,require_calibration=False)
|
| 105 |
+
METHOD=obj(dict(field_points_t=array(number('T',-MAX_FIELD_T,MAX_FIELD_T),1,50000),ramp_rate_t_s=number('T/s',1e-6,1),averaging_time_s=number('s',.01,3600),settling_time_s=number('s',0,3600),require_calibration=BOOL))
|
| 106 |
+
FORC_EXAMPLE=dict(saturation_field_t=.2,reversal_fields_t=[-.12,-.08,-.04,0.],points_per_curve=9,ramp_rate_t_s=1.,averaging_time_s=.05,settling_time_s=.05,require_calibration=False)
|
| 107 |
+
FORC=obj(dict(saturation_field_t=number('T',1e-7,MAX_FIELD_T),reversal_fields_t=array(number('T',-MAX_FIELD_T,MAX_FIELD_T),3,1000),points_per_curve={'type':'integer','minimum':3,'maximum':1000,'x-unit':'1'},ramp_rate_t_s=number('T/s',1e-6,1),averaging_time_s=number('s',.01,3600),settling_time_s=number('s',0,3600),require_calibration=BOOL))
|
| 108 |
+
ROW=obj(dict(point_index={'type':'integer','x-unit':'1'},field_t=number('T'),external_h_a_m=number('A/m'),in_phase_voltage_v=number('V'),moment_a_m2=nullable(number('A*m^2')),angle_rad=number('rad'),window_start_s=number('s'),window_end_s=number('s'),reversal_field_t=nullable(number('T')),quality=enum(['estimated','below_documented_dynamic_range','overflow','reference_temperature_invalid'])))
|
| 109 |
+
RESULT=obj(dict(operation_id=nullable(TEXT),phase=PHASE,kind=TEXT,elapsed_s=number('s'),rows=array(ROW),error=nullable(TEXT),template_source=nullable(TEXT),evidence=TEXT))
|
| 110 |
+
LEDGER_KEYS=['loaded_mass_kg','removed_mass_kg','mass_kg','mass_residual_kg','loaded_volume_m3','removed_volume_m3','volume_m3','volume_residual_m3','source_energy_j','coil_joule_j','magnetic_work_j','hysteresis_heat_j','sample_sensible_loaded_j','sample_sensible_removed_j','magnetic_loaded_j','magnetic_removed_j','coil_stored_j','magnetic_stored_j','sample_thermal_j','magnet_thermal_j','sample_heat_export_j','magnet_heat_export_j','energy_residual_j']
|
| 111 |
+
LEDGER=obj({k:number('kg' if k.endswith('_kg') else 'm^3' if k.endswith('_m3') else 'J') for k in LEDGER_KEYS})
|
| 112 |
+
CROSS=obj(dict(field_t=number('T'),external_h_a_m=number('A/m'),direction=enum(['ascending','descending'])))
|
| 113 |
+
LOOP_OUTPUT=obj(dict(coercive_crossings=array(CROSS),remanence_estimates=array(obj(dict(moment_a_m2=number('A*m^2'),direction=enum(['ascending','descending'])))),observed_b_dm_j=number('J'),evidence=TEXT))
|
| 114 |
+
FORC_OUTPUT=obj(dict(distribution=array(obj(dict(field_t=number('T'),reversal_field_t=number('T'),coercive_coordinate_t=number('T'),interaction_coordinate_t=number('T'),density_a_m2_per_t2=number('A*m^2/T^2'),fit_residual_a_m2=number('A*m^2'),neighbours={'type':'integer','x-unit':'1'}))),evidence=TEXT))
|
| 115 |
+
CAPS={}
|
| 116 |
+
def cap(k,s,o,example,component,meaning,visibility='agent',kind='device_command'):CAPS[k]=dict(input_schema=s,output_schema=o,example_arguments=example,component_ids=[component],function_zh=meaning,visibility=visibility,kind=kind,effects=[])
|
| 117 |
+
for key,schema,example,component in [('plant.configure',PLANT,PLANT_EXAMPLE,'magnet'),('coil.configure',COIL,COIL_EXAMPLE,'controller'),('method.configure',METHOD,METHOD_EXAMPLE,'controller'),('forc.configure',FORC,FORC_EXAMPLE,'controller')]:cap(key,schema,obj(dict(configured=BOOL)),example,component,'设置明确工程参数或采集方法;不推进时间','evaluator' if key=='plant.configure' else 'agent','configuration')
|
| 118 |
+
cap('sample.load',SAMPLE,obj(dict(present=BOOL)),SAMPLE_EXAMPLE,'sample','载入真实磁性参考与显式磁滞/热假设','evaluator')
|
| 119 |
+
cap('standard.load',STANDARD,obj(dict(present=BOOL)),STANDARD_EXAMPLE,'sample','宿主装入已知磁矩标准代理;真实标准证书并非对本仿真认证','evaluator')
|
| 120 |
+
cap('sample.remove',obj({}),obj(dict(removed_mass_kg=number('kg'),removed_volume_m3=number('m^3'))),{},'sample','取走磁性库存、质量和当前显热','evaluator')
|
| 121 |
+
cap('power.set',obj(dict(enabled=BOOL)),obj(dict(enabled=BOOL)),{'enabled':True},'power_switch','控制电源;非零场拒绝断电以免瞬间销毁储能')
|
| 122 |
+
cap('field.set_target',obj(dict(field_t=number('T',-MAX_FIELD_T,MAX_FIELD_T),ramp_rate_t_s=number('T/s',1e-6,1))),obj(dict(target_t=number('T'))),dict(field_t=.1,ramp_rate_t_s=1.),'power_supply','只写量化目标,B由step以有限速率推进')
|
| 123 |
+
cap('sample.set_lift',obj(dict(lift_m=number('m',0,.35))),obj(dict(target_m=number('m'))),dict(lift_m=0.),'head_lift','电动测量头有限速率升降,需零场/振动关闭')
|
| 124 |
+
cap('sample.set_angle',obj(dict(angle_rad=number('rad',-1e6,1e6))),obj(dict(target_rad=number('rad'))),dict(angle_rad=math.pi/2),'sample_rotor','零外场、关闭振动后以0.1度设置分辨有限旋转')
|
| 125 |
+
cap('storage.set_open',obj(dict(opened=BOOL)),obj(dict(target_m=number('m'))),dict(opened=True),'storage_drawer','手工抽屉工程有限运动代理','evaluator')
|
| 126 |
+
cap('vibration.configure',VIBRATION,obj(dict(enabled=BOOL)),VIBRATION_EXAMPLE,'vibration_carriage','配置振动工程频率幅度;解析采样姿态与锁相包络,非完整波形求解')
|
| 127 |
+
cap('calibration.start',obj(dict(reference_moment_a_m2=number('A*m^2',MIN_MOMENT_A_M2,1),field_t=number('T',1e-6,MAX_FIELD_T),averaging_time_s=number('s',.01,3600))),obj(dict(operation_id=TEXT)),dict(reference_moment_a_m2=.00347,field_t=MU0*398000.,averaging_time_s=1.),'controller','实际正负场积分观测拟合增益/零偏,不读隐藏真实增益')
|
| 128 |
+
cap('calibration.clear',obj({}),obj(dict(valid=BOOL)),{},'controller','清除校准')
|
| 129 |
+
cap('acquisition.start',obj({}),obj(dict(operation_id=TEXT)),{},'controller','依有限扫场、等待、真实积分采集loop或FORC')
|
| 130 |
+
cap('acquisition.stop',obj({}),obj(dict(phase=PHASE,elapsed_s=number('s'))),{},'controller','保留完成读数及磁记忆/热账,停止扫场于实际值')
|
| 131 |
+
cap('acquisition.result',obj({}),RESULT,{},'controller','返回实际区间观测及明确合成模型标记','agent','query')
|
| 132 |
+
cap('analysis.loop',obj(dict(rows=array(ROW,3))),LOOP_OUTPUT,dict(rows=[]),'controller','从外部曲线估计零场剩磁、零矩外场矫顽与路径功','agent','analysis')
|
| 133 |
+
cap('analysis.forc',obj(dict(rows=array(ROW,6))),FORC_OUTPUT,dict(rows=[]),'controller','从外部FORC局部二次拟合混合导数','agent','analysis')
|
| 134 |
+
cap('analysis.moment',obj(dict(voltage_v=number('V'),sensitivity_v_per_a_m2=number('V/(A*m^2)',1e-12),calibration_gain=number('1',1e-12),calibration_offset_v=number('V'))),obj(dict(moment_a_m2=number('A*m^2'))),dict(voltage_v=.001,sensitivity_v_per_a_m2=1.,calibration_gain=1.,calibration_offset_v=0.),'controller','仅按外部电压/校准/灵敏度反演磁矩','agent','analysis')
|
| 135 |
+
cap('provenance.read',obj({}),obj(dict(current_sample=nullable(TEXT),operation_source=nullable(TEXT))),{},'controller','选中来源与测量来源快照仅限宿主','evaluator','query')
|
| 136 |
+
cap('ledger.read',obj({}),LEDGER,{},'controller','受限样品库存及有范围的电磁热能账','evaluator','query')
|
| 137 |
+
cap('sim.step',obj(dict(dt_s=number('s',0,86400))),obj(dict(time_s=number('s'))),dict(dt_s=.02),'controller','唯一宿主时钟','evaluator','simulation')
|
| 138 |
+
UNSUPPORTED={'hardware.connect':'没有真实驱动','robot.load':'没有机器人装样','thermal.set_temperature':'未选温控附件,不能给基础仪器假加热器','magnet.change_gap':'固定标准极帽Gap2,无在线极距/高场帽切换','measurement.vector':'未选矢量线圈','noise.empirical':'无独立实测噪声模型,不从15nemu规格虚构分布','accuracy.certification':'未验证厂家条件准确度','analysis.unique_forc_from_major_loop':'majorloop不能唯一决定FORC或微结构'}
|
| 139 |
+
for k,v in UNSUPPORTED.items():cap(k,obj({}),obj({}),{},'controller',v)
|
| 140 |
+
SLOTS={}
|
| 141 |
+
def slot(k,s,unit,origin,component,meaning,visibility='agent'):SLOTS[k]=dict(schema=s,unit=unit,origin=origin,component=component,meaning=meaning,visibility=visibility,write=None)
|
| 142 |
+
slot('clock.time_s',number('s'),'s','derived','controller','宿主统一仿真时钟,read不推进')
|
| 143 |
+
for k in ['plant.configured','coil.configured','method.configured','sample.present','power.enabled','vibration.enabled','calibration.valid']:slot(k,BOOL,'1','setpoint','controller','已配置/存在/启用状态;不是完整计量认证')
|
| 144 |
+
for k in ['sample.lift_m','sample.target_lift_m','storage.position_m','storage.target_m']:slot(k,number('m'),'m','scene' if 'target' not in k else 'setpoint','head_lift' if k.startswith('sample') else 'storage_drawer','实际有限运动位置或目标,单位m;只由宿主step推进')
|
| 145 |
+
for k in ['sample.angle_rad','sample.target_angle_rad','sample.orientation_rad']:slot(k,number('rad'),'rad','scene' if 'target' not in k else 'setpoint','sample_rotor','无界累计转角/目标及周期等价场景姿态;不是磁性各向异性实测参数')
|
| 146 |
+
slot('sample.vibration_z_m',number('m'),'m','scene','vibration_carriage','工程正弦振动解析时刻姿态;场景采样可混叠,不声称解析全频运动')
|
| 147 |
+
slot('power.angle_rad',number('rad'),'rad','scene','power_switch','开关显示姿态代理')
|
| 148 |
+
for k in ['field.target_t','field.indicated_t']:slot(k,nullable(number('T')) if 'indicated' in k else number('T'),'T','sensor' if 'indicated' in k else 'setpoint','hall_probe','Gap2外施空气场B或量化目标;100nT分辨;不是样品内部B')
|
| 149 |
+
slot('field.external_h_a_m',nullable(number('A/m')),'A/m','derived','hall_probe','外场B/μ0,未做样品退磁场修正')
|
| 150 |
+
slot('moment.indicated_a_m2',nullable(number('A*m^2')),'A*m^2','sensor','controller','锁相包络估算磁矩;1emu=1e-3 A m²,掉电/未开振动不可用')
|
| 151 |
+
slot('detector.in_phase_v',nullable(number('V')),'V','sensor','controller','有符号锁相同相电压包络含工程一阶响应,不是负RMS幅值')
|
| 152 |
+
for k in ['thermal.sample_k','thermal.magnet_k']:slot(k,nullable(number('K')),'K','sensor','sample' if 'sample' in k else 'magnet','模型被动集中热节点;不是温控附件或整机热容')
|
| 153 |
+
slot('acquisition.phase',PHASE,'1','derived','controller','异步操作终态或运行态')
|
| 154 |
+
slot('acquisition.stage',TEXT,'1','derived','controller','ramping/settling/averaging,均等待真实host时间')
|
| 155 |
+
slot('acquisition.elapsed_s',number('s'),'s','derived','controller','操作实际已耗时间')
|
| 156 |
+
slot('acquisition.points',{'type':'integer','x-unit':'1'},'1','derived','controller','已完成积分观测数')
|
| 157 |
+
slot('calibration.gain',number(),'1','derived','controller','外部±已知磁矩与实际观测拟合出的乘性校正')
|
| 158 |
+
slot('calibration.offset_v',number('V'),'V','derived','controller','外部双极标准观测拟合出的电压零偏')
|
| 159 |
+
for k,u in [('truth.field_t','T'),('truth.moment_a_m2','A*m^2'),('truth.mass_kg','kg'),('truth.sample_k','K')]:slot(k,number(u),u,'process_truth','sample','受限过程真值,公共结果不透出材料身份','evaluator')
|
| 160 |
+
|
| 161 |
+
class LakeShore8604VsmRuntime:
|
| 162 |
+
def __init__(self,instance_id='vsm_01'):
|
| 163 |
+
self.instance_id=instance_id;self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.power=False;self.plant=None;self.coil=None;self.method=None;self.sample=None;self.record=None;self.source=None
|
| 164 |
+
self.axes={k:dict(position=v,target=v,start=v,start_ns=0,arrival_ns=0) for k,v in [('field',0.),('lift',.35),('angle',0.),('drawer',0.)]};self.ramp_rate=1.
|
| 165 |
+
self.vibration=dict(enabled=False,amplitude_m=.0005,frequency_hz=82.);self.sensor=0.;self.sample_k=300.;self.magnet_k=300.;self.linear_coefficient=0.;self.relays=[];self.amplitudes=[]
|
| 166 |
+
self.calibration_valid=False;self.calibration_gain=1.;self.calibration_offset=0.;self.phase='idle';self.stage='idle';self.elapsed=0.;self.rows=[];self.operation_id=None;self.operation_kind='none';self.error=None;self._counter=0;self._operation_source=None;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._event_ns=None;self._sequence=[];self._index=0;self._v_integral=0.;self._b_integral=0.
|
| 167 |
+
self.book={k:0. for k in ['loaded_mass_kg','removed_mass_kg','loaded_volume_m3','removed_volume_m3','source_energy_j','coil_joule_j','magnetic_work_j','hysteresis_heat_j','sample_sensible_loaded_j','sample_sensible_removed_j','magnetic_loaded_j','magnetic_removed_j','sample_heat_export_j','magnet_heat_export_j']}
|
| 168 |
+
@property
|
| 169 |
+
def time_s(self):return self.time_ns/1e9
|
| 170 |
+
def register_principal(self,name,visibility):
|
| 171 |
+
if not isinstance(name,str) or not name or visibility not in ('agent','evaluator','debug') or name in self._principals:raise ActionRejected('INVALID_ARGUMENT')
|
| 172 |
+
self._principals[name]=visibility
|
| 173 |
+
def session(self,name):
|
| 174 |
+
if name not in self._principals:raise ActionRejected('ACCESS_DENIED')
|
| 175 |
+
return LakeShore8604VsmSession(self,name)
|
| 176 |
+
def _pos(self,k):return self.axes[k]['position']
|
| 177 |
+
def _moving(self,k):return self.time_ns<self.axes[k]['arrival_ns']
|
| 178 |
+
def _speed(self,k):return self.ramp_rate if k=='field' else self.plant[{'lift':'lift_speed_m_s','angle':'rotation_speed_rad_s','drawer':'drawer_speed_m_s'}[k]]
|
| 179 |
+
def _target(self,k,value):
|
| 180 |
+
a=self.axes[k];distance=abs(value-a['position']);a.update(start=a['position'],target=float(value),start_ns=self.time_ns,arrival_ns=self.time_ns+int(math.ceil(distance/self._speed(k)*1e9)))
|
| 181 |
+
def _rate(self,k):
|
| 182 |
+
a=self.axes[k]
|
| 183 |
+
return (a['target']-a['start'])/((a['arrival_ns']-a['start_ns'])/1e9) if self._moving(k) else 0.
|
| 184 |
+
def _positions(self):
|
| 185 |
+
for a in self.axes.values():a['position']=a['target'] if self.time_ns>=a['arrival_ns'] else a['start']+(a['target']-a['start'])*(self.time_ns-a['start_ns'])/(a['arrival_ns']-a['start_ns'])
|
| 186 |
+
def _capacity(self):return self.plant['sample_local_capacity_j_k']+(self.sample['mass_kg']*self.sample['specific_heat_capacity_j_kg_k'] if self.sample else 0.)
|
| 187 |
+
def _sensitivity(self,actual=False):
|
| 188 |
+
if not self.coil:return 0.
|
| 189 |
+
coupling=self.plant['pickup_coupling_wb_per_a_m3'] if actual else self.coil['nominal_coupling_wb_per_a_m3']
|
| 190 |
+
return coupling*self.vibration['amplitude_m']*2*math.pi*self.vibration['frequency_hz']/math.sqrt(2)
|
| 191 |
+
def _moment(self,B=None):
|
| 192 |
+
B=self._pos('field') if B is None else B;c=math.cos(self._pos('angle'))
|
| 193 |
+
return self.linear_coefficient*B+sum(a*r['state'] for a,r in zip(self.amplitudes,self.relays))*c
|
| 194 |
+
def _magnetic_energy(self):return .5*self.linear_coefficient*self._pos('field')**2+sum(a*r['bias_field_t']*r['state'] for a,r in zip(self.amplitudes,self.relays))
|
| 195 |
+
def _temperature_valid(self):
|
| 196 |
+
if not self.sample or self.sample.get('standard'):return True
|
| 197 |
+
nominal=self.record.get('reference_temperature_K');interval=self.record.get('valid_temperature_range_K')
|
| 198 |
+
if nominal is not None and abs(self.sample_k-nominal)>self.sample['temperature_tolerance_k']+1e-9:return False
|
| 199 |
+
if interval and interval[1]-interval[0]>1e-9 and not interval[0]-1e-9<=self.sample_k<=interval[1]+1e-9:return False
|
| 200 |
+
return abs(self.sample_k-self.sample['initial_temperature_k'])<=self.sample['temperature_tolerance_k']+1e-9
|
| 201 |
+
def ledger(self):
|
| 202 |
+
d=copy.deepcopy(self.book);mass=self.sample['mass_kg'] if self.sample else 0.;volume=self.sample['volume_m3'] if self.sample else 0.;d.update(mass_kg=mass,mass_residual_kg=d['loaded_mass_kg']-d['removed_mass_kg']-mass,volume_m3=volume,volume_residual_m3=d['loaded_volume_m3']-d['removed_volume_m3']-volume,coil_stored_j=0.,magnetic_stored_j=self._magnetic_energy(),sample_thermal_j=0.,magnet_thermal_j=0.)
|
| 203 |
+
if self.plant:d.update(coil_stored_j=.5*self.plant['coil_inductance_h']*(self._pos('field')/self.plant['field_per_current_t_a'])**2,sample_thermal_j=self._capacity()*(self.sample_k-self.plant['ambient_k']),magnet_thermal_j=self.plant['magnet_thermal_capacity_j_k']*(self.magnet_k-self.plant['ambient_k']))
|
| 204 |
+
d['energy_residual_j']=d['source_energy_j']+d['sample_sensible_loaded_j']+d['magnetic_loaded_j']-d['sample_sensible_removed_j']-d['magnetic_removed_j']-sum(d[k] for k in ['coil_stored_j','magnetic_stored_j','sample_thermal_j','magnet_thermal_j','sample_heat_export_j','magnet_heat_export_j']);return d
|
| 205 |
+
def read(self,visibility='agent'):
|
| 206 |
+
indicated=None
|
| 207 |
+
if self.power and self.vibration['enabled'] and self.coil:
|
| 208 |
+
inferred=infer_moment(self.sensor,self._sensitivity(),self.calibration_gain,self.calibration_offset)
|
| 209 |
+
if abs(inferred)<=self.coil['moment_range_a_m2'] and self._temperature_valid():indicated=inferred
|
| 210 |
+
field=quant(self._pos('field'),FIELD_RESOLUTION_T) if self.power else None
|
| 211 |
+
d={'clock.time_s':self.time_s,'plant.configured':self.plant is not None,'coil.configured':self.coil is not None,'method.configured':self.method is not None,'sample.present':self.sample is not None,'power.enabled':self.power,'vibration.enabled':self.vibration['enabled'],'calibration.valid':self.calibration_valid,'sample.lift_m':self._pos('lift'),'sample.target_lift_m':self.axes['lift']['target'],'storage.position_m':self._pos('drawer'),'storage.target_m':self.axes['drawer']['target'],'sample.angle_rad':self._pos('angle'),'sample.target_angle_rad':self.axes['angle']['target'],'sample.orientation_rad':math.atan2(math.sin(self._pos('angle')),math.cos(self._pos('angle'))),'sample.vibration_z_m':self.vibration['amplitude_m']*math.sin(2*math.pi*self.vibration['frequency_hz']*self.time_s) if self.power and self.vibration['enabled'] else 0.,'power.angle_rad':.28 if self.power else 0.,'field.target_t':self.axes['field']['target'],'field.indicated_t':field,'field.external_h_a_m':None if field is None else field/MU0,'moment.indicated_a_m2':indicated,'detector.in_phase_v':self.sensor if self.power and self.vibration['enabled'] else None,'thermal.sample_k':self.sample_k if self.plant else None,'thermal.magnet_k':self.magnet_k if self.plant else None,'acquisition.phase':self.phase,'acquisition.stage':self.stage,'acquisition.elapsed_s':self.elapsed,'acquisition.points':len(self.rows),'calibration.gain':self.calibration_gain,'calibration.offset_v':self.calibration_offset,'truth.field_t':self._pos('field'),'truth.moment_a_m2':self._moment(),'truth.mass_kg':self.sample['mass_kg'] if self.sample else 0.,'truth.sample_k':self.sample_k}
|
| 212 |
+
return {k:copy.deepcopy(v) for k,v in d.items() if visibility!='agent' or SLOTS[k]['visibility']=='agent'}
|
| 213 |
+
def _propagate(self,ns):
|
| 214 |
+
dt=ns/1e9
|
| 215 |
+
if dt<=0 or not self.plant:return
|
| 216 |
+
p=self.plant;B0=self._pos('field');rate=self._rate('field');B1=B0+rate*dt;I0=B0/p['field_per_current_t_a'];I1=B1/p['field_per_current_t_a'];r=p['coil_resistance_ohm']/p['field_per_current_t_a']**2
|
| 217 |
+
joule=r*(B0*B0*dt+B0*rate*dt*dt+rate*rate*dt**3/3);dcoil=.5*p['coil_inductance_h']*(I1*I1-I0*I0);dmag=.5*self.linear_coefficient*(B1*B1-B0*B0)
|
| 218 |
+
self.book['coil_joule_j']+=joule;self.book['magnetic_work_j']+=dmag;self.book['source_energy_j']+=joule+dcoil+dmag
|
| 219 |
+
C=p['magnet_thermal_capacity_j_k'];G=p['magnet_cooling_conductance_w_k'];tau=C/G;before=C*(self.magnet_k-p['ambient_k']);j0,j1,j2=weighted_exponential_integrals(dt,tau);after=before*math.exp(-dt/tau)+r*(B0*B0*j0+2*B0*rate*j1+rate*rate*j2);self.magnet_k=p['ambient_k']+after/C;self.book['magnet_heat_export_j']+=joule-(after-before)
|
| 220 |
+
C=self._capacity();before=C*(self.sample_k-p['ambient_k']);after=before*math.exp(-p['sample_conductance_w_k']*dt/C);self.sample_k=p['ambient_k']+after/C;self.book['sample_heat_export_j']+=before-after
|
| 221 |
+
active=self.power and self.vibration['enabled'];gain=p['voltage_gain']*self._sensitivity(True) if active else 0.;f0=gain*self._moment(B0)+(p['voltage_offset_v'] if active else 0.);f1=gain*self.linear_coefficient*rate;old=self.sensor;tau=p['detector_tau_s'];self.sensor=f0+f1*(dt-tau)+(old-f0+f1*tau)*math.exp(-dt/tau)
|
| 222 |
+
if self.phase=='running' and self.stage=='averaging':self._v_integral+=f0*dt+.5*f1*dt*dt-tau*(self.sensor-old);self._b_integral+=B0*dt+.5*rate*dt*dt
|
| 223 |
+
def _next_switch(self):
|
| 224 |
+
B=self._pos('field');c=math.cos(self._pos('angle'));v=self._rate('field')*c
|
| 225 |
+
if not v:return None
|
| 226 |
+
times=[]
|
| 227 |
+
for r in self.relays:
|
| 228 |
+
if v>0 and r['state']<0:threshold=r['bias_field_t']+r['coercive_field_t']
|
| 229 |
+
elif v<0 and r['state']>0:threshold=r['bias_field_t']-r['coercive_field_t']
|
| 230 |
+
else:continue
|
| 231 |
+
dt=(threshold-B*c)/v
|
| 232 |
+
if dt>=-1e-12:times.append(self.time_ns+max(1,int(math.ceil(dt*1e9-1e-7))))
|
| 233 |
+
return min(times) if times else None
|
| 234 |
+
def _switch(self):
|
| 235 |
+
B=self._pos('field');c=math.cos(self._pos('angle'));effective=B*c
|
| 236 |
+
for amplitude,r in zip(self.amplitudes,self.relays):
|
| 237 |
+
state=1 if effective>=r['bias_field_t']+r['coercive_field_t']-1e-12 else -1 if effective<=r['bias_field_t']-r['coercive_field_t']+1e-12 else r['state']
|
| 238 |
+
if state==r['state']:continue
|
| 239 |
+
dm=amplitude*(state-r['state']);work=effective*dm;stored=r['bias_field_t']*dm;heat=work-stored
|
| 240 |
+
if heat<-1e-12:raise RuntimeError('Nonpassive relay switch')
|
| 241 |
+
r['state']=state;self.book['magnetic_work_j']+=work;self.book['source_energy_j']+=work;self.book['hysteresis_heat_j']+=heat;self.sample_k+=heat/self._capacity()
|
| 242 |
+
def _result(self):
|
| 243 |
+
if self.phase!='running' and self.operation_id in self.records:return copy.deepcopy(self.records[self.operation_id])
|
| 244 |
+
return dict(operation_id=self.operation_id,phase=self.phase,kind=self.operation_kind,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),error=self.error,template_source=self._operation_source,evidence='synthetic_forward_model; actual_host_time_interval_observations; measured_reference_anchor_is_not_measured_this_loop_or_FORC')
|
| 245 |
+
def _finish(self,phase,error=None):
|
| 246 |
+
self.phase=phase;self.stage='idle';self.error=error;self._event_ns=None
|
| 247 |
+
if self.operation_id:self.records[self.operation_id]=dict(operation_id=self.operation_id,phase=phase,kind=self.operation_kind,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),error=error,template_source=self._operation_source,evidence='synthetic_forward_model; actual_host_time_interval_observations; measured_reference_anchor_is_not_measured_this_loop_or_FORC')
|
| 248 |
+
def _begin_point(self):
|
| 249 |
+
point=self._sequence[self._index];self.ramp_rate=self._job_method['ramp_rate_t_s'];self._target('field',point['field_t']);self.stage='ramping';self._event_ns=self.axes['field']['arrival_ns']
|
| 250 |
+
def _advance(self):
|
| 251 |
+
while self.phase=='running' and self._event_ns<=self.time_ns:
|
| 252 |
+
if self.stage=='ramping':self.stage='settling';self._event_ns=self.time_ns+round(self._job_method['settling_time_s']*1e9)
|
| 253 |
+
elif self.stage=='settling':
|
| 254 |
+
if not self._sequence[self._index]['record']:
|
| 255 |
+
self._index+=1;self._begin_point();continue
|
| 256 |
+
self.stage='averaging';self._window_start_ns=self.time_ns;self._v_integral=0.;self._b_integral=0.;self._event_ns=self.time_ns+round(self._job_method['averaging_time_s']*1e9)
|
| 257 |
+
else:
|
| 258 |
+
dt=(self.time_ns-self._window_start_ns)/1e9;v=self._v_integral/dt;B=quant(self._b_integral/dt,FIELD_RESOLUTION_T);moment=infer_moment(v,self._sensitivity(),self.calibration_gain,self.calibration_offset);quality='estimated';error=None
|
| 259 |
+
if abs(moment)>self.coil['moment_range_a_m2']:quality='overflow';error='MOMENT_OVERFLOW';moment=None
|
| 260 |
+
elif not self._temperature_valid():quality='reference_temperature_invalid';error='REFERENCE_TEMPERATURE_RANGE';moment=None
|
| 261 |
+
elif abs(moment)<MIN_MOMENT_A_M2:quality='below_documented_dynamic_range'
|
| 262 |
+
self.rows.append(dict(point_index=len(self.rows),field_t=B,external_h_a_m=B/MU0,in_phase_voltage_v=v,moment_a_m2=moment,angle_rad=self._pos('angle'),window_start_s=self._window_start_ns/1e9,window_end_s=self.time_s,reversal_field_t=self._sequence[self._index]['reversal_field_t'],quality=quality))
|
| 263 |
+
if error:self._finish('failed',error);break
|
| 264 |
+
self._index+=1
|
| 265 |
+
if self._index==len(self._sequence):
|
| 266 |
+
if self.operation_kind=='calibration':
|
| 267 |
+
vplus,vminus=[r['in_phase_voltage_v'] for r in self.rows];den=vplus-vminus
|
| 268 |
+
if den<=0:self._finish('failed','CALIBRATION_INVALID');break
|
| 269 |
+
self.calibration_gain=2*self._cal_reference*self._sensitivity()/den;self.calibration_offset=(vplus+vminus)/2;self.calibration_valid=True
|
| 270 |
+
self._finish('succeeded');break
|
| 271 |
+
self._begin_point()
|
| 272 |
+
def _load_guard(self):
|
| 273 |
+
if not self.plant:raise ActionRejected('NOT_CONFIGURED')
|
| 274 |
+
if self.sample:raise ActionRejected('SAMPLE_PRESENT')
|
| 275 |
+
if self._pos('lift')<.34 or self._moving('lift') or self._moving('angle') or self.vibration['enabled'] or abs(self._pos('field'))>1e-10 or self._moving('field'):raise ActionRejected('LOADING_POSITION_REQUIRED')
|
| 276 |
+
def _field_guard(self,values):
|
| 277 |
+
if self.sample and not self.sample.get('standard') and any(abs(x)>self.sample['linear_valid_max_field_t']+1e-12 for x in values):raise ActionRejected('HOST_MAGNETIC_VALIDITY_RANGE')
|
| 278 |
+
def invoke(self,capability,**a):
|
| 279 |
+
if capability not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 280 |
+
validate(CAPS[capability]['input_schema'],a)
|
| 281 |
+
if capability in UNSUPPORTED:raise ActionRejected('UNSUPPORTED')
|
| 282 |
+
if capability=='acquisition.result':return self._result()
|
| 283 |
+
if capability=='ledger.read':return self.ledger()
|
| 284 |
+
if capability=='provenance.read':return dict(current_sample=self.source,operation_source=self._operation_source)
|
| 285 |
+
if capability=='analysis.loop':return analyze_loop(a['rows'])
|
| 286 |
+
if capability=='analysis.forc':return analyze_forc(a['rows'])
|
| 287 |
+
if capability=='analysis.moment':return dict(moment_a_m2=infer_moment(**a))
|
| 288 |
+
if capability=='sim.step':self.step(a['dt_s']);return dict(time_s=self.time_s)
|
| 289 |
+
if self.phase=='running' and capability not in ('acquisition.stop','power.set'):raise ActionRejected('BUSY')
|
| 290 |
+
if capability=='plant.configure':
|
| 291 |
+
if self.plant or self.sample or self.power:raise ActionRejected('ALREADY_CONFIGURED')
|
| 292 |
+
if not a['accept_engineering']:raise ActionRejected('EXPLICIT_ASSUMPTIONS_REQUIRED')
|
| 293 |
+
I=MAX_FIELD_T/a['field_per_current_t_a'];V=a['coil_resistance_ohm']*I+a['coil_inductance_h']/a['field_per_current_t_a']
|
| 294 |
+
if I>70+1e-12 or V>35+1e-12 or I*V>2450+1e-12:raise ActionRejected('POWER_SUPPLY_ENVELOPE')
|
| 295 |
+
self.plant=copy.deepcopy(a);self.sample_k=self.magnet_k=a['ambient_k'];out=dict(configured=True)
|
| 296 |
+
elif capability=='coil.configure':self.coil=copy.deepcopy(a);self.calibration_valid=False;self.calibration_gain=1.;self.calibration_offset=0.;out=dict(configured=True)
|
| 297 |
+
elif capability in ('method.configure','forc.configure'):
|
| 298 |
+
if capability=='forc.configure':
|
| 299 |
+
quantized=[quant(x,FIELD_RESOLUTION_T) for x in a['reversal_fields_t']];saturation=quant(a['saturation_field_t'],FIELD_RESOLUTION_T)
|
| 300 |
+
if any(x>=saturation for x in quantized) or len(set(quantized))!=len(quantized) or len(quantized)*(a['points_per_curve']+1)>50000:raise ActionRejected('FORC_GRID_REQUIRED')
|
| 301 |
+
a=copy.deepcopy(a);a['reversal_fields_t']=quantized;a['saturation_field_t']=saturation
|
| 302 |
+
self.method=copy.deepcopy(a);self.method['kind']='forc' if capability=='forc.configure' else 'points';out=dict(configured=True)
|
| 303 |
+
elif capability in ('sample.load','standard.load'):
|
| 304 |
+
self._load_guard();standard=capability=='standard.load';record=None;relays=[];amplitudes=[];linear=0.
|
| 305 |
+
if standard:
|
| 306 |
+
if not a['accept_host_standard_proxy']:raise ActionRejected('EXPLICIT_ASSUMPTIONS_REQUIRED')
|
| 307 |
+
linear=a['reference_moment_a_m2']/a['reference_field_t'];source=json.dumps(dict(kind='host_linear_calibrant_proxy',numerical_example_anchor='NIST772a298K398kA_m_not_certificate_validation'),sort_keys=True)
|
| 308 |
+
else:
|
| 309 |
+
if not a['accept_engineering_assumptions']:raise ActionRejected('EXPLICIT_ASSUMPTIONS_REQUIRED')
|
| 310 |
+
record=library().get(a['reference_id'])
|
| 311 |
+
if record is None:raise ActionRejected('UNKNOWN_REFERENCE')
|
| 312 |
+
temp=record.get('reference_temperature_K');domain=record.get('valid_temperature_range_K')
|
| 313 |
+
if temp is not None and abs(a['initial_temperature_k']-temp)>a['temperature_tolerance_k'] or domain and domain[1]-domain[0]>1e-9 and not domain[0]<=a['initial_temperature_k']<=domain[1]:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 314 |
+
chi=record.get('molar_susceptibility_m3_mol');molar_mass=record.get('molar_mass_kg_mol')
|
| 315 |
+
if chi is not None and molar_mass is not None:linear=a['mass_kg']/molar_mass*chi/MU0
|
| 316 |
+
if a['magnetic_model']=='linear_susceptibility' and (chi is None or molar_mass is None):raise ActionRejected('REFERENCE_PROPERTY_MISSING')
|
| 317 |
+
if a['magnetic_model']=='preisach_proxy':
|
| 318 |
+
value=a['proxy_specific_moment_a_m2_kg']
|
| 319 |
+
if value is None:value=record.get('measured_specific_moment_max_abs_a_m2_kg')
|
| 320 |
+
if value is None:raise ActionRejected('EXPLICIT_PROXY_AMPLITUDE_REQUIRED')
|
| 321 |
+
if not math.isclose(sum(r['weight'] for r in a['relays']),1.,rel_tol=0,abs_tol=1e-10):raise ActionRejected('RELAY_WEIGHTS')
|
| 322 |
+
for r in a['relays']:
|
| 323 |
+
if r['bias_field_t']+r['coercive_field_t']<=0 and r['initial_sign']<0 or r['bias_field_t']-r['coercive_field_t']>=0 and r['initial_sign']>0:raise ActionRejected('INCONSISTENT_INITIAL_MAGNETIC_STATE')
|
| 324 |
+
relays=[dict(r,state=r['initial_sign']) for r in a['relays']];amplitudes=[a['mass_kg']*value*r['weight'] for r in relays]
|
| 325 |
+
source=json.dumps(record.get('source'),sort_keys=True,ensure_ascii=False)
|
| 326 |
+
p=copy.deepcopy(a);p['standard']=standard;C0=self._capacity();old=C0*(self.sample_k-self.plant['ambient_k']);incoming=a['mass_kg']*a['specific_heat_capacity_j_kg_k']*(a['initial_temperature_k']-self.plant['ambient_k']);self.sample=p;self.record=record;self.source=source;self.linear_coefficient=linear;self.relays=relays;self.amplitudes=amplitudes;self.sample_k=self.plant['ambient_k']+(old+incoming)/self._capacity();self.book['sample_sensible_loaded_j']+=incoming;self.book['magnetic_loaded_j']+=self._magnetic_energy();self.book['loaded_mass_kg']+=a['mass_kg'];self.book['loaded_volume_m3']+=a['volume_m3'];out=dict(present=True)
|
| 327 |
+
elif capability=='sample.remove':
|
| 328 |
+
if not self.sample:raise ActionRejected('NO_SAMPLE')
|
| 329 |
+
if self._pos('lift')<.34 or self._moving('lift') or self.vibration['enabled'] or abs(self._pos('field'))>1e-10 or self._moving('field'):raise ActionRejected('LOADING_POSITION_REQUIRED')
|
| 330 |
+
m=self.sample['mass_kg'];v=self.sample['volume_m3'];self.book['removed_mass_kg']+=m;self.book['removed_volume_m3']+=v;self.book['sample_sensible_removed_j']+=m*self.sample['specific_heat_capacity_j_kg_k']*(self.sample_k-self.plant['ambient_k']);self.book['magnetic_removed_j']+=self._magnetic_energy();self.sample=None;self.record=None;self.source=None;self.linear_coefficient=0.;self.relays=[];self.amplitudes=[];out=dict(removed_mass_kg=m,removed_volume_m3=v)
|
| 331 |
+
elif capability=='power.set':
|
| 332 |
+
if not self.plant:raise ActionRejected('NOT_CONFIGURED')
|
| 333 |
+
if not a['enabled'] and (abs(self._pos('field'))>1e-10 or self._moving('field')):raise ActionRejected('ZERO_FIELD_REQUIRED')
|
| 334 |
+
if not a['enabled']:
|
| 335 |
+
if self.phase=='running':self._finish('cancelled','POWER_OFF')
|
| 336 |
+
self.vibration['enabled']=False
|
| 337 |
+
for k in self.axes:self._target(k,self._pos(k))
|
| 338 |
+
self.power=a['enabled'];out=dict(enabled=self.power)
|
| 339 |
+
elif capability=='field.set_target':
|
| 340 |
+
if not self.power:raise ActionRejected('POWER_OFF')
|
| 341 |
+
if self._pos('lift')>1e-9 and self.sample or self._moving('lift') or self._moving('angle'):raise ActionRejected('MEASUREMENT_POSITION_REQUIRED')
|
| 342 |
+
target=quant(a['field_t'],FIELD_RESOLUTION_T);self._field_guard([target]);self.ramp_rate=a['ramp_rate_t_s'];self._target('field',target);out=dict(target_t=target)
|
| 343 |
+
elif capability in ('sample.set_lift','sample.set_angle','storage.set_open'):
|
| 344 |
+
if not self.plant or not self.power:raise ActionRejected('POWER_OFF')
|
| 345 |
+
if capability!='storage.set_open' and (abs(self._pos('field'))>1e-10 or self._moving('field') or self.vibration['enabled']):raise ActionRejected('ZERO_FIELD_AND_VIBRATION_OFF_REQUIRED')
|
| 346 |
+
k='lift' if capability=='sample.set_lift' else 'angle' if capability=='sample.set_angle' else 'drawer';value=a['lift_m'] if k=='lift' else quant(a['angle_rad'],math.pi/1800) if k=='angle' else .2 if a['opened'] else 0.;self._target(k,value);out={'target_rad' if k=='angle' else 'target_m':value}
|
| 347 |
+
elif capability=='vibration.configure':
|
| 348 |
+
if not self.power or not self.coil:raise ActionRejected('NOT_CONFIGURED')
|
| 349 |
+
if a['enabled'] and (self._pos('lift')>1e-9 or self._moving('lift') or self._moving('angle')):raise ActionRejected('MEASUREMENT_POSITION_REQUIRED')
|
| 350 |
+
if any(a[k]!=self.vibration[k] for k in ('amplitude_m','frequency_hz')):self.calibration_valid=False
|
| 351 |
+
self.vibration=copy.deepcopy(a);out=dict(enabled=a['enabled'])
|
| 352 |
+
elif capability=='calibration.clear':self.calibration_valid=False;self.calibration_gain=1.;self.calibration_offset=0.;out=dict(valid=False)
|
| 353 |
+
elif capability in ('acquisition.start','calibration.start'):
|
| 354 |
+
iscal=capability=='calibration.start'
|
| 355 |
+
if not self.power or not self.plant or not self.coil or not self.vibration['enabled']:raise ActionRejected('NOT_CONFIGURED')
|
| 356 |
+
if not self.sample:raise ActionRejected('NO_SAMPLE')
|
| 357 |
+
if self._pos('lift')>1e-9 or self._moving('lift') or self._moving('angle'):raise ActionRejected('MEASUREMENT_POSITION_REQUIRED')
|
| 358 |
+
if not self._temperature_valid():raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 359 |
+
if iscal:
|
| 360 |
+
method=dict(ramp_rate_t_s=1.,averaging_time_s=a['averaging_time_s'],settling_time_s=max(.05,10*self.plant['detector_tau_s']));sequence=[dict(field_t=quant(B,FIELD_RESOLUTION_T),record=True,reversal_field_t=None) for B in [a['field_t'],-a['field_t']]]
|
| 361 |
+
else:
|
| 362 |
+
if not self.method:raise ActionRejected('NOT_CONFIGURED')
|
| 363 |
+
if self.method['require_calibration'] and not self.calibration_valid:raise ActionRejected('CALIBRATION_REQUIRED')
|
| 364 |
+
method=copy.deepcopy(self.method);sequence=[]
|
| 365 |
+
if method['kind']=='points':sequence=[dict(field_t=quant(B,FIELD_RESOLUTION_T),record=True,reversal_field_t=None) for B in method['field_points_t']]
|
| 366 |
+
else:
|
| 367 |
+
saturation=method['saturation_field_t']
|
| 368 |
+
for Br in method['reversal_fields_t']:
|
| 369 |
+
sequence.append(dict(field_t=quant(saturation,FIELD_RESOLUTION_T),record=False,reversal_field_t=Br))
|
| 370 |
+
sequence.extend(dict(field_t=quant(float(B),FIELD_RESOLUTION_T),record=True,reversal_field_t=Br) for B in np.linspace(Br,saturation,method['points_per_curve']))
|
| 371 |
+
self._field_guard([p['field_t'] for p in sequence])
|
| 372 |
+
if not iscal and method['kind']=='forc' and self.relays and method['saturation_field_t']*abs(math.cos(self._pos('angle')))<max(r['coercive_field_t']+abs(r['bias_field_t']) for r in self.relays):raise ActionRejected('MODEL_SATURATION_UNREACHABLE')
|
| 373 |
+
self._counter+=1;self.operation_id=f'{self.instance_id}:acquisition:{self._counter}';self._operation_source=self.source;self.operation_kind='calibration' if iscal else method['kind'];self.phase='running';self.elapsed=0.;self.rows=[];self.error=None;self._start_ns=self.time_ns;self._job_method=method;self._sequence=sequence;self._index=0;self._cal_reference=a['reference_moment_a_m2'] if iscal else None;self._begin_point();out=dict(operation_id=self.operation_id)
|
| 374 |
+
elif capability=='acquisition.stop':
|
| 375 |
+
if self.phase!='running':raise ActionRejected('NOT_RUNNING')
|
| 376 |
+
self._target('field',self._pos('field'));self._finish('cancelled','USER_CANCEL');out=dict(phase=self.phase,elapsed_s=self.elapsed)
|
| 377 |
+
else:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 378 |
+
self.revision+=1;return copy.deepcopy(out)
|
| 379 |
+
def step(self,dt_s):
|
| 380 |
+
validate(number('s',0,86400),dt_s);total=math.fsum((self._clock_remainder_ns,dt_s*1e9));ns=round(total);self._clock_remainder_ns=total-ns
|
| 381 |
+
if not ns:return
|
| 382 |
+
end=self.time_ns+ns
|
| 383 |
+
while self.time_ns<end:
|
| 384 |
+
if self.phase=='running' and self._event_ns<=self.time_ns:self._advance()
|
| 385 |
+
boundary=end
|
| 386 |
+
for k in self.axes:
|
| 387 |
+
if self._moving(k):boundary=min(boundary,self.axes[k]['arrival_ns'])
|
| 388 |
+
switch=self._next_switch()
|
| 389 |
+
if switch is not None:boundary=min(boundary,switch)
|
| 390 |
+
if self.phase=='running':boundary=min(boundary,self._event_ns)
|
| 391 |
+
self._propagate(boundary-self.time_ns);self.time_ns=boundary;self._positions();self._switch()
|
| 392 |
+
if self.phase=='running':
|
| 393 |
+
self.elapsed=(self.time_ns-self._start_ns)/1e9
|
| 394 |
+
if self._event_ns<=self.time_ns:self._advance()
|
| 395 |
+
self.revision+=1
|
| 396 |
+
|
| 397 |
+
class LakeShore8604VsmSession:
|
| 398 |
+
def __init__(self, host, principal_id): self._host = host; self._principal = principal_id
|
| 399 |
+
@property
|
| 400 |
+
def _role(self): return self._host._principals[self._principal]
|
| 401 |
+
def _target(self, instance_id):
|
| 402 |
+
if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 403 |
+
def describe(self, *, instance_id=None, asset_type_id=None):
|
| 404 |
+
if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT')
|
| 405 |
+
if instance_id is not None: self._target(instance_id)
|
| 406 |
+
if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 407 |
+
meta = export_lakeshore_8604vsm_contract_metadata()
|
| 408 |
+
return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'})
|
| 409 |
+
def read(self, *, instance_id, state_ids=None):
|
| 410 |
+
self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids
|
| 411 |
+
if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT')
|
| 412 |
+
if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED')
|
| 413 |
+
return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids})
|
| 414 |
+
def _filter_result(self, result):
|
| 415 |
+
result = copy.deepcopy(result)
|
| 416 |
+
# A bridge may dispatch agent-visible capabilities through a privileged
|
| 417 |
+
# session. Public acquisition payloads therefore use the SAME redaction
|
| 418 |
+
# for every role. Full provenance has its own evaluator-only capability.
|
| 419 |
+
if 'rows' in result and 'template_source' in result:
|
| 420 |
+
result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None
|
| 421 |
+
result['evidence'] = 'synthetic_forward_model; observed_interval_mean_lockin_voltage; measured_library_reference_anchor_not_original_this_loop_or_FORC; selected record restricted' if result['operation_id'] is not None else 'no_measurement'
|
| 422 |
+
return result
|
| 423 |
+
def invoke(self, *, instance_id, capability_id, arguments, request_id):
|
| 424 |
+
h=self._host
|
| 425 |
+
try:
|
| 426 |
+
self._target(instance_id)
|
| 427 |
+
if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 428 |
+
if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED')
|
| 429 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 430 |
+
validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False)
|
| 431 |
+
if key in h._requests:
|
| 432 |
+
old,response=h._requests[key]
|
| 433 |
+
if old!=digest: raise ActionRejected('REQUEST_CONFLICT')
|
| 434 |
+
return copy.deepcopy(response)
|
| 435 |
+
if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 436 |
+
if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 437 |
+
result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id in ('acquisition.start','calibration.start') else None
|
| 438 |
+
if operation: h._owners[operation]=self._principal
|
| 439 |
+
response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None)
|
| 440 |
+
h._requests[key]=(digest,copy.deepcopy(response)); return response
|
| 441 |
+
except ActionRejected as exc:
|
| 442 |
+
return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none'))
|
| 443 |
+
def write(self, *, instance_id, state_id, value, request_id):
|
| 444 |
+
self._target(instance_id); entry=SLOTS.get(state_id)
|
| 445 |
+
if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED')
|
| 446 |
+
capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id)
|
| 447 |
+
def poll(self, operation_id):
|
| 448 |
+
h=self._host
|
| 449 |
+
if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 450 |
+
result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id)
|
| 451 |
+
if result is None: raise ActionRejected('UNKNOWN_OPERATION')
|
| 452 |
+
return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result))
|
| 453 |
+
def cancel(self, operation_id, request_id):
|
| 454 |
+
self.poll(operation_id); h=self._host
|
| 455 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 456 |
+
key=(self._principal,request_id)
|
| 457 |
+
if key in h._cancel_operations:
|
| 458 |
+
if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT')
|
| 459 |
+
return copy.deepcopy(h._requests[key][1])
|
| 460 |
+
if key in h._requests: raise ActionRejected('REQUEST_CONFLICT')
|
| 461 |
+
if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING')
|
| 462 |
+
result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id)
|
| 463 |
+
if result['status']=='succeeded': h._cancel_operations[key]=operation_id
|
| 464 |
+
return result
|
| 465 |
+
|
| 466 |
+
for i,B in enumerate([-.1,0.,.1]):
|
| 467 |
+
row=dict(point_index=i,field_t=B,external_h_a_m=B/MU0,in_phase_voltage_v=B*.001,moment_a_m2=B*.001,angle_rad=0.,window_start_s=float(i),window_end_s=i+.1,reversal_field_t=None,quality='estimated')
|
| 468 |
+
CAPS['analysis.loop']['example_arguments']['rows'].append(row)
|
| 469 |
+
for Br in [-.1,-.05,0.]:
|
| 470 |
+
for B in [0.,.05,.1]:
|
| 471 |
+
row=copy.deepcopy(CAPS['analysis.loop']['example_arguments']['rows'][0]);row.update(field_t=B,external_h_a_m=B/MU0,moment_a_m2=.001*(B-Br*B),reversal_field_t=Br)
|
| 472 |
+
CAPS['analysis.forc']['example_arguments']['rows'].append(row)
|
| 473 |
+
EFFECTS={
|
| 474 |
+
'plant.configure':['plant.configured','thermal.sample_k','thermal.magnet_k','truth.sample_k'],
|
| 475 |
+
'coil.configure':['coil.configured','calibration.valid','calibration.gain','calibration.offset_v'],
|
| 476 |
+
'method.configure':['method.configured'],'forc.configure':['method.configured'],
|
| 477 |
+
'sample.load':['sample.present','thermal.sample_k','truth.sample_k','truth.mass_kg','truth.moment_a_m2'],
|
| 478 |
+
'standard.load':['sample.present','thermal.sample_k','truth.sample_k','truth.mass_kg','truth.moment_a_m2'],
|
| 479 |
+
'sample.remove':['sample.present','truth.mass_kg','truth.moment_a_m2'],
|
| 480 |
+
'power.set':['power.enabled','power.angle_rad','field.indicated_t','field.external_h_a_m','moment.indicated_a_m2','detector.in_phase_v','vibration.enabled','sample.vibration_z_m','sample.target_lift_m','sample.target_angle_rad','storage.target_m','field.target_t','acquisition.phase','acquisition.stage'],
|
| 481 |
+
'field.set_target':['field.target_t'],'sample.set_lift':['sample.target_lift_m'],'sample.set_angle':['sample.target_angle_rad'],'storage.set_open':['storage.target_m'],
|
| 482 |
+
'vibration.configure':['vibration.enabled','sample.vibration_z_m','moment.indicated_a_m2','detector.in_phase_v','calibration.valid'],
|
| 483 |
+
'calibration.clear':['calibration.valid','calibration.gain','calibration.offset_v'],
|
| 484 |
+
'acquisition.start':['acquisition.phase','acquisition.stage','acquisition.elapsed_s','acquisition.points','field.target_t'],
|
| 485 |
+
'calibration.start':['acquisition.phase','acquisition.stage','acquisition.elapsed_s','acquisition.points','field.target_t'],
|
| 486 |
+
'acquisition.stop':['acquisition.phase','acquisition.stage','field.target_t'],
|
| 487 |
+
'sim.step':list(SLOTS)}
|
| 488 |
+
for k,v in EFFECTS.items():CAPS[k]['effects']=v
|
| 489 |
+
ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'POWER_OFF','USER_CANCEL','MOMENT_OVERFLOW','REFERENCE_TEMPERATURE_RANGE'})
|
| 490 |
+
LIMITATIONS=[
|
| 491 |
+
'固定Lake Shore8604/86-LC单轴线圈/标准极帽ExactGAP2,样品空间8mm,外施空气场±2.37T;高场帽2.76T、其它gap、矢量线圈与温控附件未选。样品0..10g,磁矩1emu=1e-3 A m²。',
|
| 492 |
+
'公共field_t指外施空气磁感应B,H_external=B/μ0;样品内部B、H与退磁张量未求解,不把外场矫顽值冒充��禀矫顽力。',
|
| 493 |
+
'厂家动态范围25nemu至1000emu只限定可配置满量程;零交叉和低于25nemu仍可返回估计并明确below_documented_dynamic_range,不宣称低场准确度。15nemu RMS@10s与100nT场分辨是不同规格;未将RMS当任意积分时长下的随机分布。',
|
| 494 |
+
'真实数据包含原文室温285..300K的CRC molarχ、300K的SQUID铁氧体majorloops与Ni校准证书锚;证据/原始条件逐条保留,真实SQUID回线不冒充本8604原生输出。',
|
| 495 |
+
'linear_susceptibility: m=(mass/molar_mass)*χmol*B/μ0,低场线性/无退磁/温度容差为宿主接受的近似。Preisach使用真实高场比磁矩端点或显式host幅度,再加显式coercivity/bias/weights,属于synthetic_forward_model;端点不自动叫饱和Ms,±6T源major不可截成±2.37T实测饱和loop。',
|
| 496 |
+
'独立矩形Preisach hysterons保留反转记忆;FORC小回线由显式假设驱动,不能从实测majorloop唯一推导。旋转投影m_x=m_axis*cosθ,加各向同性线性项;不是全Stoner-Wohlfarth、矢量磁畴或退磁场模型。',
|
| 497 |
+
'磁化开关是有限能量的理想瞬时事件;W=B_eff*Δm、ΔU=bias*Δm、Q=(B_eff-bias)*Δm≥0,线性可逆能量U=.5*a*B²(抗磁参考可为负相对量)。未求开关脉冲峰值功率。',
|
| 498 |
+
'磁体工程常数B=kI、V=RI+L*dI/dt;plant只允许在完整±2.37T及1T/s线性工作包络内满足70A/35V/2450W。绕组Joule、L储能、磁化功与冷却输出独立留账;4250W整机冷却要求不等于本模型线圈耗散。',
|
| 499 |
+
'样品与局部夹持热容、磁体局部绕组热容均为宿主工程输入,非183/429/612kg整机热容;基础常温配置没有主动样品加热。载入取出质量体积、当前显热与磁态能量随库存转移。',
|
| 500 |
+
'为保持已实现能量边界,断电只允许零外场,非零场请求原子拒绝;停止采集只停止当前扫场并保留实际场,磁体电流及Joule耗散继续,需另设零场后才能断电。',
|
| 501 |
+
'锁相V=m*pickup_coupling*A*2πf/√2,含显式工程增益/零偏和一阶包络响应;average_time≥.01s真实区间积分,无随机噪声。解析振动姿态是宿主时刻采样,可混叠,不表示场景碰撞全频求解。',
|
| 502 |
+
'位移/角度/抽屉有限速率,样品仅在零场和振动关闭时移动;0.1°为真实设置分辨率,实际转角保留多圈,orientation仅提供周期等价场景姿态。',
|
| 503 |
+
'校准用外部给定的±已知标准磁矩及真实±场积分电压拟合零偏/增益,不读隐藏plant;defaultNi数值锚仅在原证书条件成立,host线性calibrant proxy不声称真实Ni全场响应或NIST认证。',
|
| 504 |
+
'分析仅读外部rows:分支线性零点给Hc/Mr,∫Bdm对于未闭合路径不是cycleloss;FORC用最多15邻点的局部二次混合导数,不假称FORCinel或真实微结构唯一识别。',
|
| 505 |
+
'所有角色普通acquisition.result/poll同样去身份,完整来源独立evaluator provenance.read;共享磁盘/Python不是OS隔离。硬件、机器人、真实噪声/准确度与附件温控not_run。']
|
| 506 |
+
|
| 507 |
+
def export_lakeshore_8604vsm_contract_metadata():
|
| 508 |
+
slots={};caps={}
|
| 509 |
+
for k,v in SLOTS.items():slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI, fixed standard poles ExactGAP2/86-LC, room temperature; magnetic field is externally applied B in air.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'LakeShore8604VsmSession.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Reads do not advance time; acquisition rows separately give actual integration windows, instantaneous detector state is not an interval mean.'),source_ids=['simulation_assumption'])
|
| 510 |
+
for k,v in CAPS.items():
|
| 511 |
+
un=k in UNSUPPORTED;async_=k in ('acquisition.start','calibration.start');caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']}
|
| 512 |
+
caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.lakeshore_8604vsm.LakeShore8604VsmSession.invoke',invocation=f'session.invoke(instance_id="vsm_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='入口原子核对量程、选型、温域、供磁包络、零场机械移动和真实采集前提。',state_ids=['power.enabled','sample.present','sample.lift_m','field.target_t','vibration.enabled','acquisition.phase'],enforced_by='runtime',check='LakeShore8604VsmRuntime.invoke')],state_effects=[dict(state_id=s,timing='on_step' if k=='sim.step' else 'immediate',description_zh='声明状态变化;实际物理与观测只在step推进') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='运行层仅输出可绑定状态,实际几何和读数联动由独立scene证据验证。',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='所有有限扫场、等待与真实积分窗口完成' if async_ else '原子命令;仅step推进实际物理',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','magnet_power_supply','vsm_head','lockin_detector'],partial_failure_zh='取消保留完成点、实际B和磁态、已积磁功/Joule热;停止记录不清空剩磁或热量。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('MOMENT_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','USER_CANCEL') else 'none') for e in ERRORS],verification=[],limitations=LIMITATIONS,source_ids=['manufacturer_primary','simulation_assumption','template_library'])
|
| 513 |
+
if k in ('acquisition.start','calibration.start','field.set_target','sample.set_lift','sample.set_angle','storage.set_open','vibration.configure'):
|
| 514 |
+
caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='由宿主显式时间推进物理或实际积分读数') for s in SLOTS if s not in v['effects'] and SLOTS[s]['origin'] in ('sensor','derived','scene','process_truth')]
|
| 515 |
+
mechanism=dict(component_ids=['magnet','power_supply','sample','sample_rotor','head_lift','vibration_carriage','controller','sense_coil_left','sense_coil_right'],state_ids=list(slots),meaning_zh='外磁场有限扫场、显式Preisach记忆、VSM锁相包络实际积分和电磁被动热守恒',implementation='lumped',equations=['H_external=B_applied/mu0; m_linear=(sample_mass/molar_mass)*chi_molar*H_external.','Preisach: state flips at B*cos(theta)=bias +/- coercivity; m_x=sum(moment_weight*state)*cos(theta)+a*B.','Switch: W=B_eff*dm, dU=bias*dm, Q=(B_eff-bias)*dm>=0; reversible linear U=0.5*a*B^2.','I=B/k; V=R*I+L*dI/dt; P_R=I^2*R, E_L=0.5*L*I^2. Electrical input=dE_L+Joule+magnetic work.','Cmag*dTmag/dt=I^2*R-Gmag*(Tmag-Tambient); Csample*dTsample/dt=-Gsample*(Tsample-Tambient)+hysteretic event heat.','V_inphase=engineering_gain*pickup_coupling*amplitude*2*pi*frequency*m/sqrt(2)+offset; detector tau*dV/dt=V_inphase-V.','Recorded Vbar=(integral V dt)/actual_window; observed moment=(Vbar-cal_offset)*cal_gain/nominal_sensitivity.','Calibration gain=2*external_reference_moment*nominal_sensitivity/(Vplus-Vminus); offset=(Vplus+Vminus)/2.','FORC rho=-0.5*d2(moment)/(dB*dBr), evaluated by local quadratic fit to external observations only.','Host step is sole clock, with fractional-nanosecond carry; switching/ramp/axis/integration events split propagation analytically.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=LIMITATIONS)
|
| 516 |
+
spec=importlib.util.spec_from_file_location('_vsm_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'vsm_magnetometry':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'coil.configure':(COIL,COIL_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'standard.load':(STANDARD,STANDARD_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE),'forc.configure':(FORC,FORC_EXAMPLE),'vibration.configure':(VIBRATION,VIBRATION_EXAMPLE)})
|
| 517 |
+
for k,v in SLOTS.items():slots[k]['meaning_zh']=v['meaning']
|
| 518 |
+
return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'vsm_magnetometry':mechanism})
|
scripts/asset_runtime/lakeshore_measurereadym91.py
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM141 M91: traditional current/field reversal, external magnet and vdP.
|
| 2 |
+
|
| 3 |
+
Only observed voltages/currents/fields enter inverse Hall/vdP fits. A host-controlled
|
| 4 |
+
external field boundary evolves in time; M91 does not create a magnetic field.
|
| 5 |
+
"""
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
import copy,importlib.util,json,math
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
import numpy as np
|
| 10 |
+
from scipy.integrate import solve_ivp
|
| 11 |
+
PROTOCOL_VERSION='1.0.0';SLUG='lakeshore_measurereadym91';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-141'
|
| 12 |
+
ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'hall_library.json'
|
| 13 |
+
|
| 14 |
+
class ActionRejected(ValueError):pass
|
| 15 |
+
|
| 16 |
+
def number(unit='1',lo=None,hi=None):
|
| 17 |
+
s={'type':'number','x-unit':unit}
|
| 18 |
+
if lo is not None:s['minimum']=lo
|
| 19 |
+
if hi is not None:s['maximum']=hi
|
| 20 |
+
return s
|
| 21 |
+
|
| 22 |
+
def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False)
|
| 23 |
+
def nullable(s):return {'anyOf':[s,{'type':'null'}]}
|
| 24 |
+
def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum)
|
| 25 |
+
def enum(items):return {'type':'string','enum':items}
|
| 26 |
+
BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed'])
|
| 27 |
+
|
| 28 |
+
def validate(s,v):
|
| 29 |
+
if 'anyOf' in s:
|
| 30 |
+
for o in s['anyOf']:
|
| 31 |
+
try:validate(o,v);return
|
| 32 |
+
except ActionRejected:pass
|
| 33 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 34 |
+
k=s.get('type')
|
| 35 |
+
if k in ('number','integer'):
|
| 36 |
+
if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 37 |
+
elif k=='object':
|
| 38 |
+
if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT')
|
| 39 |
+
for key,value in v.items():validate(s['properties'][key],value)
|
| 40 |
+
elif k=='array':
|
| 41 |
+
if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 42 |
+
for x in v:validate(s['items'],x)
|
| 43 |
+
elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT')
|
| 44 |
+
elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT')
|
| 45 |
+
elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT')
|
| 46 |
+
if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT')
|
| 47 |
+
|
| 48 |
+
from scipy.linalg import expm
|
| 49 |
+
from scipy.optimize import brentq
|
| 50 |
+
ELEMENTARY_CHARGE_C=1.602176634e-19
|
| 51 |
+
WARMUP_S=1800.
|
| 52 |
+
CURRENT_RANGES=[1e-6,1e-5,1e-4,1e-3,1e-2,1e-1]
|
| 53 |
+
VOLTAGE_RANGES=[.001,.01,.1,1.,10.]
|
| 54 |
+
VOLTAGE_EXCITATION_RANGES=[.01,.1,1.,10.]
|
| 55 |
+
CURRENT_MEASUREMENT_RANGES=[1e-8,1e-5,.01,.1]
|
| 56 |
+
CONTACTS=['vdp_a','vdp_b','hall']
|
| 57 |
+
|
| 58 |
+
def library():return {x['id']:x for x in json.loads(LIBRARY_PATH.read_text())['templates']}
|
| 59 |
+
def transport(record,temperature,clamp=False):
|
| 60 |
+
curves=record['curves'];values={};lo=-math.inf;hi=math.inf
|
| 61 |
+
for key,field in [('hall_coefficient','value_m3_C'),('resistivity','value_ohm_m')]:
|
| 62 |
+
rows=curves[key];tt=np.array([v['temperature_K'] for v in rows]);vv=np.array([v[field] for v in rows]);lo=max(lo,float(tt[0]));hi=min(hi,float(tt[-1]));values[key]=float(np.interp(temperature,tt,vv))
|
| 63 |
+
allowed=record.get('valid_temperature_range_K',[lo,hi]);lo=max(lo,allowed[0]);hi=min(hi,allowed[1]);valid=lo-1e-6<=temperature<=hi+1e-6
|
| 64 |
+
if not valid and not clamp:return None
|
| 65 |
+
return dict(hall_coefficient_m3_c=values['hall_coefficient'],resistivity_ohm_m=values['resistivity'],valid=bool(valid),domain_k=[lo,hi])
|
| 66 |
+
|
| 67 |
+
def vdp_resistances(sheet_ohm,asymmetry):return sheet_ohm*np.logaddexp(0.,np.array([asymmetry,-asymmetry]))/math.pi
|
| 68 |
+
|
| 69 |
+
def external_field_at(initial,target,dt,slew,tau):
|
| 70 |
+
error=target-initial;edge=slew*tau
|
| 71 |
+
if abs(error)<=edge:return target-error*math.exp(-dt/tau)
|
| 72 |
+
linear_time=(abs(error)-edge)/slew
|
| 73 |
+
if dt<=linear_time:return initial+math.copysign(slew*dt,error)
|
| 74 |
+
return target-math.copysign(edge,error)*math.exp(-(dt-linear_time)/tau)
|
| 75 |
+
|
| 76 |
+
def _linear_fit(X,y):
|
| 77 |
+
coefficient,_,rank,_=np.linalg.lstsq(X,y,rcond=None)
|
| 78 |
+
if rank<X.shape[1]:raise ActionRejected('ANALYSIS_UNIDENTIFIABLE')
|
| 79 |
+
return coefficient,float(np.sqrt(np.mean((np.asarray(y)-X@coefficient)**2)))
|
| 80 |
+
|
| 81 |
+
def infer_hall_vdp(observations,thickness_m,hall_geometry_factor,hall_factor,field_symmetry_relative,accept_single_carrier_model):
|
| 82 |
+
if not accept_single_carrier_model:raise ActionRejected('ASSUMPTION_NOT_ACCEPTED')
|
| 83 |
+
t=np.array([x['host_time_s'] for x in observations]);I=np.array([x['current_a'] for x in observations]);B=np.array([x['field_t'] for x in observations]);V=np.array([x['voltage_v'] for x in observations]);configs=np.array([x['contact_configuration'] for x in observations]);iscale=max(np.max(abs(I)),1e-30);bscale=max(np.max(abs(B)),1e-30);times=(t-np.mean(t))/max(np.ptp(t),1e-12)
|
| 84 |
+
if not np.any(B>1e-6) or not np.any(B < -1e-6):raise ActionRejected('FIELD_REVERSAL_REQUIRED')
|
| 85 |
+
bp=float(np.mean(B[B>0]));bn=float(np.mean(B[B<0]))
|
| 86 |
+
if abs(bp+bn)/max(abs(bp),abs(bn))>field_symmetry_relative:raise ActionRejected('FIELD_PAIR_ASYMMETRY')
|
| 87 |
+
resistance=[];rms=[]
|
| 88 |
+
for name in CONTACTS[:2]:
|
| 89 |
+
idx=configs==name
|
| 90 |
+
if sum(idx)<4:raise ActionRejected('ANALYSIS_DATA')
|
| 91 |
+
X=np.column_stack([I[idx]/iscale,np.ones(sum(idx)),times[idx]]);fit,error=_linear_fit(X,V[idx]);R=float(fit[0]/iscale)
|
| 92 |
+
if not .01<=R<=1e7:raise ActionRejected('RESISTANCE_RANGE')
|
| 93 |
+
resistance.append(R);rms.append(error)
|
| 94 |
+
idx=configs=='hall'
|
| 95 |
+
if sum(idx)<6:raise ActionRejected('ANALYSIS_DATA')
|
| 96 |
+
X=np.column_stack([I[idx]/iscale,I[idx]*B[idx]/(iscale*bscale),np.ones(sum(idx)),times[idx]]);fit,error=_linear_fit(X,V[idx]);rms.append(error);RH=float(fit[1]/(iscale*bscale)*thickness_m/hall_geometry_factor)
|
| 97 |
+
if abs(RH)<1e-30:raise ActionRejected('HALL_UNRESOLVED')
|
| 98 |
+
ra,rb=resistance;sheet=brentq(lambda rs:math.exp(-math.pi*ra/rs)+math.exp(-math.pi*rb/rs)-1,min(ra,rb)*1e-6,math.pi*(ra+rb)*100,xtol=1e-13,rtol=1e-13);rho=sheet*thickness_m;nH=1/(ELEMENTARY_CHARGE_C*abs(RH));muH=abs(RH)/rho
|
| 99 |
+
return dict(hall_coefficient_m3_c=RH,resistivity_ohm_m=rho,sheet_resistance_ohm=sheet,vdp_resistance_a_ohm=ra,vdp_resistance_b_ohm=rb,hall_carrier_density_m3=nH,hall_mobility_m2_v_s=muH,assumed_single_carrier_density_m3=hall_factor*nH,assumed_drift_mobility_m2_v_s=muH/hall_factor,carrier_type='hole_like_positive_hall' if RH>0 else 'electron_like_negative_hall',fit_rms_v=max(rms),evidence='external_current_and_field_reversal_voltage_fit; scalar_van_der_Pauw_and_single_carrier_Hall_factor_assumptions; not_proprietary_FastHall_algorithm')
|
| 100 |
+
|
| 101 |
+
PLANT_EXAMPLE=dict(ambient_k=300.,contact_asymmetry=.2,hall_misalignment_fraction=.02,hall_geometry_factor=1.,drive_geometry_factor=1.,current_contact_resistance_ohm=20.,compliance_voltage_v=10.,voltage_offset_a_v=2e-6,voltage_offset_b_v=-1e-6,voltage_offset_hall_v=3e-6,voltage_drift_v_s=1e-10,voltage_gain=1.,voltage_resolution_fraction=1e-7,voltage_response_tau_s=.002,temperature_resolution_k=1e-4,clamp_speed_m_s=.006,ui_tilt_speed_rad_s=.5,accept_engineering=True)
|
| 102 |
+
PLANT=obj({'ambient_k':number('K',283.15,313.15),'contact_asymmetry':number('1',-5,5),'hall_misalignment_fraction':number('1',-.5,.5),'hall_geometry_factor':number('1',.1,2),'drive_geometry_factor':number('1',.1,100),'current_contact_resistance_ohm':number('ohm',0,1e9),'compliance_voltage_v':number('V',1,10),'voltage_offset_a_v':number('V',-.1,.1),'voltage_offset_b_v':number('V',-.1,.1),'voltage_offset_hall_v':number('V',-.1,.1),'voltage_drift_v_s':number('V/s',-1e-3,1e-3),'voltage_gain':number('1',.1,10),'voltage_resolution_fraction':number('1',1e-12,.01),'voltage_response_tau_s':number('s',1e-5,10),'temperature_resolution_k':number('K',1e-6,1),'clamp_speed_m_s':number('m/s',.00001,.1),'ui_tilt_speed_rad_s':number('rad/s',.0001,1.),'accept_engineering':BOOL})
|
| 103 |
+
GEOMETRY_EXAMPLE=dict(side_m=.01,thickness_m=.0005)
|
| 104 |
+
GEOMETRY=obj({'side_m':number('m',.001,.1),'thickness_m':number('m',1e-7,.01)})
|
| 105 |
+
THERMAL_EXAMPLE=dict(minimum_temperature_k=290.,maximum_temperature_k=350.,closed_conductance_w_k=.2,open_conductance_w_k=.02,controller_gain_w_k=.5,heating_limit_w=5.,cooling_limit_w=5.,accept_external_thermal_boundary=True)
|
| 106 |
+
THERMAL=obj({'minimum_temperature_k':number('K',1,1500),'maximum_temperature_k':number('K',1,1500),'closed_conductance_w_k':number('W/K',1e-6,1000),'open_conductance_w_k':number('W/K',0,1000),'controller_gain_w_k':number('W/K',1e-6,1e5),'heating_limit_w':number('W',.001,1e5),'cooling_limit_w':number('W',.001,1e5),'accept_external_thermal_boundary':BOOL})
|
| 107 |
+
FIELD_EXAMPLE=dict(maximum_abs_t=2.,slew_t_s=1.,response_tau_s=.1,probe_gain=1.,probe_offset_t=0.,probe_resolution_t=1e-7,accept_external_magnet=True)
|
| 108 |
+
FIELD=obj({'maximum_abs_t':number('T',.001,100),'slew_t_s':number('T/s',1e-6,100),'response_tau_s':number('s',.001,1e5),'probe_gain':number('1',.1,10),'probe_offset_t':number('T',-1,1),'probe_resolution_t':number('T',1e-12,.1),'accept_external_magnet':BOOL})
|
| 109 |
+
SAMPLE_EXAMPLE=dict(reference_id='starry_40927',density_kg_m3=6000.,specific_heat_capacity_j_kg_k=300.,initial_temperature_k=300.,accept_directional_scalar_and_thermal_assumptions=True)
|
| 110 |
+
SAMPLE=obj({'reference_id':TEXT,'density_kg_m3':number('kg/m^3',1,30000),'specific_heat_capacity_j_kg_k':number('J/kg/K',1,10000),'initial_temperature_k':number('K',1,1500),'accept_directional_scalar_and_thermal_assumptions':BOOL})
|
| 111 |
+
METHOD_EXAMPLE=dict(current_range_a=.001,current_a=.0005,voltage_range_v=.001,phase_duration_s=.1,repeats=1,field_settling_tolerance_t=1e-4)
|
| 112 |
+
METHOD=obj({'current_range_a':dict(type='number',enum=CURRENT_RANGES,**{'x-unit':'A'}),'current_a':number('A',0,.1),'voltage_range_v':dict(type='number',enum=VOLTAGE_RANGES,**{'x-unit':'V'}),'phase_duration_s':number('s',.001,60),'repeats':dict(type='integer',minimum=1,maximum=100,**{'x-unit':'1'}),'field_settling_tolerance_t':number('T',1e-8,.1)})
|
| 113 |
+
VOLTAGE_EXAMPLE=dict(voltage_range_v=.1,voltage_v=.01,current_measurement_range_a=.01,current_limit_a=.1,current_resolution_fraction=1e-7)
|
| 114 |
+
VOLTAGE=obj({'voltage_range_v':dict(type='number',enum=VOLTAGE_EXCITATION_RANGES,**{'x-unit':'V'}),'voltage_v':number('V',0,10),'current_measurement_range_a':dict(type='number',enum=CURRENT_MEASUREMENT_RANGES,**{'x-unit':'A'}),'current_limit_a':number('A',1e-7,.1),'current_resolution_fraction':number('1',1e-12,.01)})
|
| 115 |
+
CALIBRATION_EXAMPLE=dict(voltage_gain_correction=1.,voltage_offset_v=0.,field_gain_correction=1.,field_offset_t=0.)
|
| 116 |
+
CALIBRATION=obj({'voltage_gain_correction':number('1',.1,10),'voltage_offset_v':number('V',-.1,.1),'field_gain_correction':number('1',.1,10),'field_offset_t':number('T',-1,1)})
|
| 117 |
+
CONTACT_SCHEMA=enum(CONTACTS)
|
| 118 |
+
ROW=obj({'time_s':number('s',0),'host_time_s':number('s',0),'contact_configuration':CONTACT_SCHEMA,'polarity':enum(['zero','positive','negative']),'current_a':nullable(number('A')),'voltage_v':nullable(number('V')),'field_t':nullable(number('T')),'temperature_k':nullable(number('K')),'quality':enum(['estimated','unavailable']),'error_code':nullable(TEXT)})
|
| 119 |
+
ANALYSIS_ROW=obj({'host_time_s':number('s',0),'contact_configuration':CONTACT_SCHEMA,'current_a':number('A'),'voltage_v':number('V'),'field_t':number('T')})
|
| 120 |
+
ANALYSIS_INPUT=obj({'observations':array(ANALYSIS_ROW,18,2000),'thickness_m':number('m',1e-7,.01),'hall_geometry_factor':number('1',.1,2),'hall_factor':number('1',.1,10),'field_symmetry_relative':number('1',1e-6,.1),'accept_single_carrier_model':BOOL})
|
| 121 |
+
INFERENCE=obj({'hall_coefficient_m3_c':number('m^3/C'),'resistivity_ohm_m':number('ohm*m',0),'sheet_resistance_ohm':number('ohm',0),'vdp_resistance_a_ohm':number('ohm',0),'vdp_resistance_b_ohm':number('ohm',0),'hall_carrier_density_m3':number('1/m^3',0),'hall_mobility_m2_v_s':number('m^2/V/s',0),'assumed_single_carrier_density_m3':number('1/m^3',0),'assumed_drift_mobility_m2_v_s':number('m^2/V/s',0),'carrier_type':enum(['hole_like_positive_hall','electron_like_negative_hall']),'fit_rms_v':number('V',0),'evidence':TEXT})
|
| 122 |
+
_ex=[]
|
| 123 |
+
for block,B in enumerate([.5,-.5]):
|
| 124 |
+
for j,name in enumerate(CONTACTS):
|
| 125 |
+
for k,I in enumerate([0.,.0005,-.0005]):
|
| 126 |
+
tm=block*5+j*.3+k*.1;R=[.2,.3,.001*B/.0005+.03][j];_ex.append(dict(host_time_s=tm,contact_configuration=name,current_a=I,voltage_v=I*R+2e-6+1e-8*tm,field_t=B))
|
| 127 |
+
ANALYSIS_EXAMPLE=dict(observations=_ex,thickness_m=.0005,hall_geometry_factor=1.,hall_factor=1.,field_symmetry_relative=.01,accept_single_carrier_model=True)
|
| 128 |
+
RESULT=obj({'operation_id':nullable(TEXT),'phase':PHASE,'elapsed_s':number('s',0),'rows':array(ROW,0,900),'template_source':nullable(TEXT),'evidence':TEXT,'error_code':nullable(TEXT)})
|
| 129 |
+
CAPS={};SLOTS={}
|
| 130 |
+
def cap(k,i,o,c,z,kind='device_command',visibility='agent',example=None):CAPS[k]=dict(input_schema=i,output_schema=o,component_ids=c,function_zh=z,kind=kind,visibility=visibility,example_arguments=copy.deepcopy(example or {}),effects=[])
|
| 131 |
+
def slot(k,s,u,z,origin='derived',visibility='agent',component='controller'):SLOTS[k]=dict(schema=s,unit=u,meaning=z,origin=origin,visibility=visibility,component=component,write=None)
|
| 132 |
+
cap('plant.configure',PLANT,obj({'configured':BOOL}),['controller','contact_carriage'],'宿主显式接触/顺从电压/传感/几何误差参数,非OEM精度常数','configuration','evaluator',PLANT_EXAMPLE)
|
| 133 |
+
cap('geometry.configure',GEOMETRY,obj({'configured':BOOL}),['sample_sheet'],'方形vdP薄片几何,四角接点;装样后锁定质量体积','configuration','evaluator',GEOMETRY_EXAMPLE)
|
| 134 |
+
cap('thermal.configure',THERMAL,obj({'configured':BOOL}),['thermal_port'],'宿主外部工程热边界,非M91加热器或OEM温控系统','configuration','evaluator',THERMAL_EXAMPLE)
|
| 135 |
+
cap('field.configure',FIELD,obj({'configured':BOOL}),['field_reference'],'宿主外部磁体边界及场探头,磁体参数不冒充M91能力','configuration','evaluator',FIELD_EXAMPLE)
|
| 136 |
+
cap('field.set_target',obj({'field_t':number('T',-100,100)}),obj({'target_t':number('T')}),['field_reference'],'仅宿主设置外场目标;实际B受slew/τ随step演化,M91本体不造磁','simulation','evaluator',{'field_t':.5})
|
| 137 |
+
cap('sample.load',SAMPLE,obj({'loaded':BOOL}),['sample_sheet'],'装入带真实RH/rho实验曲线的样品,热参数与标量方向明确接受','configuration','evaluator',SAMPLE_EXAMPLE)
|
| 138 |
+
cap('sample.remove',obj({}),obj({'loaded':BOOL}),['sample_sheet'],'卸下整片及当前显热,保留已焦耳耗散账','configuration','evaluator')
|
| 139 |
+
cap('sample.set_clamp',obj({'closed':BOOL}),obj({'target_m':number('m',0,.012)}),['contact_carriage'],'宿主手动四针整体抬起/接触,有限移动代理','simulation','evaluator',{'closed':True})
|
| 140 |
+
cap('ui.set_tilt',obj({'angle_rad':number('rad',0,.26)}),obj({'target_rad':number('rad',0,.26)}),['controller'],'TiltView人工调角有限速度代理,范围为工程假设','simulation','evaluator',{'angle_rad':.13})
|
| 141 |
+
cap('power.set',obj({'enabled':BOOL}),obj({'enabled':BOOL}),['power_button'],'控制器电源;每次重新上电需宿主累计1800s预热,短按动画仅状态代理',example={'enabled':True})
|
| 142 |
+
cap('thermal.set_temperature',obj({'temperature_k':number('K',1,1500)}),obj({'target_k':number('K')}),['thermal_port'],'宿主外部热控制目标,温度只随step变化','simulation','evaluator',{'temperature_k':300.})
|
| 143 |
+
cap('thermal.disable',obj({}),obj({'enabled':BOOL}),['thermal_port'],'停止外部主动调温,已有显热和焦耳过程不回滚','simulation','evaluator')
|
| 144 |
+
cap('method.configure',METHOD,obj({'configured':BOOL,'programmed_current_a':number('A',0,.1)}),['controller'],'电流六档及每档1e-5分辨率,电压量程是满量程非最小信号阈值','configuration',example=METHOD_EXAMPLE)
|
| 145 |
+
cap('options.configure',obj({'high_resistance_firmware_enabled':BOOL}),obj({'high_resistance_firmware_enabled':BOOL}),['controller'],'宿主明确选择M9-ADD-HR固件以开放电压激励,默认未选;不宣称200GΩ全域计量','configuration','evaluator',{'high_resistance_firmware_enabled':True})
|
| 146 |
+
cap('excitation.voltage.configure',VOLTAGE,obj({'configured':BOOL,'programmed_voltage_v':number('V',0,10),'current_limit_a':number('A',1e-7,.1)}),['controller'],'HR固件下配置并选择电压激励:电压编程1e-5满档;真实负载电流、独立电流量程和显式分辨率模型','configuration',example=VOLTAGE_EXAMPLE)
|
| 147 |
+
cap('sensor.calibrate',CALIBRATION,obj({'configured':BOOL}),['controller','field_reference'],'使用外部标准给出的电压和场探头校正,不读取真值','configuration',example=CALIBRATION_EXAMPLE)
|
| 148 |
+
cap('acquisition.start',obj({}),obj({'operation_id':TEXT,'expected_duration_s':number('s',0)}),['controller','contact_carriage'],'在一个已稳定外场下依次采vdP-A/vdP-B/Hall的零/正/负激励观测;current模式±I、voltage模式±V')
|
| 149 |
+
cap('acquisition.stop',obj({}),obj({'phase':PHASE,'elapsed_s':number('s',0)}),['controller'],'停止激励并冻结已完成相,外部场和已有显热继续演化')
|
| 150 |
+
cap('acquisition.result',obj({}),RESULT,['controller'],'公开反转原始观测,所有会话统一隐去选中来源','query')
|
| 151 |
+
cap('analysis.hall_vdp',ANALYSIS_INPUT,INFERENCE,['controller'],'从两种相反外场实测代理拟合电流/磁场反转项并数值解vdP;非FastHall私有算法','analysis',example=ANALYSIS_EXAMPLE)
|
| 152 |
+
cap('provenance.read',obj({}),obj({'reference_id':nullable(TEXT),'template_source':nullable(TEXT),'evidence':TEXT}),['controller'],'仅宿主读取当前真实RH/rho曲线记录','query','evaluator')
|
| 153 |
+
LEDGER_UNITS=dict(mass_loaded_kg='kg',mass_present_kg='kg',mass_removed_kg='kg',mass_error_kg='kg',volume_loaded_m3='m^3',volume_present_m3='m^3',volume_removed_m3='m^3',volume_error_m3='m^3',source_input_j='J',sample_joule_j='J',contact_heat_export_j='J',electrical_error_j='J',controller_input_j='J',ambient_loss_j='J',loaded_sensible_j='J',removed_sensible_j='J',thermal_stored_j='J',thermal_energy_error_j='J')
|
| 154 |
+
cap('ledger.read',obj({}),obj({k:number(u) for k,u in LEDGER_UNITS.items()}),['controller'],'样品质量/体积/显热/焦耳、接触热外流与外部温控账;不计外部磁体供电','query','evaluator')
|
| 155 |
+
cap('sim.step',obj({'dt_s':number('s',0,86400)}),obj({'time_s':number('s',0)}),['controller'],'单一宿主时间推进真实1800s预热、外部磁场、温度与反转采样','simulation','evaluator',{'dt_s':10.})
|
| 156 |
+
UNSUPPORTED=['hardware.connect','robot.load','measurement.fasthall_proprietary','measurement.hall_bar','measurement.high_resistance_200gohm_range','measurement.multicarrier_tensor','noise.empirical','accuracy.certification']
|
| 157 |
+
for k in UNSUPPORTED:cap(k,obj({}),obj({}),['controller'],'未实现:'+k)
|
| 158 |
+
for k,c in [('plant.configured','controller'),('geometry.configured','sample_sheet'),('thermal.configured','thermal_port'),('field.configured','field_reference'),('sample.present','sample_sheet'),('power.enabled','power_button'),('warmup.ready','controller'),('thermal.enabled','thermal_port'),('clamp.moving','contact_carriage')]:slot(k,BOOL,'1','当前配置/运行状态',component=c)
|
| 159 |
+
for k,z in [('clamp.position_m','四针当前上提量'),('clamp.target_m','四针目标上提量')]:slot(k,number('m',0,.012),'m',z+';0接触/.012装卸开放','setpoint' if 'target' in k else 'scene',component='contact_carriage')
|
| 160 |
+
for k,z in [('ui.tilt_rad','TiltView当前手动代理角'),('ui.target_tilt_rad','TiltView目标手动代理角')]:slot(k,number('rad',0,.26),'rad',z+',范围和速度为工程假设','setpoint' if 'target' in k else 'scene',component='controller')
|
| 161 |
+
slot('power.position_m',number('m',0,.0015),'m','电源按键100ms三角按下释放姿态代理,不把通电状态当永久按住','scene',component='power_button')
|
| 162 |
+
slot('warmup.elapsed_s',number('s',0,1800),'s','当前连续供电累计预热,1800s封顶,掉电清零')
|
| 163 |
+
slot('thermal.target_k',number('K'),'K','宿主外部热边界目标','setpoint',component='thermal_port')
|
| 164 |
+
slot('thermal.indicated_k',nullable(number('K')),'K','样品与固定0.1J/K夹具集中节点量化观测','sensor',component='sample_sheet')
|
| 165 |
+
slot('field.target_t',number('T'),'T','宿主外部磁体目标,不是M91磁场输出','setpoint',component='field_reference')
|
| 166 |
+
slot('field.indicated_t',nullable(number('T')),'T','外部探头增益/偏置/量化后的垂直样品场观测','sensor',component='field_reference')
|
| 167 |
+
slot('excitation.programmed_current_a',number('A',0,.1),'A','经当前量程1e-5分辨率量化的电流幅度','setpoint')
|
| 168 |
+
slot('options.high_resistance_firmware_enabled',BOOL,'1','宿主明确配置的M9-ADD-HR固件选型,默认关闭')
|
| 169 |
+
slot('excitation.mode',enum(['current','voltage']),'1','当前激励模式;method.configure回到电流模式,电压模式须已选HR固件','setpoint')
|
| 170 |
+
slot('excitation.programmed_voltage_v',number('V',0,10),'V','电压模式经1e-5满档量化的源幅度,电流模式为零','setpoint')
|
| 171 |
+
slot('excitation.current_measurement_range_a',nullable(number('A',1e-8,.1)),'A','电压模式下独立电流观测满量程;不会据此限制实际电流','setpoint')
|
| 172 |
+
slot('excitation.source_voltage_v',nullable(number('V',-10,10)),'V','当前实际源端电压模型估计,触发限流或顺从后按真实负载计算,不等于四接点输入电压','derived')
|
| 173 |
+
slot('measured.current_a',nullable(number('A')),'A','电流模式为实际源电流估计;电压模式为显式分辨率量化电流观测,独立测量档溢出不可用','sensor')
|
| 174 |
+
slot('measured.voltage_v',nullable(number('V')),'V','当前接点配置的量化电压观测;不把所有相都叫Hall电压','sensor')
|
| 175 |
+
slot('acquisition.contact_configuration',enum(CONTACTS+['idle']),'1','当前真实测量接点配置')
|
| 176 |
+
slot('acquisition.polarity',enum(['zero','positive','negative']),'1','当前电流相,停止时为零')
|
| 177 |
+
slot('clock.time_s',number('s',0),'s','唯一宿主时钟')
|
| 178 |
+
slot('acquisition.phase',PHASE,'1','异步反转采样状态')
|
| 179 |
+
slot('acquisition.elapsed_s',number('s',0),'s','本次真实采样时长')
|
| 180 |
+
slot('acquisition.points',{'type':'integer','minimum':0,'maximum':900,'x-unit':'1'},'1','实际完成相数')
|
| 181 |
+
for k,u in [('truth.sample_k','K'),('truth.field_t','T'),('truth.sample_mass_kg','kg')]:slot(k,nullable(number(u)),u,'宿主真实样品/外部场状态,非代理可见真值','process_truth','evaluator')
|
| 182 |
+
|
| 183 |
+
class LakeShoreMeasurereadyM91Runtime:
|
| 184 |
+
def __init__(self,instance_id='m91_01'):
|
| 185 |
+
self.instance_id=instance_id;self.plant=None;self.geometry=None;self.thermal=None;self.field=None;self.sample=None;self.record=None;self.power=False;self._power_started_ns=None;self._button_started_ns=-1000000000;self.thermal_enabled=False;self.target=300.;self.field_actual=0.;self.field_target=0.;self.axes={'clamp':dict(position=.012,target=.012,start=.012,start_ns=0,arrival_ns=0),'ui':dict(position=0.,target=0.,start=0.,start_ns=0,arrival_ns=0)};self.x=np.zeros(7);self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.method=copy.deepcopy(METHOD_EXAMPLE);self.programmed_current=METHOD_EXAMPLE['current_a'];self.calibration=copy.deepcopy(CALIBRATION_EXAMPLE);self.high_resistance_firmware_enabled=False;self.excitation_mode='current';self.voltage=copy.deepcopy(VOLTAGE_EXAMPLE);self.programmed_voltage=VOLTAGE_EXAMPLE['voltage_v'];self.current_limit=VOLTAGE_EXAMPLE['current_limit_a'];self.phase='idle';self.elapsed=0.;self.rows=[];self.error=None;self.operation_id=None;self._counter=0;self._start_ns=0;self._phase_index=0;self.expected_duration=0.;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._source=None;self._reference_id=None;self._evidence='no_sample';self._operation_source=None;self._operation_evidence='no_measurement';self.mass_loaded=self.mass_removed=self.volume_loaded=self.volume_removed=self.loaded_sensible=self.removed_sensible=0.
|
| 186 |
+
@property
|
| 187 |
+
def time_s(self):return self.time_ns/1e9
|
| 188 |
+
def register_principal(self,principal_id,visibility='agent'):
|
| 189 |
+
if not isinstance(principal_id,str) or not principal_id or principal_id in self._principals or visibility not in ('agent','debug','evaluator'):raise ActionRejected('REQUEST_CONFLICT')
|
| 190 |
+
self._principals[principal_id]=visibility
|
| 191 |
+
def session(self,principal_id):
|
| 192 |
+
if principal_id not in self._principals:raise ActionRejected('ACCESS_DENIED')
|
| 193 |
+
return LakeShoreMeasurereadyM91Session(self,principal_id)
|
| 194 |
+
def describe(self):return export_lakeshore_measurereadym91_contract_metadata()
|
| 195 |
+
def _warmup(self):return min(WARMUP_S,(self.time_ns-self._power_started_ns)/1e9) if self.power and self._power_started_ns is not None else 0.
|
| 196 |
+
def _moving(self,key):return self.time_ns<self.axes[key]['arrival_ns']
|
| 197 |
+
def _closed(self):return self.axes['clamp']['position']<=1e-12 and self.axes['clamp']['target']==0.
|
| 198 |
+
def _volume(self):return self.geometry['side_m']**2*self.geometry['thickness_m'] if self.sample else 0.
|
| 199 |
+
def _mass(self):return self._volume()*self.sample['density_kg_m3'] if self.sample else 0.
|
| 200 |
+
def _capacity(self):return .1+(self._mass()*self.sample['specific_heat_capacity_j_kg_k'] if self.sample else 0.)
|
| 201 |
+
def _temperature(self):return self.plant['ambient_k']+float(self.x[0]) if self.plant else None
|
| 202 |
+
def _contact(self):return CONTACTS[(self._phase_index//3)%3] if self.phase=='running' else 'idle'
|
| 203 |
+
def _polarity(self):return ['zero','positive','negative'][self._phase_index%3] if self.phase=='running' else 'zero'
|
| 204 |
+
def _button_position(self):
|
| 205 |
+
t=(self.time_ns-self._button_started_ns)/1e9
|
| 206 |
+
return .0015*(1-abs(t-.05)/.05) if 0<=t<=.1 else 0.
|
| 207 |
+
def _field_at(self,t):return external_field_at(self.field_actual,self.field_target,t,self.field['slew_t_s'],self.field['response_tau_s']) if self.field else self.field_actual
|
| 208 |
+
def _field_observed(self,B=None):
|
| 209 |
+
if not self.field:return None
|
| 210 |
+
B=self.field_actual if B is None else B;f=self.field;c=self.calibration;v=(f['probe_gain']*B+f['probe_offset_t']-c['field_offset_t'])*c['field_gain_correction'];return float(round(v/f['probe_resolution_t'])*f['probe_resolution_t'])
|
| 211 |
+
def _electrical(self,T=None,B=None):
|
| 212 |
+
if not self.sample or not self.power or self.phase!='running' or not self._closed():return dict(current=0.,requested=0.,voltage=0.,source_voltage=0.,sample_power=0.,contact_power=0.,valid=True,compliance=False,resistance=0.)
|
| 213 |
+
T=self._temperature() if T is None else T;B=self.field_actual if B is None else B;v=transport(self.record,T,clamp=True);sheet=v['resistivity_ohm_m']/self.geometry['thickness_m'];ra,rb=vdp_resistances(sheet,self.plant['contact_asymmetry']);bulk=sheet*self.plant['drive_geometry_factor'];contact=self.plant['current_contact_resistance_ohm'];sign={'zero':0.,'positive':1.,'negative':-1.}[self._polarity()]
|
| 214 |
+
if self.excitation_mode=='voltage':
|
| 215 |
+
requested=self.programmed_voltage*sign/(bulk+contact);I=math.copysign(min(abs(requested),self.current_limit),requested)
|
| 216 |
+
else:
|
| 217 |
+
requested=self.programmed_current*sign;I=math.copysign(min(abs(requested),self.plant['compliance_voltage_v']/(bulk+contact)),requested)
|
| 218 |
+
configuration=self._contact();R=float(ra if configuration=='vdp_a' else rb if configuration=='vdp_b' else v['hall_coefficient_m3_c']*B/self.geometry['thickness_m']*self.plant['hall_geometry_factor']+self.plant['hall_misalignment_fraction']*math.sqrt(ra*rb));return dict(current=I,requested=requested,voltage=I*R,source_voltage=I*(bulk+contact),sample_power=I*I*bulk,contact_power=I*I*contact,valid=v['valid'],compliance=abs(I-requested)>max(abs(requested)*1e-10,1e-18),resistance=R)
|
| 219 |
+
def _observed_current(self,e=None):
|
| 220 |
+
if not self.power or self.phase!='running':return None
|
| 221 |
+
e=self._electrical() if e is None else e
|
| 222 |
+
if self.excitation_mode=='current':return e['current']
|
| 223 |
+
full=self.voltage['current_measurement_range_a']
|
| 224 |
+
if abs(e['current'])>full:return None
|
| 225 |
+
q=full*self.voltage['current_resolution_fraction'];return float(round(e['current']/q)*q)
|
| 226 |
+
def _observed_voltage(self):
|
| 227 |
+
if not self.power or self.phase!='running':return None
|
| 228 |
+
c=self.calibration;voltage=(self.x[1]-c['voltage_offset_v'])*c['voltage_gain_correction']
|
| 229 |
+
if abs(voltage)>self.method['voltage_range_v']:return None
|
| 230 |
+
q=self.method['voltage_range_v']*self.plant['voltage_resolution_fraction'];return float(round(voltage/q)*q)
|
| 231 |
+
def read(self,role='evaluator'):
|
| 232 |
+
if role not in ('agent','debug','evaluator'):raise ActionRejected('ACCESS_DENIED')
|
| 233 |
+
active=self.power and self.phase=='running';e=self._electrical();d={'plant.configured':self.plant is not None,'geometry.configured':self.geometry is not None,'thermal.configured':self.thermal is not None,'field.configured':self.field is not None,'sample.present':self.sample is not None,'power.enabled':self.power,'warmup.ready':self._warmup()>=WARMUP_S,'thermal.enabled':self.thermal_enabled,'clamp.moving':self._moving('clamp'),'clamp.position_m':self.axes['clamp']['position'],'clamp.target_m':self.axes['clamp']['target'],'ui.tilt_rad':self.axes['ui']['position'],'ui.target_tilt_rad':self.axes['ui']['target'],'power.position_m':self._button_position(),'warmup.elapsed_s':self._warmup(),'thermal.target_k':self.target,'thermal.indicated_k':float(round(self._temperature()/self.plant['temperature_resolution_k'])*self.plant['temperature_resolution_k']) if self.plant and self.thermal else None,'field.target_t':self.field_target,'field.indicated_t':self._field_observed(),'excitation.programmed_current_a':self.programmed_current,'measured.current_a':self._observed_current(e),'options.high_resistance_firmware_enabled':self.high_resistance_firmware_enabled,'excitation.mode':self.excitation_mode,'excitation.programmed_voltage_v':self.programmed_voltage if self.excitation_mode=='voltage' else 0.,'excitation.current_measurement_range_a':self.voltage['current_measurement_range_a'] if self.excitation_mode=='voltage' else None,'excitation.source_voltage_v':e['source_voltage'] if active else None,'measured.voltage_v':self._observed_voltage(),'acquisition.contact_configuration':self._contact(),'acquisition.polarity':self._polarity(),'clock.time_s':self.time_s,'acquisition.phase':self.phase,'acquisition.elapsed_s':self.elapsed,'acquisition.points':len(self.rows),'truth.sample_k':self._temperature(),'truth.field_t':self.field_actual if self.field else None,'truth.sample_mass_kg':self._mass() if self.sample else None}
|
| 234 |
+
return {k:v for k,v in d.items() if role!='agent' or SLOTS[k]['visibility']=='agent'}
|
| 235 |
+
def _propagate(self,ns):
|
| 236 |
+
if not ns:return
|
| 237 |
+
dt=ns/1e9;field_end=self._field_at(dt)
|
| 238 |
+
if not self.plant or not self.thermal:self.field_actual=field_end;return
|
| 239 |
+
p=self.plant;th=self.thermal;C=self._capacity();G=th['closed_conductance_w_k'] if self._closed() else th['open_conductance_w_k'];K=th['controller_gain_w_k'] if self.thermal_enabled and self._closed() else 0.;target=self.target-p['ambient_k'];active=self.power and self.phase=='running'
|
| 240 |
+
def thermal_control(delta):return min(th['heating_limit_w'],max(-th['cooling_limit_w'],(K+G)*target-K*delta)) if K else 0.
|
| 241 |
+
if active:
|
| 242 |
+
name=self._contact();offset=p[{'vdp_a':'voltage_offset_a_v','vdp_b':'voltage_offset_b_v','hall':'voltage_offset_hall_v'}[name]];start_time=self.time_s
|
| 243 |
+
def rhs(t,y):
|
| 244 |
+
e=self._electrical(p['ambient_k']+y[0],self._field_at(t));controller=thermal_control(y[0]);ambient=G*y[0];signal=p['voltage_gain']*e['voltage']+offset+p['voltage_drift_v_s']*(start_time+t);return [(controller-ambient+e['sample_power'])/C,(signal-y[1])/p['voltage_response_tau_s'],e['sample_power'],e['contact_power'],e['current']*e['source_voltage'],controller,ambient]
|
| 245 |
+
sol=solve_ivp(rhs,(0.,dt),self.x,method='Radau',rtol=1e-10,atol=[1e-11,1e-14,1e-15,1e-15,1e-15,1e-12,1e-12])
|
| 246 |
+
if not sol.success:raise RuntimeError('INTEGRATION_FAILED')
|
| 247 |
+
self.x=sol.y[:,-1]
|
| 248 |
+
else:
|
| 249 |
+
initial=float(self.x[0]);low=min(initial,0.,target);high=max(initial,0.,target);saturated=K and ((K+G)*target-K*low>th['heating_limit_w'] or (K+G)*target-K*high < -th['cooling_limit_w'])
|
| 250 |
+
if saturated:
|
| 251 |
+
def rhs(_t,y):
|
| 252 |
+
control=thermal_control(y[0]);ambient=G*y[0];return [(control-ambient)/C,control,ambient]
|
| 253 |
+
sol=solve_ivp(rhs,(0.,dt),[self.x[0],self.x[5],self.x[6]],method='Radau',rtol=1e-10,atol=1e-11)
|
| 254 |
+
if not sol.success:raise RuntimeError('THERMAL_INTEGRATION_FAILED')
|
| 255 |
+
self.x[[0,5,6]]=sol.y[:,-1]
|
| 256 |
+
else:
|
| 257 |
+
A=np.zeros((4,4));A[0,0]=-(G+K)/C;A[0,3]=(K+G)*target/C if K else 0.;A[1,0]=-K;A[1,3]=(K+G)*target if K else 0.;A[2,0]=G;self.x[[0,5,6]]=(expm(A*dt)@np.array([self.x[0],self.x[5],self.x[6],1.]))[:3]
|
| 258 |
+
self.x[1]*=math.exp(-dt/p['voltage_response_tau_s'])
|
| 259 |
+
self.field_actual=field_end
|
| 260 |
+
def _ledger(self):
|
| 261 |
+
stored=self._capacity()*float(self.x[0]);joule,contact,source,control,ambient=self.x[2:];return dict(mass_loaded_kg=self.mass_loaded,mass_present_kg=self._mass(),mass_removed_kg=self.mass_removed,mass_error_kg=self.mass_loaded-self._mass()-self.mass_removed,volume_loaded_m3=self.volume_loaded,volume_present_m3=self._volume(),volume_removed_m3=self.volume_removed,volume_error_m3=self.volume_loaded-self._volume()-self.volume_removed,source_input_j=float(source),sample_joule_j=float(joule),contact_heat_export_j=float(contact),electrical_error_j=float(source-joule-contact),controller_input_j=float(control),ambient_loss_j=float(ambient),loaded_sensible_j=self.loaded_sensible,removed_sensible_j=self.removed_sensible,thermal_stored_j=stored,thermal_energy_error_j=float(control+joule-ambient+self.loaded_sensible-self.removed_sensible-stored))
|
| 262 |
+
def _result(self):return dict(operation_id=self.operation_id,phase=self.phase,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),template_source=self._operation_source,evidence=self._operation_evidence,error_code=self.error)
|
| 263 |
+
def _finish(self,phase,error=None):
|
| 264 |
+
self.phase=phase;self.error=error
|
| 265 |
+
if self.operation_id:self.records[self.operation_id]=self._result()
|
| 266 |
+
def _record(self):
|
| 267 |
+
e=self._electrical();voltage=self._observed_voltage();current=self._observed_current(e);error='REFERENCE_TEMPERATURE_RANGE' if not e['valid'] else 'SOURCE_COMPLIANCE' if e['compliance'] else 'CURRENT_MEASUREMENT_OVERFLOW' if current is None else 'VOLTAGE_OVERFLOW' if voltage is None else None
|
| 268 |
+
if not error and self._contact()!='hall' and self._polarity()!='zero' and not .01<=abs(e['resistance'])<=1e7:error='RESISTANCE_RANGE'
|
| 269 |
+
self.rows.append(dict(time_s=self.elapsed,host_time_s=self.time_s,contact_configuration=self._contact(),polarity=self._polarity(),current_a=current,voltage_v=voltage,field_t=self._field_observed(),temperature_k=self.read()['thermal.indicated_k'],quality='unavailable' if error else 'estimated',error_code=error));self._phase_index+=1
|
| 270 |
+
if error:self._finish('failed',error)
|
| 271 |
+
elif self._phase_index>=9*self.method['repeats']:self._finish('succeeded')
|
| 272 |
+
def invoke(self,capability,**a):
|
| 273 |
+
if capability not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 274 |
+
validate(CAPS[capability]['input_schema'],a)
|
| 275 |
+
if capability in UNSUPPORTED:raise ActionRejected('UNSUPPORTED')
|
| 276 |
+
if capability=='analysis.hall_vdp':return infer_hall_vdp(**a)
|
| 277 |
+
if capability=='acquisition.result':return self._result()
|
| 278 |
+
if capability=='provenance.read':return dict(reference_id=self._reference_id,template_source=self._source,evidence=self._evidence)
|
| 279 |
+
if capability=='ledger.read':return self._ledger()
|
| 280 |
+
if capability=='sim.step':self.step(a['dt_s']);return {'time_s':self.time_s}
|
| 281 |
+
if self.phase=='running' and capability not in ('acquisition.stop','power.set'):raise ActionRejected('BUSY')
|
| 282 |
+
if capability=='plant.configure':
|
| 283 |
+
if self.plant or not a['accept_engineering']:raise ActionRejected('PRECONDITION_FAILED')
|
| 284 |
+
self.plant=copy.deepcopy(a);self.target=a['ambient_k'];out={'configured':True}
|
| 285 |
+
elif capability=='geometry.configure':
|
| 286 |
+
if self.sample:raise ActionRejected('PRECONDITION_FAILED')
|
| 287 |
+
self.geometry=copy.deepcopy(a);out={'configured':True}
|
| 288 |
+
elif capability=='thermal.configure':
|
| 289 |
+
if not self.plant or self.thermal or not a['accept_external_thermal_boundary'] or not a['minimum_temperature_k']<=self.plant['ambient_k']<=a['maximum_temperature_k'] or a['minimum_temperature_k']>=a['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE')
|
| 290 |
+
self.thermal=copy.deepcopy(a);out={'configured':True}
|
| 291 |
+
elif capability=='field.configure':
|
| 292 |
+
if self.field or not a['accept_external_magnet']:raise ActionRejected('PRECONDITION_FAILED')
|
| 293 |
+
self.field=copy.deepcopy(a);out={'configured':True}
|
| 294 |
+
elif capability=='field.set_target':
|
| 295 |
+
if not self.field or abs(a['field_t'])>self.field['maximum_abs_t']:raise ActionRejected('FIELD_ENVELOPE')
|
| 296 |
+
self.field_target=a['field_t'];out={'target_t':self.field_target}
|
| 297 |
+
elif capability=='sample.load':
|
| 298 |
+
if not self.plant or not self.thermal or not self.geometry or self.sample or self._moving('clamp') or self.axes['clamp']['position']<.011 or not a['accept_directional_scalar_and_thermal_assumptions']:raise ActionRejected('PRECONDITION_FAILED')
|
| 299 |
+
record=library().get(a['reference_id'])
|
| 300 |
+
if record is None:raise ActionRejected('UNKNOWN_REFERENCE')
|
| 301 |
+
if transport(record,a['initial_temperature_k']) is None:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 302 |
+
if not self.thermal['minimum_temperature_k']<=a['initial_temperature_k']<=self.thermal['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE')
|
| 303 |
+
old=self._capacity();self.sample=copy.deepcopy(a);self.record=copy.deepcopy(record);new=self._capacity();delta=a['initial_temperature_k']-self.plant['ambient_k'];self.x[0]=(old*self.x[0]+(new-old)*delta)/new;self.loaded_sensible+=(new-old)*delta;self.mass_loaded+=self._mass();self.volume_loaded+=self._volume();self._reference_id=a['reference_id'];self._source=json.dumps(record['source'],ensure_ascii=False,sort_keys=True);self._evidence='experimental_signed_Hall_and_resistivity_digitized_curves; scalar_directional_and_thermal_parameters_explicit_assumptions';out={'loaded':True}
|
| 304 |
+
elif capability=='sample.remove':
|
| 305 |
+
if not self.sample or self._moving('clamp') or self.axes['clamp']['position']<.011:raise ActionRejected('PRECONDITION_FAILED')
|
| 306 |
+
self.mass_removed+=self._mass();self.volume_removed+=self._volume();self.removed_sensible+=self._mass()*self.sample['specific_heat_capacity_j_kg_k']*float(self.x[0]);self.sample=self.record=None;self._source=self._reference_id=None;self._evidence='no_sample';out={'loaded':False}
|
| 307 |
+
elif capability in ('sample.set_clamp','ui.set_tilt'):
|
| 308 |
+
if not self.plant:raise ActionRejected('PRECONDITION_FAILED')
|
| 309 |
+
key='clamp' if capability=='sample.set_clamp' else 'ui';target=(0. if a['closed'] else .012) if key=='clamp' else a['angle_rad'];speed=self.plant['clamp_speed_m_s' if key=='clamp' else 'ui_tilt_speed_rad_s'];axis=self.axes[key];axis.update(target=target,start=axis['position'],start_ns=self.time_ns,arrival_ns=self.time_ns+round(abs(target-axis['position'])/speed*1e9));out={'target_m' if key=='clamp' else 'target_rad':target}
|
| 310 |
+
elif capability=='power.set':
|
| 311 |
+
if not a['enabled'] and self.phase=='running':self._finish('cancelled','POWER_OFF')
|
| 312 |
+
if a['enabled']!=self.power:self._button_started_ns=self.time_ns;self._power_started_ns=self.time_ns if a['enabled'] else None
|
| 313 |
+
self.power=a['enabled'];out={'enabled':self.power}
|
| 314 |
+
elif capability=='thermal.set_temperature':
|
| 315 |
+
if not self.thermal or not self.thermal['minimum_temperature_k']<=a['temperature_k']<=self.thermal['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE')
|
| 316 |
+
self.target=a['temperature_k'];self.thermal_enabled=True;out={'target_k':self.target}
|
| 317 |
+
elif capability=='thermal.disable':self.thermal_enabled=False;out={'enabled':False}
|
| 318 |
+
elif capability=='method.configure':
|
| 319 |
+
if a['current_a']>a['current_range_a'] or abs(a['phase_duration_s']*1e9-round(a['phase_duration_s']*1e9))>1e-4:raise ActionRejected('CURRENT_OR_TIME_RANGE')
|
| 320 |
+
quantum=a['current_range_a']*1e-5;programmed=float(round(a['current_a']/quantum)*quantum);self.method=copy.deepcopy(a);self.programmed_current=programmed;self.excitation_mode='current';out={'configured':True,'programmed_current_a':programmed}
|
| 321 |
+
elif capability=='options.configure':
|
| 322 |
+
if not a['high_resistance_firmware_enabled'] and self.excitation_mode=='voltage':raise ActionRejected('EXCITATION_MODE_ACTIVE')
|
| 323 |
+
self.high_resistance_firmware_enabled=a['high_resistance_firmware_enabled'];out={'high_resistance_firmware_enabled':self.high_resistance_firmware_enabled}
|
| 324 |
+
elif capability=='excitation.voltage.configure':
|
| 325 |
+
if not self.high_resistance_firmware_enabled:raise ActionRejected('HIGH_RESISTANCE_FIRMWARE_REQUIRED')
|
| 326 |
+
if a['voltage_v']>a['voltage_range_v']:raise ActionRejected('VOLTAGE_EXCITATION_RANGE')
|
| 327 |
+
voltage_quantum=a['voltage_range_v']*1e-5;programmed=float(round(a['voltage_v']/voltage_quantum)*voltage_quantum);limit_full=next(fs for fs in CURRENT_RANGES if fs>=a['current_limit_a']);limit_quantum=limit_full*.001;limit=float(round(a['current_limit_a']/limit_quantum)*limit_quantum)
|
| 328 |
+
self.voltage=copy.deepcopy(a);self.programmed_voltage=programmed;self.current_limit=limit;self.excitation_mode='voltage';out={'configured':True,'programmed_voltage_v':programmed,'current_limit_a':limit}
|
| 329 |
+
elif capability=='sensor.calibrate':self.calibration=copy.deepcopy(a);out={'configured':True}
|
| 330 |
+
elif capability=='acquisition.start':
|
| 331 |
+
if not self.power or not self.plant or not self.geometry or not self.thermal or not self.field or not self.sample or not self._closed() or self._moving('clamp'):raise ActionRejected('PRECONDITION_FAILED')
|
| 332 |
+
if self._warmup()<WARMUP_S:raise ActionRejected('WARMUP_REQUIRED')
|
| 333 |
+
if (self.programmed_current if self.excitation_mode=='current' else self.programmed_voltage)<=0:raise ActionRejected('ZERO_EXCITATION')
|
| 334 |
+
if self.excitation_mode=='voltage' and not self.high_resistance_firmware_enabled:raise ActionRejected('HIGH_RESISTANCE_FIRMWARE_REQUIRED')
|
| 335 |
+
if abs(self.field_target-self.field_actual)>self.method['field_settling_tolerance_t']:raise ActionRejected('FIELD_NOT_SETTLED')
|
| 336 |
+
if transport(self.record,self._temperature()) is None:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 337 |
+
self._counter+=1;self.operation_id=f'{self.instance_id}:acquisition:{self._counter}';self._operation_source=self._source;self._operation_evidence=self._evidence;self.phase='running';self.elapsed=0.;self.rows=[];self.error=None;self._start_ns=self.time_ns;self._phase_index=0;self.expected_duration=9*self.method['repeats']*round(self.method['phase_duration_s']*1e9)/1e9;out={'operation_id':self.operation_id,'expected_duration_s':self.expected_duration}
|
| 338 |
+
elif capability=='acquisition.stop':
|
| 339 |
+
if self.phase!='running':raise ActionRejected('NOT_RUNNING')
|
| 340 |
+
self._finish('cancelled','USER_CANCEL');out={'phase':self.phase,'elapsed_s':self.elapsed}
|
| 341 |
+
else:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 342 |
+
self.revision+=1;return copy.deepcopy(out)
|
| 343 |
+
def step(self,dt_s):
|
| 344 |
+
validate(number('s',0,86400),dt_s);total=math.fsum((self._clock_remainder_ns,dt_s*1e9));ns=round(total);self._clock_remainder_ns=total-ns
|
| 345 |
+
if not ns:return
|
| 346 |
+
end=self.time_ns+ns
|
| 347 |
+
while self.time_ns<end:
|
| 348 |
+
boundary=end
|
| 349 |
+
for key in self.axes:
|
| 350 |
+
if self._moving(key):boundary=min(boundary,self.axes[key]['arrival_ns'])
|
| 351 |
+
if self.phase=='running':boundary=min(boundary,self._start_ns+(self._phase_index+1)*round(self.method['phase_duration_s']*1e9))
|
| 352 |
+
self._propagate(boundary-self.time_ns);self.time_ns=boundary
|
| 353 |
+
if self.plant:
|
| 354 |
+
for key,axis in self.axes.items():
|
| 355 |
+
speed=self.plant['clamp_speed_m_s' if key=='clamp' else 'ui_tilt_speed_rad_s'];axis['position']=axis['target'] if self.time_ns>=axis['arrival_ns'] else axis['start']+math.copysign(speed*(self.time_ns-axis['start_ns'])/1e9,axis['target']-axis['start'])
|
| 356 |
+
if self.phase=='running':
|
| 357 |
+
self.elapsed=(self.time_ns-self._start_ns)/1e9
|
| 358 |
+
if self.time_ns==self._start_ns+(self._phase_index+1)*round(self.method['phase_duration_s']*1e9):self._record()
|
| 359 |
+
self.revision+=1
|
| 360 |
+
|
| 361 |
+
class LakeShoreMeasurereadyM91Session:
|
| 362 |
+
def __init__(self, host, principal_id): self._host = host; self._principal = principal_id
|
| 363 |
+
@property
|
| 364 |
+
def _role(self): return self._host._principals[self._principal]
|
| 365 |
+
def _target(self, instance_id):
|
| 366 |
+
if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 367 |
+
def describe(self, *, instance_id=None, asset_type_id=None):
|
| 368 |
+
if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT')
|
| 369 |
+
if instance_id is not None: self._target(instance_id)
|
| 370 |
+
if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 371 |
+
meta = export_lakeshore_measurereadym91_contract_metadata()
|
| 372 |
+
return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'})
|
| 373 |
+
def read(self, *, instance_id, state_ids=None):
|
| 374 |
+
self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids
|
| 375 |
+
if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT')
|
| 376 |
+
if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED')
|
| 377 |
+
return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids})
|
| 378 |
+
def _filter_result(self, result):
|
| 379 |
+
result = copy.deepcopy(result)
|
| 380 |
+
# A bridge may dispatch agent-visible capabilities through a privileged
|
| 381 |
+
# session. Public acquisition payloads therefore use the SAME redaction
|
| 382 |
+
# for every role. Full provenance has its own evaluator-only capability.
|
| 383 |
+
if 'rows' in result and 'template_source' in result:
|
| 384 |
+
result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None
|
| 385 |
+
result['evidence'] = 'observed_contact_voltages_current_and_external_field_with_explicit_scalar_Hall_vdP_assumptions; selected template details require evaluator provenance.read' if result['operation_id'] is not None else 'no_measurement'
|
| 386 |
+
return result
|
| 387 |
+
def invoke(self, *, instance_id, capability_id, arguments, request_id):
|
| 388 |
+
h=self._host
|
| 389 |
+
try:
|
| 390 |
+
self._target(instance_id)
|
| 391 |
+
if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 392 |
+
if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED')
|
| 393 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 394 |
+
validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False)
|
| 395 |
+
if key in h._requests:
|
| 396 |
+
old,response=h._requests[key]
|
| 397 |
+
if old!=digest: raise ActionRejected('REQUEST_CONFLICT')
|
| 398 |
+
return copy.deepcopy(response)
|
| 399 |
+
if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 400 |
+
if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 401 |
+
result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id=='acquisition.start' else None
|
| 402 |
+
if operation: h._owners[operation]=self._principal
|
| 403 |
+
response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None)
|
| 404 |
+
h._requests[key]=(digest,copy.deepcopy(response)); return response
|
| 405 |
+
except ActionRejected as exc:
|
| 406 |
+
return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none'))
|
| 407 |
+
def write(self, *, instance_id, state_id, value, request_id):
|
| 408 |
+
self._target(instance_id); entry=SLOTS.get(state_id)
|
| 409 |
+
if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED')
|
| 410 |
+
capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id)
|
| 411 |
+
def poll(self, operation_id):
|
| 412 |
+
h=self._host
|
| 413 |
+
if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 414 |
+
result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id)
|
| 415 |
+
if result is None: raise ActionRejected('UNKNOWN_OPERATION')
|
| 416 |
+
return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result))
|
| 417 |
+
def cancel(self, operation_id, request_id):
|
| 418 |
+
self.poll(operation_id); h=self._host
|
| 419 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 420 |
+
key=(self._principal,request_id)
|
| 421 |
+
if key in h._cancel_operations:
|
| 422 |
+
if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT')
|
| 423 |
+
return copy.deepcopy(h._requests[key][1])
|
| 424 |
+
if key in h._requests: raise ActionRejected('REQUEST_CONFLICT')
|
| 425 |
+
if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING')
|
| 426 |
+
result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id)
|
| 427 |
+
if result['status']=='succeeded': h._cancel_operations[key]=operation_id
|
| 428 |
+
return result
|
| 429 |
+
|
| 430 |
+
EFFECTS={
|
| 431 |
+
'plant.configure':['plant.configured','thermal.target_k','truth.sample_k'],
|
| 432 |
+
'geometry.configure':['geometry.configured'],
|
| 433 |
+
'thermal.configure':['thermal.configured','thermal.indicated_k'],
|
| 434 |
+
'field.configure':['field.configured','field.indicated_t','truth.field_t'],
|
| 435 |
+
'field.set_target':['field.target_t'],
|
| 436 |
+
'sample.load':['sample.present','truth.sample_mass_kg','truth.sample_k','thermal.indicated_k'],
|
| 437 |
+
'sample.remove':['sample.present','truth.sample_mass_kg'],
|
| 438 |
+
'sample.set_clamp':['clamp.target_m','clamp.moving'],
|
| 439 |
+
'ui.set_tilt':['ui.target_tilt_rad'],
|
| 440 |
+
'power.set':['power.enabled','power.position_m','warmup.ready','warmup.elapsed_s','acquisition.phase','measured.current_a','measured.voltage_v','acquisition.contact_configuration','acquisition.polarity','excitation.source_voltage_v'],
|
| 441 |
+
'thermal.set_temperature':['thermal.target_k','thermal.enabled'],'thermal.disable':['thermal.enabled'],
|
| 442 |
+
'method.configure':['excitation.programmed_current_a','excitation.mode','excitation.programmed_voltage_v','excitation.current_measurement_range_a'],
|
| 443 |
+
'options.configure':['options.high_resistance_firmware_enabled'],
|
| 444 |
+
'excitation.voltage.configure':['excitation.mode','excitation.programmed_voltage_v','excitation.current_measurement_range_a'],
|
| 445 |
+
'sensor.calibrate':['field.indicated_t','measured.voltage_v'],
|
| 446 |
+
'acquisition.start':['acquisition.phase','acquisition.elapsed_s','acquisition.points','acquisition.contact_configuration','acquisition.polarity','measured.current_a','measured.voltage_v','excitation.source_voltage_v'],
|
| 447 |
+
'acquisition.stop':['acquisition.phase','measured.current_a','measured.voltage_v','acquisition.contact_configuration','acquisition.polarity','excitation.source_voltage_v'],
|
| 448 |
+
'sim.step':list(SLOTS)}
|
| 449 |
+
for k,v in EFFECTS.items():CAPS[k]['effects']=v
|
| 450 |
+
ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'POWER_OFF','USER_CANCEL','SOURCE_COMPLIANCE','CURRENT_MEASUREMENT_OVERFLOW','VOLTAGE_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','RESISTANCE_RANGE'})
|
| 451 |
+
|
| 452 |
+
def export_lakeshore_measurereadym91_contract_metadata():
|
| 453 |
+
slots={};caps={}
|
| 454 |
+
for k,v in SLOTS.items():
|
| 455 |
+
slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; four-corner thin uniform scalar sheet; external normal B; conventional current and external-field reversal.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'LakeShoreMeasurereadyM91Session.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Only explicit host step advances field, thermal, motion, detector response and 1800s warmup. Each zero/positive/negative excitation phase records its endpoint after declared dwell: current mode uses +/-I and voltage mode uses +/-V.'),source_ids=['simulation_assumption'])
|
| 456 |
+
limits=[
|
| 457 |
+
'本体是M91 Hall控制器;磁体、样品夹具、场探头和温控边界由宿主明确组合,不虚构机内磁场或样品加热器。外部磁体供电/磁能不在本体电热账内。',
|
| 458 |
+
'本模型实现M91实际支持的传统电流/外部磁场反转vdP子集。FastHall无需物理反磁私有算法、Hall bar及200GΩ全域高阻计量未实现;电压激励明确依赖宿主选择M9-ADD-HR固件;不把unsupported负例称实现验证。',
|
| 459 |
+
'上电后只由真实宿主时间累计1800s预热,每次掉电清零;read/配置不推进时间,重复power.set(True)不重置已连续预热。',
|
| 460 |
+
'电流源六量程1µA至100mA,每档编程步长1e-5×满量程;1µA档10pA是分辨率,1µA不是可编程电流下限。电压观测五量程1mV至10V是满量程,微伏信号不因小于1mV而拒绝。',
|
| 461 |
+
'电压源四满量程10mV/100mV/1V/10V,编程步长1e-5×量程,10mV档可编程100nV而非最小输出10mV。仅M9-ADD-HR固件明确启用后可切换电压模式;method.configure切回电流模式。',
|
| 462 |
+
'电压模式实际I=Vset/(Rdrive+Rcontact),源电流limit按0.1%满档量化,自动满档采用最小可容纳限值电流档的显式工程规则(厂家未公开该自动选档细节),SCPI保守范围100nA至100mA;概述0至100mA与SCPI下限不同已记录。限流后实际Vsource=Iactual*(Rdrive+Rcontact),并保留功率后标compliance失败。',
|
| 463 |
+
'电压模式电流观测四满量程10nA/10µA/10mA/100mA依手册,官网不同分组未混用;current_resolution_fraction仅宿主工程量化模型,非OEM精度/噪声。测量档溢出不限制实际电流,观测current_a为null并失败,不允许null进入反演。',
|
| 464 |
+
'基础电阻范围10mΩ至10MΩ。电流源宿主顺从电压1至10V;达到顺从时实际电流按样品与两电流接触总阻抗降额,保留真实焦耳热并将测量标失败,不能假称目标电流已达到。',
|
| 465 |
+
'默认10×10mm、厚0.5mm四角薄片;geometry.configure只改变过程几何,静态示例mesh不自动缩放。装样时质量=ρside²d,载入后禁止改几何;卸样带走全部样品质量/体积及显热。',
|
| 466 |
+
'真实库提供实验数字化带符号RH(T)和rho(T),不同温网格分别线性插值;有效域与原论文保守温区相交。未由Seebeck推Hall符号,无域外材料外推有效读数。',
|
| 467 |
+
'密度、Cp、接触电阻、接触非对称、Hall几何因子、驱动几何因子和传感增益/偏置/τ/分辨率为宿主明确假设,不能当64种样品实测参数或OEM精度常数。',
|
| 468 |
+
'薄片均匀、简单连通、四角小接触、标量方向代表是假设;不求解有限接触电流密度、张量各向异性、磁阻、非线性I-V或多载流子输运。vdP前向RA/RB满足指数恒等式但接触非对称不来自3D电流场求解。',
|
| 469 |
+
'反演只使用外部观测I,V,B及时间,分别拟合电流奇项、I×B项、常偏置与线性漂移,再数值解vdP。两种B需方向相反且幅度满足显式容差,未宣称免反磁FastHall。',
|
| 470 |
+
'nH=1/(e|RH|)、muH=|RH|/rho是Hall派生量;额外n=rH*nH、mu=muH/rH依赖宿主显式单载流子Hall因子。ZrNiSn等来源可能多带,不把这些派生值冒充真实总载流子浓度。',
|
| 471 |
+
'每个外场操作为vdP-A、vdP-B和Hall接点各零/正/负激励(电流模式±I、电压模式±V),按实际phase_duration等待并求一阶电压传感响应;有限响应或温漂会产生可见拟合偏差,非瞬时真值直抄。',
|
| 472 |
+
'外部磁场满足有限slew和一阶响应,set_target只写目标;切换场时拒绝正在采样的操作。M91断电不关闭独立外部场/温控,取消仅停止测量激励并冻结已有相,已有热量继续交换。',
|
| 473 |
+
'样品与固定0.1J/K夹具热容共一个工程集中节点。闭合夹具由外部热控制器调温,开夹转为环境热交换;显式加热/冷却功率上限与热导未知必须输入,不借用主机35W供电当加热功率。',
|
| 474 |
+
'源电能分为样品I²R热和接触热导出环境,样品热与外部控制器/环境/装卸显热闭合;未计外部磁体功耗、Peltier/Thomson或磁化能,热账仅此明确电阻性子模型。',
|
| 475 |
+
'TiltView可手动倾斜,角范围/速度是工程代理;电源为100ms短按三角姿态不保持压下,低帧率可能看不到完整按键动作。显示覆盖为任意当前接点配置电压,并非每相都是Hall电压。',
|
| 476 |
+
'所有Session公开result/poll即使evaluator转发也统一去除所选来源,privileged provenance.read单独返回当前样品溯源;操作结果保存采样时来源快照,Python/磁盘共享不是OS安全隔离。',
|
| 477 |
+
'真实硬件校准、OEM精度/噪声、FastHall性能、机器人装样、完整电磁场/接触求解、外部温控与磁体硬件联调not_run。']
|
| 478 |
+
for k,v in CAPS.items():
|
| 479 |
+
un=k in UNSUPPORTED;async_=k=='acquisition.start';caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']}
|
| 480 |
+
caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.lakeshore_measurereadym91.LakeShoreMeasurereadyM91Session.invoke',invocation=f'session.invoke(instance_id="m91_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='运行入口原子检查明确外场/热条件、夹持、真实1800s预热、参考温域、量程和异步所有权。',state_ids=['power.enabled','warmup.ready','sample.present','clamp.position_m','field.configured','acquisition.phase'],enforced_by='runtime',check='LakeShoreMeasurereadyM91Runtime.invoke guards before commit')],state_effects=[dict(state_id=s,timing='immediate',description_zh='命令实际即时状态变化') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='只输出可映射状态,实际场景验证单独登记。',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='各接点配置的零/正/负激励相按真实停留时间采样,全部完成或测量范围错误终止' if async_ else '原子命令;预热/外场/电热/机械/采样仅宿主step推进',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','external_magnet','four_contact_fixture','programmable_source','voltmeter'],partial_failure_zh='取消/断电停止电流并冻结已完成测量相;外部场和独立温控、已积显热继续。范围错误保留不可用相后停止激励。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('POWER_OFF','USER_CANCEL','SOURCE_COMPLIANCE','CURRENT_MEASUREMENT_OVERFLOW','VOLTAGE_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','RESISTANCE_RANGE') else 'none') for e in ERRORS],verification=[],limitations=limits,source_ids=['manufacturer_primary','simulation_assumption','template_library'])
|
| 481 |
+
if k in ('thermal.set_temperature','thermal.disable','sample.set_clamp','ui.set_tilt','field.set_target','acquisition.start','power.set'):
|
| 482 |
+
caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='宿主时间推进外场、预热、电热、机械或实际测量相') for s in SLOTS if s not in v['effects'] and s not in ('plant.configured','geometry.configured','thermal.configured','field.configured','sample.present','power.enabled')]
|
| 483 |
+
mechanism=dict(component_ids=['controller','contact_carriage','sample_sheet','thermal_port','field_reference'],state_ids=list(slots),meaning_zh='传统外部磁场与电流反转的四接点Hall及van der Pauw观测反演,真实预热、有限场响应与电热质量账',implementation='lumped',equations=[
|
| 484 |
+
'Rs=rho(T)/d; RA=Rs*log(1+exp(u))/pi; RB=Rs*log(1+exp(-u))/pi. Therefore exp(-pi*RA/Rs)+exp(-pi*RB/Rs)=1. u is declared contact-asymmetry proxy.',
|
| 485 |
+
'Current step=range*1e-5; Current mode:Iactual=sign(Iset)*min(abs(Iset),Vcompliance/(Rs*drive_geometry_factor+Rcontact)),1<=Vcompliance<=10V. Voltage mode:Irequested=Vset/(Rdrive+Rcontact),Iactual=sign(Irequested)*min(abs(Irequested),Ilimit),Vactual=Iactual*(Rdrive+Rcontact);Ilimit100nA..100mA with0.1%FS programming and explicitly assumed smallest-containing-FS selection. Voltage ranges limit maximum magnitude, not minimum resolvable measured signal.',
|
| 486 |
+
'V_A=I*RA; V_B=I*RB; V_H=I*(RH(T)*B/d*hall_geometry_factor+misalignment*sqrt(RA*RB)). Gain/offset/linear drift feed explicit first-order detector dz/dt=(Vsignal-z)/tau.',
|
| 487 |
+
'dB/dt=clip((Btarget-B)/tau,-slew,+slew), integrated analytically through transition. Field and thermal source are external boundaries and continue independently of M91 logical power.',
|
| 488 |
+
'External inverse fits V=R*I+offset+drift*t for A/B and V=Rmisalign*I+(RH*g/d)*I*B+offset+drift*t for Hall. A bracketing root solves vdP sheet resistance using observed RA/RB only.',
|
| 489 |
+
'nH=1/(e*abs(RH)),muH=abs(RH)/rho; assumed single-carrier n=rH*nH,mu=muH/rH. Hall sign labels Hall response only; multiband true carrier populations are not inferred.',
|
| 490 |
+
'Psource=I*Vsource=I²*(Rdrive+Rcontact); Psample=I²*Rdrive; Pcontact_export=I²*Rcontact. Csample_total*dT/dt=Pcontroller+Psample-G*(T-Ta), Csample_total=0.1J/K+rho_mass*volume*Cp.',
|
| 491 |
+
'Pcontroller=clip((K+G)*(Ttarget-Ta)-K*(T-Ta),-cooling_limit,+heating_limit) when clamped and external controller enabled. Open clamp uses ambient Gopen and no active controller. Incoming/outgoing sample sensible heat is ledgered.',
|
| 492 |
+
'Idle linear thermal states use exact matrix exponential; active detector/temperature-dependent electrical model uses Radau integration with sampling-event boundaries; nanosecond residual carries fractional host timestep (e.g.60Hz). Warmup is1800 host seconds after last powerup.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=limits)
|
| 493 |
+
spec=importlib.util.spec_from_file_location('_m91_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'hall_van_der_pauw':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'geometry.configure':(GEOMETRY,GEOMETRY_EXAMPLE),'thermal.configure':(THERMAL,THERMAL_EXAMPLE),'field.configure':(FIELD,FIELD_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE),'excitation.voltage.configure':(VOLTAGE,VOLTAGE_EXAMPLE)})
|
| 494 |
+
for key,value in SLOTS.items():slots[key]['meaning_zh']=value['meaning']
|
| 495 |
+
return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'hall_van_der_pauw':mechanism})
|
scripts/asset_runtime/novocontrol_alphat.py
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM140 Alpha-T RevC with current converter: observed phasor spectroscopy.
|
| 2 |
+
|
| 3 |
+
Finite dwell,50ohm generator loading,external OSL inverse calibration and explicit
|
| 4 |
+
thermal budgets. Static dielectric references never become claimed measured spectra.
|
| 5 |
+
"""
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
import copy,importlib.util,json,math
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
import numpy as np
|
| 10 |
+
from scipy.integrate import solve_ivp
|
| 11 |
+
PROTOCOL_VERSION='1.0.0';SLUG='novocontrol_alphat';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-140'
|
| 12 |
+
ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'dielectric_library.json'
|
| 13 |
+
|
| 14 |
+
class ActionRejected(ValueError):pass
|
| 15 |
+
|
| 16 |
+
def number(unit='1',lo=None,hi=None):
|
| 17 |
+
s={'type':'number','x-unit':unit}
|
| 18 |
+
if lo is not None:s['minimum']=lo
|
| 19 |
+
if hi is not None:s['maximum']=hi
|
| 20 |
+
return s
|
| 21 |
+
|
| 22 |
+
def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False)
|
| 23 |
+
def nullable(s):return {'anyOf':[s,{'type':'null'}]}
|
| 24 |
+
def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum)
|
| 25 |
+
def enum(items):return {'type':'string','enum':items}
|
| 26 |
+
BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed'])
|
| 27 |
+
|
| 28 |
+
def validate(s,v):
|
| 29 |
+
if 'anyOf' in s:
|
| 30 |
+
for o in s['anyOf']:
|
| 31 |
+
try:validate(o,v);return
|
| 32 |
+
except ActionRejected:pass
|
| 33 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 34 |
+
k=s.get('type')
|
| 35 |
+
if k in ('number','integer'):
|
| 36 |
+
if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 37 |
+
elif k=='object':
|
| 38 |
+
if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT')
|
| 39 |
+
for key,value in v.items():validate(s['properties'][key],value)
|
| 40 |
+
elif k=='array':
|
| 41 |
+
if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 42 |
+
for x in v:validate(s['items'],x)
|
| 43 |
+
elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT')
|
| 44 |
+
elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT')
|
| 45 |
+
elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT')
|
| 46 |
+
if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT')
|
| 47 |
+
|
| 48 |
+
from scipy.linalg import expm
|
| 49 |
+
EPS0=8.8541878128e-12
|
| 50 |
+
SOURCE_RESISTANCE_OHM=50.
|
| 51 |
+
CONVERTER_LIMIT_A=.04
|
| 52 |
+
MIN_POINT_S=1/10.5
|
| 53 |
+
|
| 54 |
+
def library():return {x['id']:x for x in json.loads(LIBRARY_PATH.read_text())['templates']}
|
| 55 |
+
def cx(unit):return obj({'real':number(unit),'imag':number(unit)})
|
| 56 |
+
def pack(z):return dict(real=float(complex(z).real),imag=float(complex(z).imag))
|
| 57 |
+
def unpack(v):return complex(v['real'],v['imag'])
|
| 58 |
+
def vacuum_capacitance(diameter_m,thickness_m):return EPS0*math.pi*(diameter_m/2)**2/thickness_m
|
| 59 |
+
|
| 60 |
+
def dielectric_response(epsilon_static,epsilon_infinity,relaxation_time_s,dc_conductivity_s_m,frequency_hz):
|
| 61 |
+
w=2*math.pi*frequency_hz;return epsilon_infinity+(epsilon_static-epsilon_infinity)/(1+1j*w*relaxation_time_s)-1j*dc_conductivity_s_m/(w*EPS0)
|
| 62 |
+
|
| 63 |
+
def infer_dielectric(frequency_hz,voltage_rms,current_rms,diameter_m,thickness_m):
|
| 64 |
+
voltage=unpack(voltage_rms);current=unpack(current_rms)
|
| 65 |
+
if abs(voltage)<1e-30 or abs(current)<1e-30:raise ActionRejected('ANALYSIS_ZERO_SIGNAL')
|
| 66 |
+
z=voltage/current
|
| 67 |
+
if not math.isfinite(z.real) or not math.isfinite(z.imag) or abs(z)<1e-300:raise ActionRejected('ANALYSIS_DATA')
|
| 68 |
+
y=1/z;w=2*math.pi*frequency_hz;c0=vacuum_capacitance(diameter_m,thickness_m);eps=y/(1j*w*c0)
|
| 69 |
+
if eps.real<=0 or -eps.imag < -1e-9*max(abs(eps),1.):raise ActionRejected('NONPASSIVE_OR_NONCAPACITIVE_RESULT')
|
| 70 |
+
loss=max(0.,-eps.imag)
|
| 71 |
+
return dict(impedance_ohm=pack(z),epsilon_real=float(eps.real),epsilon_loss=float(loss),tan_delta=float(loss/eps.real),parallel_capacitance_f=float(c0*eps.real),conductivity_real_s_m=float(w*EPS0*loss),conductivity_imag_s_m=float(w*EPS0*eps.real),evidence='inverse_of_supplied_RMS_complex_voltage_and_current; epsilon=Y/(j*omega*C0); sigma_real_includes_dielectric_loss_not_only_dc_conduction')
|
| 72 |
+
|
| 73 |
+
def solve_osl(frequency_hz,open_measured_ohm,short_measured_ohm,load_measured_ohm,load_resistance_ohm):
|
| 74 |
+
zo,zs,zl=map(unpack,[open_measured_ohm,short_measured_ohm,load_measured_ohm]);scale=max(abs(zo),abs(zs),abs(zl),1e-30)
|
| 75 |
+
if abs(zo)<1e-30 or abs(zl-zs)<1e-12*max(abs(zl),abs(zs),1e-30) or abs(zo-zs)<1e-12*scale:raise ActionRejected('CALIBRATION_DEGENERATE')
|
| 76 |
+
a=load_resistance_ohm*(1-zl/zo)/(zl-zs);b=-a*zs;c=-1/zo
|
| 77 |
+
if not all(math.isfinite(v) for z in (a,b,c) for v in (z.real,z.imag)):raise ActionRejected('CALIBRATION_DEGENERATE')
|
| 78 |
+
return dict(frequency_hz=frequency_hz,a=pack(a),b_ohm=pack(b),c_s=pack(c),evidence='three_standard_Mobius_inverse_from_external_open_short_load_measurements; no_hidden_fixture_or_gain_access')
|
| 79 |
+
|
| 80 |
+
def correct_impedance(z,calibration):
|
| 81 |
+
denominator=unpack(calibration['c_s'])*z+1
|
| 82 |
+
if abs(denominator)<1e-14:raise ActionRejected('CALIBRATION_SINGULAR')
|
| 83 |
+
return (unpack(calibration['a'])*z+unpack(calibration['b_ohm']))/denominator
|
| 84 |
+
|
| 85 |
+
PLANT_EXAMPLE=dict(ambient_k=293.2,fixture_series_resistance_ohm=.2,fixture_series_inductance_h=1e-7,fixture_parallel_capacitance_f=2e-12,fixture_parallel_conductance_s=1e-10,voltage_gain_magnitude=1.,voltage_gain_phase_rad=0.,current_gain_magnitude=1.,current_gain_phase_rad=0.,voltage_resolution_v=1e-10,current_resolution_a=1e-18,detector_tau_s=.002,temperature_resolution_k=1e-4,clamp_speed_m_s=.025,accept_engineering=True)
|
| 86 |
+
PLANT=obj({'ambient_k':number('K',283.15,313.15),'fixture_series_resistance_ohm':number('ohm',0,1e6),'fixture_series_inductance_h':number('H',0,1),'fixture_parallel_capacitance_f':number('F',1e-18,1e-3),'fixture_parallel_conductance_s':number('S',0,1),'voltage_gain_magnitude':number('1',.1,10),'voltage_gain_phase_rad':number('rad',-math.pi,math.pi),'current_gain_magnitude':number('1',.1,10),'current_gain_phase_rad':number('rad',-math.pi,math.pi),'voltage_resolution_v':number('V',1e-15,.1),'current_resolution_a':number('A',1e-24,.001),'detector_tau_s':number('s',1e-6,100),'temperature_resolution_k':number('K',1e-6,1),'clamp_speed_m_s':number('m/s',.0001,.1),'accept_engineering':BOOL})
|
| 87 |
+
GEOMETRY_EXAMPLE=dict(diameter_m=.02,thickness_m=.001)
|
| 88 |
+
GEOMETRY=obj({'diameter_m':number('m',.001,.1),'thickness_m':number('m',1e-6,.02)})
|
| 89 |
+
THERMAL_EXAMPLE=dict(minimum_temperature_k=293.15,maximum_temperature_k=303.15,bath_capacity_j_k=5.,bath_ambient_conductance_w_k=.1,sample_bath_conductance_w_k=.5,open_sample_ambient_conductance_w_k=.05,controller_gain_w_k=5.,heating_limit_w=30.,cooling_limit_w=30.,accept_external_engineering_system=True)
|
| 90 |
+
THERMAL=obj({'minimum_temperature_k':number('K',100,1000),'maximum_temperature_k':number('K',100,1000),'bath_capacity_j_k':number('J/K',.001,1e7),'bath_ambient_conductance_w_k':number('W/K',0,1000),'sample_bath_conductance_w_k':number('W/K',1e-6,1000),'open_sample_ambient_conductance_w_k':number('W/K',0,100),'controller_gain_w_k':number('W/K',1e-6,1e5),'heating_limit_w':number('W',.001,1e5),'cooling_limit_w':number('W',.001,1e5),'accept_external_engineering_system':BOOL})
|
| 91 |
+
SAMPLE_EXAMPLE=dict(reference_id='water_crc_7732_18_5',epsilon_infinity=4.9,relaxation_time_s=1e-11,dc_conductivity_s_m=5e-6,density_kg_m3=1000.,specific_heat_capacity_j_kg_k=4180.,initial_temperature_k=293.2,temperature_tolerance_k=.5,accept_spectrum_assumption=True,accept_thermal_assumption=True)
|
| 92 |
+
SAMPLE=obj({'reference_id':TEXT,'epsilon_infinity':number('1',1,1e5),'relaxation_time_s':number('s',1e-15,1e12),'dc_conductivity_s_m':number('S/m',0,1e8),'density_kg_m3':number('kg/m^3',1,30000),'specific_heat_capacity_j_kg_k':number('J/kg/K',1,10000),'initial_temperature_k':number('K',100,1000),'temperature_tolerance_k':number('K',.0001,2.),'accept_spectrum_assumption':BOOL,'accept_thermal_assumption':BOOL})
|
| 93 |
+
METHOD_EXAMPLE=dict(frequencies_hz=[10.,100.,1000.,10000.,100000.],source_voltage_rms_v=.3,cycles_per_point=1,settling_s=.01,require_calibration=False)
|
| 94 |
+
METHOD=obj({'frequencies_hz':array(number('Hz',3e-6,4e7),1,2001),'source_voltage_rms_v':number('V',0,3),'cycles_per_point':dict(type='integer',minimum=1,maximum=1000,**{'x-unit':'1'}),'settling_s':number('s',0,10000),'require_calibration':BOOL})
|
| 95 |
+
MODE=enum(['sample','open','short','load'])
|
| 96 |
+
OSL_INPUT=obj({'frequency_hz':number('Hz',3e-6,4e7),'open_measured_ohm':cx('ohm'),'short_measured_ohm':cx('ohm'),'load_measured_ohm':cx('ohm'),'load_resistance_ohm':number('ohm',.01,1e12)})
|
| 97 |
+
OSL_RESULT=obj({'frequency_hz':number('Hz',3e-6,4e7),'a':cx('1'),'b_ohm':cx('ohm'),'c_s':cx('S'),'evidence':TEXT})
|
| 98 |
+
OSL_EXAMPLE=dict(frequency_hz=1000.,open_measured_ohm=pack(100-1e6j),short_measured_ohm=pack(.2+.0006j),load_measured_ohm=pack(1000.199+.999j),load_resistance_ohm=1000.)
|
| 99 |
+
ANALYSIS_INPUT=obj({'frequency_hz':number('Hz',3e-6,4e7),'voltage_rms':cx('V'),'current_rms':cx('A'),'diameter_m':number('m',.001,.1),'thickness_m':number('m',1e-6,.02)})
|
| 100 |
+
ANALYSIS_EXAMPLE=dict(frequency_hz=1000.,voltage_rms=pack(1.),current_rms=pack(1e-8+1e-6j),diameter_m=.02,thickness_m=.001)
|
| 101 |
+
INFERENCE=obj({'impedance_ohm':cx('ohm'),'epsilon_real':number('1',0),'epsilon_loss':number('1',0),'tan_delta':number('1',0),'parallel_capacitance_f':number('F',0),'conductivity_real_s_m':number('S/m',0),'conductivity_imag_s_m':number('S/m',0),'evidence':TEXT})
|
| 102 |
+
ROW=obj({'time_s':number('s',0),'host_time_s':number('s',0),'frequency_hz':number('Hz'),'point_duration_s':number('s',0),'load_mode':MODE,'source_voltage_rms_v':number('V'),'voltage_rms':nullable(cx('V')),'current_rms':nullable(cx('A')),'raw_impedance_ohm':nullable(cx('ohm')),'impedance_ohm':nullable(cx('ohm')),'epsilon_real':nullable(number('1')),'epsilon_loss':nullable(number('1')),'tan_delta':nullable(number('1')),'parallel_capacitance_f':nullable(number('F')),'conductivity_real_s_m':nullable(number('S/m')),'conductivity_imag_s_m':nullable(number('S/m')),'sample_temperature_k':nullable(number('K')),'calibration_applied':BOOL,'quality':enum(['estimated','unavailable']),'error_code':nullable(TEXT)})
|
| 103 |
+
RESULT=obj({'operation_id':nullable(TEXT),'phase':PHASE,'elapsed_s':number('s',0),'rows':array(ROW,0,2001),'template_source':nullable(TEXT),'evidence':TEXT,'error_code':nullable(TEXT)})
|
| 104 |
+
CAPS={};SLOTS={}
|
| 105 |
+
def cap(k,i,o,c,z,kind='device_command',visibility='agent',example=None):CAPS[k]=dict(input_schema=i,output_schema=o,component_ids=c,function_zh=z,kind=kind,visibility=visibility,example_arguments=copy.deepcopy(example or {}),effects=[])
|
| 106 |
+
def slot(k,s,u,z,origin='derived',visibility='agent',component='controller'):SLOTS[k]=dict(schema=s,unit=u,meaning=z,origin=origin,visibility=visibility,component=component,write=None)
|
| 107 |
+
cap('plant.configure',PLANT,obj({'configured':BOOL}),['controller','current_converter'],'宿主显式寄生/相位增益/探测响应参数,厂家50Ω源电阻固定','configuration','evaluator',PLANT_EXAMPLE)
|
| 108 |
+
cap('geometry.configure',GEOMETRY,obj({'configured':BOOL}),['electrode_upper','electrode_lower','sample_disc'],'工程平板夹具几何与C0;装样后尺寸锁定守恒','configuration','evaluator',GEOMETRY_EXAMPLE)
|
| 109 |
+
cap('thermal.configure',THERMAL,obj({'configured':BOOL}),['thermal_port','electrode_lower'],'明确选择外部工程集中热边界,不假造OEM温控附件额定温区','configuration','evaluator',THERMAL_EXAMPLE)
|
| 110 |
+
cap('sample.load',SAMPLE,obj({'loaded':BOOL}),['sample_disc'],'真实静态介电参考加显式Debye/直流导电/热物性假设,不冒充实测宽频谱','configuration','evaluator',SAMPLE_EXAMPLE)
|
| 111 |
+
cap('sample.remove',obj({}),obj({'loaded':BOOL}),['sample_disc'],'移出整片/定容液体样品及当前显热,不回滚已耗散热','configuration','evaluator')
|
| 112 |
+
cap('sample.set_clamp',obj({'closed':BOOL}),obj({'target_m':number('m',0,.025)}),['electrode_upper'],'宿主手动上电极有限运动代理,开放时转为外界热交换','simulation','evaluator',{'closed':True})
|
| 113 |
+
cap('power.set',obj({'enabled':BOOL}),obj({'enabled':BOOL}),['power_switch'],'关闭源电压/控制并取消采集,样品显热继续交换',example={'enabled':True})
|
| 114 |
+
cap('thermal.set_temperature',obj({'temperature_k':number('K',100,1000)}),obj({'target_k':number('K')}),['thermal_port'],'只写已配置外部热边界范围内目标,实际温度仅step推进',example={'temperature_k':293.2})
|
| 115 |
+
cap('thermal.disable',obj({}),obj({'enabled':BOOL}),['thermal_port'],'停止外部主动温控,热交换与介电耗散仍按实际供电继续')
|
| 116 |
+
cap('fixture.select_load',obj({'mode':MODE,'load_resistance_ohm':number('ohm',.01,1e12)}),obj({'mode':MODE}),['electrode_upper','current_converter'],'宿主连接样品或外部open/short/已知纯电阻参考;非已验证自动校准切换硬件','simulation','evaluator',{'mode':'sample','load_resistance_ohm':1000.})
|
| 117 |
+
cap('method.configure',METHOD,obj({'configured':BOOL}),['controller'],'每点实际等待cycles/f和无OptionF的10.5点/s下限,幅度按频界检查','configuration',example=METHOD_EXAMPLE)
|
| 118 |
+
cap('calibration.solve',OSL_INPUT,OSL_RESULT,['controller'],'只用外部open/short/load复阻抗观测解三项Möbius校正','analysis',example=OSL_EXAMPLE)
|
| 119 |
+
cap('calibration.apply',obj({'records':array(OSL_RESULT,1,2001)}),obj({'configured':BOOL}),['controller'],'应用外部逐频点校准系数;不外推/插值到未校准频率','configuration',example={'records':[solve_osl(**OSL_EXAMPLE)]})
|
| 120 |
+
cap('calibration.clear',obj({}),obj({'configured':BOOL}),['controller'],'清除校准记录并明确返回未校准状态','configuration')
|
| 121 |
+
cap('acquisition.start',obj({}),obj({'operation_id':TEXT,'expected_duration_s':number('s',0)}),['controller','current_converter'],'异步逐频率实际驻留并采集RMS复电压电流')
|
| 122 |
+
cap('acquisition.stop',obj({}),obj({'phase':PHASE,'elapsed_s':number('s',0)}),['controller'],'停止源激励并冻结已完成频点,部分点不伪装完成')
|
| 123 |
+
cap('acquisition.result',obj({}),RESULT,['controller'],'公开复VI观测和反演介电/损耗/阻抗;任意会话均隐藏选中物质来源','query')
|
| 124 |
+
cap('analysis.dielectric',ANALYSIS_INPUT,INFERENCE,['controller'],'仅由外部复VI及平板几何反演,σ实部包括介电损耗与直流导电','analysis',example=ANALYSIS_EXAMPLE)
|
| 125 |
+
cap('provenance.read',obj({}),obj({'reference_id':nullable(TEXT),'template_source':nullable(TEXT),'evidence':TEXT}),['controller'],'仅宿主读取当前样品真实静态参考及显式谱假设来源','query','evaluator')
|
| 126 |
+
LEDGER_UNITS=dict(mass_loaded_kg='kg',mass_present_kg='kg',mass_removed_kg='kg',mass_error_kg='kg',volume_loaded_m3='m^3',volume_present_m3='m^3',volume_removed_m3='m^3',volume_error_m3='m^3',generator_active_input_j='J',source_resistor_heat_j='J',fixture_parasitic_heat_j='J',reference_load_heat_j='J',sample_dielectric_heat_j='J',electrical_error_j='J',controller_input_j='J',ambient_loss_j='J',loaded_sensible_j='J',removed_sensible_j='J',thermal_stored_j='J',thermal_energy_error_j='J')
|
| 127 |
+
cap('ledger.read',obj({}),obj({k:number(u) for k,u in LEDGER_UNITS.items()}),['controller'],'周期平��源/50Ω/寄生/参考/样品耗散及热/质量/体积守恒账','query','evaluator')
|
| 128 |
+
cap('sim.step',obj({'dt_s':number('s',0,86400)}),obj({'time_s':number('s',0)}),['controller'],'单一宿主时钟支持分数纳秒余数,超长低频点必须实际累计推进','simulation','evaluator',{'dt_s':.1})
|
| 129 |
+
UNSUPPORTED=['hardware.connect','robot.load','measurement.dc_bias_option_b','measurement.fast_option_f','measurement.high_voltage','measurement.oem_thermal_attachment','noise.empirical','accuracy.certification','measurement.field_transients']
|
| 130 |
+
for k in UNSUPPORTED:cap(k,obj({}),obj({}),['controller'],'未实现:'+k)
|
| 131 |
+
for k,c in [('plant.configured','controller'),('geometry.configured','electrode_lower'),('thermal.configured','thermal_port'),('sample.present','sample_disc'),('power.enabled','power_switch'),('thermal.enabled','thermal_port'),('clamp.moving','electrode_upper'),('calibration.configured','controller')]:slot(k,BOOL,'1','实际配置或运行状态',component=c)
|
| 132 |
+
for suffix in ['position_m','target_m']:slot('clamp.'+suffix,number('m',0,.025),'m','上电极开口相对测量位置位移;0闭合,.025开放','setpoint' if suffix=='target_m' else 'scene',component='electrode_upper')
|
| 133 |
+
slot('power.angle_rad',number('rad',0,.28),'rad','电源开关工程姿态','scene',component='power_switch')
|
| 134 |
+
slot('thermal.target_k',number('K'),'K','外部工程热边界温度目标,不代表OEM温控能力','setpoint',component='thermal_port')
|
| 135 |
+
slot('thermal.indicated_k',nullable(number('K')),'K','样品与电极集中节点量化温度API观测,非厂家精度认证','sensor',component='sample_disc')
|
| 136 |
+
slot('excitation.frequency_hz',nullable(number('Hz')),'Hz','当前真实驻留频点,未激励时null','derived',component='controller')
|
| 137 |
+
slot('excitation.source_voltage_rms_v',number('V'),'V','当前50Ω前源RMS幅度,停止时0,不等于样品两端幅度','derived',component='controller')
|
| 138 |
+
slot('fixture.load_mode',MODE,'1','宿主当前接入sample/open/short/load参考','setpoint',component='current_converter')
|
| 139 |
+
slot('measured.voltage_rms_v',nullable(cx('V')),'V','含显式增益/相位/响应/量化的复RMS电压观测','sensor',component='current_converter')
|
| 140 |
+
slot('measured.current_rms_a',nullable(cx('A')),'A','含显式增益/相位/响应/量化的复RMS电流;超过40mA时不可用','sensor',component='current_converter')
|
| 141 |
+
slot('clock.time_s',number('s',0),'s','唯一宿主时钟')
|
| 142 |
+
slot('acquisition.phase',PHASE,'1','异步频扫状态')
|
| 143 |
+
slot('acquisition.elapsed_s',number('s',0),'s','本次实际源激励时长')
|
| 144 |
+
slot('acquisition.expected_duration_s',number('s',0),'s','逐点频率周期及通信速率下限计算的所需总时长')
|
| 145 |
+
slot('acquisition.points',{'type':'integer','minimum':0,'maximum':2001,'x-unit':'1'},'1','实际完成的频点数,不含尚未完成点')
|
| 146 |
+
for k,u in [('truth.bath_k','K'),('truth.sample_k','K'),('truth.sample_mass_kg','kg'),('truth.dc_conductivity_s_m','S/m')]:slot(k,nullable(number(u)),u,'仅宿主真实热/样品参数状态','process_truth','evaluator')
|
| 147 |
+
|
| 148 |
+
class NovocontrolAlphatRuntime:
|
| 149 |
+
def __init__(self,instance_id='alphat_01'):
|
| 150 |
+
self.instance_id=instance_id;self.plant=None;self.geometry=None;self.thermal=None;self.sample=None;self.record=None;self.power=False;self.thermal_enabled=False;self.target=293.2;self.clamp=.025;self.clamp_target=.025;self._clamp_start=.025;self._clamp_start_ns=0;self._clamp_arrival_ns=0;self.x=np.zeros(4);self.detector=np.zeros(2,dtype=complex);self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.mode='sample';self.load_resistance=1000.;self.method=copy.deepcopy(METHOD_EXAMPLE);self.calibration={};self.phase='idle';self.elapsed=0.;self.rows=[];self.error=None;self.operation_id=None;self._counter=0;self._start_ns=0;self._point_index=0;self._point_start_ns=0;self._point_end_ns=0;self.expected_duration=0.;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._source=None;self._reference_id=None;self._evidence='no_sample';self._operation_source=None;self._operation_evidence='no_measurement';self.mass_loaded=self.mass_removed=self.volume_loaded=self.volume_removed=self.loaded_sensible=self.removed_sensible=0.;self.electrical_energy=np.zeros(5)
|
| 151 |
+
@property
|
| 152 |
+
def time_s(self):return self.time_ns/1e9
|
| 153 |
+
def register_principal(self,principal_id,visibility='agent'):
|
| 154 |
+
if not isinstance(principal_id,str) or not principal_id or principal_id in self._principals or visibility not in ('agent','debug','evaluator'):raise ActionRejected('REQUEST_CONFLICT')
|
| 155 |
+
self._principals[principal_id]=visibility
|
| 156 |
+
def session(self,principal_id):
|
| 157 |
+
if principal_id not in self._principals:raise ActionRejected('ACCESS_DENIED')
|
| 158 |
+
return NovocontrolAlphatSession(self,principal_id)
|
| 159 |
+
def describe(self):return export_novocontrol_alphat_contract_metadata()
|
| 160 |
+
def _moving(self):return self.time_ns<self._clamp_arrival_ns
|
| 161 |
+
def _closed(self):return self.clamp<=1e-12 and self.clamp_target==0.
|
| 162 |
+
def _volume(self):return math.pi*(self.geometry['diameter_m']/2)**2*self.geometry['thickness_m'] if self.sample else 0.
|
| 163 |
+
def _mass(self):return self._volume()*self.sample['density_kg_m3'] if self.sample else 0.
|
| 164 |
+
def _capacities(self):return np.array([self.thermal['bath_capacity_j_k'],.1+(self._mass()*self.sample['specific_heat_capacity_j_kg_k'] if self.sample else 0.)])
|
| 165 |
+
def _temperature(self,i):return self.plant['ambient_k']+float(self.x[i]) if self.plant and self.thermal else None
|
| 166 |
+
def _frequency(self):return self.method['frequencies_hz'][self._point_index] if self.phase=='running' else None
|
| 167 |
+
def _point_duration_ns(self,f):return math.ceil((self.method['settling_s']+max(self.method['cycles_per_point']/f,MIN_POINT_S))*1e9)
|
| 168 |
+
def _circuit(self,f=None,vrms=None,mode=None):
|
| 169 |
+
f=self._frequency() if f is None else f;vrms=self.method['source_voltage_rms_v'] if vrms is None else vrms;mode=self.mode if mode is None else mode
|
| 170 |
+
if f is None or not self.plant:return dict(voltage=0j,current=0j,source_voltage=0.,power=np.zeros(5),sample_admittance=0j)
|
| 171 |
+
p=self.plant;w=2*math.pi*f;zp=complex(p['fixture_series_resistance_ohm'],w*p['fixture_series_inductance_h']);yp=complex(p['fixture_parallel_conductance_s'],w*p['fixture_parallel_capacitance_f']);ys=0j
|
| 172 |
+
if mode=='sample' and self.sample:
|
| 173 |
+
s=self.sample;eps=dielectric_response(s['epsilon_static'],s['epsilon_infinity'],s['relaxation_time_s'],s['dc_conductivity_s_m'],f);ys=1j*w*vacuum_capacitance(**self.geometry)*eps
|
| 174 |
+
elif mode=='load':ys=1/self.load_resistance
|
| 175 |
+
parallel_z=0j if mode=='short' else 1/(ys+yp);fixture_z=zp+parallel_z;current=complex(vrms)/(SOURCE_RESISTANCE_OHM+fixture_z);voltage=current*fixture_z;parallel_voltage=current*parallel_z;sample_power=abs(parallel_voltage)**2*ys.real if mode=='sample' else 0.;reference_power=abs(parallel_voltage)**2*ys.real if mode=='load' else 0.;parasitic=abs(current)**2*zp.real+abs(parallel_voltage)**2*yp.real;source_heat=abs(current)**2*SOURCE_RESISTANCE_OHM;input_power=float((complex(vrms)*current.conjugate()).real);return dict(voltage=voltage,current=current,source_voltage=vrms,power=np.array([input_power,source_heat,parasitic,reference_power,sample_power]),sample_admittance=ys)
|
| 176 |
+
def _measurement_error(self,circuit):
|
| 177 |
+
if abs(circuit['current'])>CONVERTER_LIMIT_A*(1+1e-12):return 'CURRENT_CONVERTER_OVERFLOW'
|
| 178 |
+
if self.mode=='sample' and self.sample and abs(self._temperature(1)-self.sample['reference_k'])>self.sample['temperature_tolerance_k']:return 'REFERENCE_TEMPERATURE_RANGE'
|
| 179 |
+
return None
|
| 180 |
+
def _observed(self):
|
| 181 |
+
if not self.power or not self.plant or self.phase!='running':return None,None
|
| 182 |
+
circuit=self._circuit()
|
| 183 |
+
if self._measurement_error(circuit):return None,None
|
| 184 |
+
p=self.plant;quant=lambda z,q:complex(round(z.real/q)*q,round(z.imag/q)*q);return pack(quant(self.detector[0],p['voltage_resolution_v'])),pack(quant(self.detector[1],p['current_resolution_a']))
|
| 185 |
+
def read(self,role='evaluator'):
|
| 186 |
+
if role not in ('agent','debug','evaluator'):raise ActionRejected('ACCESS_DENIED')
|
| 187 |
+
voltage,current=self._observed();d={'plant.configured':self.plant is not None,'geometry.configured':self.geometry is not None,'thermal.configured':self.thermal is not None,'sample.present':self.sample is not None,'power.enabled':self.power,'thermal.enabled':self.thermal_enabled,'clamp.moving':self._moving(),'calibration.configured':bool(self.calibration),'clamp.position_m':self.clamp,'clamp.target_m':self.clamp_target,'power.angle_rad':.28 if self.power else 0.,'thermal.target_k':self.target,'thermal.indicated_k':float(round(self._temperature(1)/self.plant['temperature_resolution_k'])*self.plant['temperature_resolution_k']) if self.power and self.thermal else None,'excitation.frequency_hz':self._frequency(),'excitation.source_voltage_rms_v':self.method['source_voltage_rms_v'] if self.phase=='running' and self.power else 0.,'fixture.load_mode':self.mode,'measured.voltage_rms_v':voltage,'measured.current_rms_a':current,'clock.time_s':self.time_s,'acquisition.phase':self.phase,'acquisition.elapsed_s':self.elapsed,'acquisition.expected_duration_s':self.expected_duration,'acquisition.points':len(self.rows),'truth.bath_k':self._temperature(0),'truth.sample_k':self._temperature(1),'truth.sample_mass_kg':self._mass() if self.sample else None,'truth.dc_conductivity_s_m':self.sample['dc_conductivity_s_m'] if self.sample else None}
|
| 188 |
+
return {k:v for k,v in d.items() if role!='agent' or SLOTS[k]['visibility']=='agent'}
|
| 189 |
+
def _propagate(self,ns):
|
| 190 |
+
if not ns:return
|
| 191 |
+
dt=ns/1e9;circuit=self._circuit() if self.power and self.phase=='running' else dict(voltage=0j,current=0j,power=np.zeros(5));self.electrical_energy+=circuit['power']*dt
|
| 192 |
+
if self.plant:
|
| 193 |
+
p=self.plant;gv=p['voltage_gain_magnitude']*complex(math.cos(p['voltage_gain_phase_rad']),math.sin(p['voltage_gain_phase_rad']));gi=p['current_gain_magnitude']*complex(math.cos(p['current_gain_phase_rad']),math.sin(p['current_gain_phase_rad']));target=np.array([circuit['voltage']*gv,circuit['current']*gi]);self.detector=target+(self.detector-target)*math.exp(-dt/p['detector_tau_s'])
|
| 194 |
+
if not self.thermal:return
|
| 195 |
+
t=self.thermal;C=self._capacities();gb=t['sample_bath_conductance_w_k'] if self._closed() else 0.;gs=0. if self._closed() else t['open_sample_ambient_conductance_w_k'];ga=t['bath_ambient_conductance_w_k'];K=t['controller_gain_w_k'] if self.power and self.thermal_enabled else 0.;target=self.target-self.plant['ambient_k'];P=float(circuit['power'][4]);low=min(float(min(self.x[:2])),0.,target);high=max(float(max(self.x[:2])),0.,target)+P*dt/min(C);saturated=K and ((K+ga)*target-K*low>t['heating_limit_w'] or (K+ga)*target-K*high < -t['cooling_limit_w'])
|
| 196 |
+
if saturated:
|
| 197 |
+
def rhs(_time,y):
|
| 198 |
+
b,s=y[:2];raw=(K+ga)*target-K*b;control=min(t['heating_limit_w'],max(-t['cooling_limit_w'],raw));ambient=ga*b+gs*s;return [(control-gb*(b-s)-ga*b)/C[0],(gb*(b-s)-gs*s+P)/C[1],control,ambient]
|
| 199 |
+
sol=solve_ivp(rhs,(0.,dt),self.x,method='Radau',rtol=1e-10,atol=[1e-11,1e-11,1e-10,1e-10])
|
| 200 |
+
if not sol.success:raise RuntimeError('THERMAL_INTEGRATION_FAILED')
|
| 201 |
+
self.x=sol.y[:,-1]
|
| 202 |
+
else:
|
| 203 |
+
A=np.zeros((5,5));A[0,0]=-(gb+ga+K)/C[0];A[0,1]=gb/C[0];A[0,4]=(K+ga)*target/C[0] if K else 0.;A[1,0]=gb/C[1];A[1,1]=-(gb+gs)/C[1];A[1,4]=P/C[1];A[2,0]=-K;A[2,4]=(K+ga)*target if K else 0.;A[3,0]=ga;A[3,1]=gs;self.x=(expm(A*dt)@np.r_[self.x,1.])[:4]
|
| 204 |
+
def _ledger(self):
|
| 205 |
+
generator,source,parasitic,reference,sample=self.electrical_energy;stored=float(self._capacities()@self.x[:2]) if self.thermal else 0.;control,ambient=self.x[2:];return dict(mass_loaded_kg=self.mass_loaded,mass_present_kg=self._mass(),mass_removed_kg=self.mass_removed,mass_error_kg=self.mass_loaded-self._mass()-self.mass_removed,volume_loaded_m3=self.volume_loaded,volume_present_m3=self._volume(),volume_removed_m3=self.volume_removed,volume_error_m3=self.volume_loaded-self._volume()-self.volume_removed,generator_active_input_j=float(generator),source_resistor_heat_j=float(source),fixture_parasitic_heat_j=float(parasitic),reference_load_heat_j=float(reference),sample_dielectric_heat_j=float(sample),electrical_error_j=float(generator-source-parasitic-reference-sample),controller_input_j=float(control),ambient_loss_j=float(ambient),loaded_sensible_j=self.loaded_sensible,removed_sensible_j=self.removed_sensible,thermal_stored_j=stored,thermal_energy_error_j=float(control+sample-ambient+self.loaded_sensible-self.removed_sensible-stored))
|
| 206 |
+
def _result(self):return dict(operation_id=self.operation_id,phase=self.phase,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),template_source=self._operation_source,evidence=self._operation_evidence,error_code=self.error)
|
| 207 |
+
def _finish(self,phase,error=None):
|
| 208 |
+
self.phase=phase;self.error=error
|
| 209 |
+
if self.operation_id:self.records[self.operation_id]=self._result()
|
| 210 |
+
def _record(self):
|
| 211 |
+
frequency=self._frequency();circuit=self._circuit();error=self._measurement_error(circuit);voltage,current=self._observed();raw=None;corrected=None;inferred=None;calibration=self.calibration.get(frequency) if self.mode=='sample' else None
|
| 212 |
+
if not error:
|
| 213 |
+
try:
|
| 214 |
+
if voltage is None or current is None or abs(unpack(current))<1e-30:raise ActionRejected('ANALYSIS_ZERO_SIGNAL')
|
| 215 |
+
raw=unpack(voltage)/unpack(current);corrected=correct_impedance(raw,calibration) if calibration else raw
|
| 216 |
+
if self.mode=='sample':
|
| 217 |
+
inferred=infer_dielectric(frequency,pack(corrected*unpack(current)),current,**self.geometry)
|
| 218 |
+
if not .01<=abs(corrected)<=2e14 or not 1e-15<=inferred['parallel_capacitance_f']<=10.:raise ActionRejected('MEASUREMENT_RANGE')
|
| 219 |
+
except ActionRejected as exc:error=str(exc)
|
| 220 |
+
row=dict(time_s=self.elapsed,host_time_s=self.time_s,frequency_hz=frequency,point_duration_s=(self.time_ns-self._point_start_ns)/1e9,load_mode=self.mode,source_voltage_rms_v=self.method['source_voltage_rms_v'],voltage_rms=voltage,current_rms=current,raw_impedance_ohm=pack(raw) if raw is not None else None,impedance_ohm=pack(corrected) if corrected is not None else None,**{k:inferred[k] if inferred and not error else None for k in ['epsilon_real','epsilon_loss','tan_delta','parallel_capacitance_f','conductivity_real_s_m','conductivity_imag_s_m']},sample_temperature_k=self.read()['thermal.indicated_k'],calibration_applied=calibration is not None,quality='unavailable' if error else 'estimated',error_code=error);self.rows.append(row)
|
| 221 |
+
if error:self._finish('failed',error);return
|
| 222 |
+
self._point_index+=1
|
| 223 |
+
if self._point_index>=len(self.method['frequencies_hz']):self._finish('succeeded')
|
| 224 |
+
else:self._point_start_ns=self.time_ns;self._point_end_ns=self.time_ns+self._point_duration_ns(self._frequency())
|
| 225 |
+
def invoke(self,capability,**a):
|
| 226 |
+
if capability not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 227 |
+
validate(CAPS[capability]['input_schema'],a)
|
| 228 |
+
if capability in UNSUPPORTED:raise ActionRejected('UNSUPPORTED')
|
| 229 |
+
if capability=='analysis.dielectric':return infer_dielectric(**a)
|
| 230 |
+
if capability=='calibration.solve':return solve_osl(**a)
|
| 231 |
+
if capability=='acquisition.result':return self._result()
|
| 232 |
+
if capability=='provenance.read':return dict(reference_id=self._reference_id,template_source=self._source,evidence=self._evidence)
|
| 233 |
+
if capability=='ledger.read':return self._ledger()
|
| 234 |
+
if capability=='sim.step':self.step(a['dt_s']);return {'time_s':self.time_s}
|
| 235 |
+
if self.phase=='running' and capability not in ('acquisition.stop','power.set'):raise ActionRejected('BUSY')
|
| 236 |
+
if capability=='plant.configure':
|
| 237 |
+
if self.plant or not a['accept_engineering']:raise ActionRejected('PRECONDITION_FAILED')
|
| 238 |
+
self.plant=copy.deepcopy(a);self.target=a['ambient_k'];out={'configured':True}
|
| 239 |
+
elif capability=='geometry.configure':
|
| 240 |
+
if self.sample:raise ActionRejected('PRECONDITION_FAILED')
|
| 241 |
+
self.geometry=copy.deepcopy(a);out={'configured':True}
|
| 242 |
+
elif capability=='thermal.configure':
|
| 243 |
+
if not self.plant or self.thermal or not a['accept_external_engineering_system'] or not a['minimum_temperature_k']<=self.plant['ambient_k']<=a['maximum_temperature_k'] or a['minimum_temperature_k']>=a['maximum_temperature_k']:raise ActionRejected('PRECONDITION_FAILED')
|
| 244 |
+
self.thermal=copy.deepcopy(a);out={'configured':True}
|
| 245 |
+
elif capability=='sample.load':
|
| 246 |
+
if not self.plant or not self.geometry or not self.thermal or self.sample or self._moving() or self.clamp<.024 or not a['accept_spectrum_assumption'] or not a['accept_thermal_assumption']:raise ActionRejected('PRECONDITION_FAILED')
|
| 247 |
+
record=library().get(a['reference_id'])
|
| 248 |
+
if record is None:raise ActionRejected('UNKNOWN_REFERENCE')
|
| 249 |
+
epsilon=record.get('relative_permittivity_static');temperature=record.get('reference_temperature_K')
|
| 250 |
+
if not isinstance(epsilon,(int,float)) or not math.isfinite(epsilon) or epsilon<a['epsilon_infinity']:raise ActionRejected('REFERENCE_DATA')
|
| 251 |
+
if not isinstance(temperature,(int,float)) or not math.isfinite(temperature):raise ActionRejected('REFERENCE_TEMPERATURE_UNKNOWN')
|
| 252 |
+
if abs(a['initial_temperature_k']-temperature)>a['temperature_tolerance_k']:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 253 |
+
if not self.thermal['minimum_temperature_k']<=a['initial_temperature_k']<=self.thermal['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE')
|
| 254 |
+
old=self._capacities()[1];self.sample=copy.deepcopy(a);self.sample.update(epsilon_static=epsilon,reference_k=temperature);self.record=copy.deepcopy(record);new=self._capacities()[1];delta=a['initial_temperature_k']-self.plant['ambient_k'];self.x[1]=(old*self.x[1]+(new-old)*delta)/new;self.loaded_sensible+=(new-old)*delta;self.mass_loaded+=self._mass();self.volume_loaded+=self._volume();self._reference_id=a['reference_id'];self._source=json.dumps(record['source'],ensure_ascii=False,sort_keys=True);self._evidence='real_static_permittivity_reference; synthetic_Debye_spectrum_and_dc_conductivity_explicit_host_assumptions';out={'loaded':True}
|
| 255 |
+
elif capability=='sample.remove':
|
| 256 |
+
if not self.sample or self._moving() or self.clamp<.024:raise ActionRejected('PRECONDITION_FAILED')
|
| 257 |
+
self.mass_removed+=self._mass();self.volume_removed+=self._volume();self.removed_sensible+=self._mass()*self.sample['specific_heat_capacity_j_kg_k']*float(self.x[1]);self.sample=self.record=None;self._source=self._reference_id=None;self._evidence='no_sample';out={'loaded':False}
|
| 258 |
+
elif capability=='sample.set_clamp':
|
| 259 |
+
if not self.plant:raise ActionRejected('PRECONDITION_FAILED')
|
| 260 |
+
self.clamp_target=0. if a['closed'] else .025;self._clamp_start=self.clamp;self._clamp_start_ns=self.time_ns;self._clamp_arrival_ns=self.time_ns+round(abs(self.clamp_target-self.clamp)/self.plant['clamp_speed_m_s']*1e9);out={'target_m':self.clamp_target}
|
| 261 |
+
elif capability=='power.set':
|
| 262 |
+
if not a['enabled'] and self.phase=='running':self._finish('cancelled','POWER_OFF')
|
| 263 |
+
self.power=a['enabled']
|
| 264 |
+
if not self.power:self.thermal_enabled=False
|
| 265 |
+
out={'enabled':self.power}
|
| 266 |
+
elif capability=='thermal.set_temperature':
|
| 267 |
+
if not self.power or not self.thermal or not self.thermal['minimum_temperature_k']<=a['temperature_k']<=self.thermal['maximum_temperature_k']:raise ActionRejected('THERMAL_ENVELOPE')
|
| 268 |
+
self.target=a['temperature_k'];self.thermal_enabled=True;out={'target_k':self.target}
|
| 269 |
+
elif capability=='thermal.disable':self.thermal_enabled=False;out={'enabled':False}
|
| 270 |
+
elif capability=='fixture.select_load':self.mode=a['mode'];self.load_resistance=a['load_resistance_ohm'];out={'mode':self.mode}
|
| 271 |
+
elif capability=='method.configure':
|
| 272 |
+
frequencies=a['frequencies_hz']
|
| 273 |
+
if len(set(frequencies))!=len(frequencies) or any(f>=1e7 and a['source_voltage_rms_v']>1. for f in frequencies):raise ActionRejected('FREQUENCY_VOLTAGE_ENVELOPE')
|
| 274 |
+
self.method=copy.deepcopy(a);out={'configured':True}
|
| 275 |
+
elif capability=='calibration.apply':
|
| 276 |
+
if len({x['frequency_hz'] for x in a['records']})!=len(a['records']) or any(abs(unpack(x['a'])-unpack(x['b_ohm'])*unpack(x['c_s']))<1e-20 for x in a['records']):raise ActionRejected('CALIBRATION_DEGENERATE')
|
| 277 |
+
self.calibration={x['frequency_hz']:copy.deepcopy(x) for x in a['records']};out={'configured':True}
|
| 278 |
+
elif capability=='calibration.clear':self.calibration={};out={'configured':False}
|
| 279 |
+
elif capability=='acquisition.start':
|
| 280 |
+
if not self.power or not self.plant or not self.geometry or not self.thermal or not self._closed() or self._moving() or self.mode=='sample' and not self.sample:raise ActionRejected('PRECONDITION_FAILED')
|
| 281 |
+
if self.method['source_voltage_rms_v']==0:raise ActionRejected('ZERO_EXCITATION')
|
| 282 |
+
if self.mode=='sample' and abs(self._temperature(1)-self.sample['reference_k'])>self.sample['temperature_tolerance_k']:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 283 |
+
if self.mode=='sample' and self.method['require_calibration'] and any(f not in self.calibration for f in self.method['frequencies_hz']):raise ActionRejected('CALIBRATION_MISSING')
|
| 284 |
+
self._counter+=1;self.operation_id=f'{self.instance_id}:acquisition:{self._counter}';self._operation_source=self._source if self.mode=='sample' else None;self._operation_evidence=self._evidence if self.mode=='sample' else 'actual_simulated_external_reference_observation';self.phase='running';self.elapsed=0.;self.rows=[];self.error=None;self._start_ns=self.time_ns;self._point_index=0;self._point_start_ns=self.time_ns;self._point_end_ns=self.time_ns+self._point_duration_ns(self._frequency());self.expected_duration=sum(self._point_duration_ns(f) for f in self.method['frequencies_hz'])/1e9;out={'operation_id':self.operation_id,'expected_duration_s':self.expected_duration}
|
| 285 |
+
elif capability=='acquisition.stop':
|
| 286 |
+
if self.phase!='running':raise ActionRejected('NOT_RUNNING')
|
| 287 |
+
self._finish('cancelled','USER_CANCEL');out={'phase':self.phase,'elapsed_s':self.elapsed}
|
| 288 |
+
else:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 289 |
+
self.revision+=1;return copy.deepcopy(out)
|
| 290 |
+
def step(self,dt_s):
|
| 291 |
+
validate(number('s',0,86400),dt_s);total=math.fsum((self._clock_remainder_ns,dt_s*1e9));ns=round(total);self._clock_remainder_ns=total-ns
|
| 292 |
+
if not ns:return
|
| 293 |
+
end=self.time_ns+ns
|
| 294 |
+
while self.time_ns<end:
|
| 295 |
+
boundary=end
|
| 296 |
+
if self._moving():boundary=min(boundary,self._clamp_arrival_ns)
|
| 297 |
+
if self.phase=='running':boundary=min(boundary,self._point_end_ns)
|
| 298 |
+
self._propagate(boundary-self.time_ns);self.time_ns=boundary
|
| 299 |
+
if self.plant:self.clamp=self.clamp_target if self.time_ns>=self._clamp_arrival_ns else self._clamp_start+math.copysign(self.plant['clamp_speed_m_s']*(self.time_ns-self._clamp_start_ns)/1e9,self.clamp_target-self._clamp_start)
|
| 300 |
+
if self.phase=='running':
|
| 301 |
+
self.elapsed=(self.time_ns-self._start_ns)/1e9
|
| 302 |
+
if self.time_ns==self._point_end_ns:self._record()
|
| 303 |
+
self.revision+=1
|
| 304 |
+
|
| 305 |
+
class NovocontrolAlphatSession:
|
| 306 |
+
def __init__(self, host, principal_id): self._host = host; self._principal = principal_id
|
| 307 |
+
@property
|
| 308 |
+
def _role(self): return self._host._principals[self._principal]
|
| 309 |
+
def _target(self, instance_id):
|
| 310 |
+
if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 311 |
+
def describe(self, *, instance_id=None, asset_type_id=None):
|
| 312 |
+
if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT')
|
| 313 |
+
if instance_id is not None: self._target(instance_id)
|
| 314 |
+
if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 315 |
+
meta = export_novocontrol_alphat_contract_metadata()
|
| 316 |
+
return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'})
|
| 317 |
+
def read(self, *, instance_id, state_ids=None):
|
| 318 |
+
self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids
|
| 319 |
+
if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT')
|
| 320 |
+
if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED')
|
| 321 |
+
return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids})
|
| 322 |
+
def _filter_result(self, result):
|
| 323 |
+
result = copy.deepcopy(result)
|
| 324 |
+
# A bridge may dispatch agent-visible capabilities through a privileged
|
| 325 |
+
# session. Public acquisition payloads therefore use the SAME redaction
|
| 326 |
+
# for every role. Full provenance has its own evaluator-only capability.
|
| 327 |
+
if 'rows' in result and 'template_source' in result:
|
| 328 |
+
result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None
|
| 329 |
+
result['evidence'] = 'observed_complex_VI_with_explicit_synthetic_spectrum_and_fixture_assumptions; selected template details require evaluator provenance.read' if result['operation_id'] is not None else 'no_measurement'
|
| 330 |
+
return result
|
| 331 |
+
def invoke(self, *, instance_id, capability_id, arguments, request_id):
|
| 332 |
+
h=self._host
|
| 333 |
+
try:
|
| 334 |
+
self._target(instance_id)
|
| 335 |
+
if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 336 |
+
if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED')
|
| 337 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 338 |
+
validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False)
|
| 339 |
+
if key in h._requests:
|
| 340 |
+
old,response=h._requests[key]
|
| 341 |
+
if old!=digest: raise ActionRejected('REQUEST_CONFLICT')
|
| 342 |
+
return copy.deepcopy(response)
|
| 343 |
+
if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 344 |
+
if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 345 |
+
result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id=='acquisition.start' else None
|
| 346 |
+
if operation: h._owners[operation]=self._principal
|
| 347 |
+
response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None)
|
| 348 |
+
h._requests[key]=(digest,copy.deepcopy(response)); return response
|
| 349 |
+
except ActionRejected as exc:
|
| 350 |
+
return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none'))
|
| 351 |
+
def write(self, *, instance_id, state_id, value, request_id):
|
| 352 |
+
self._target(instance_id); entry=SLOTS.get(state_id)
|
| 353 |
+
if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED')
|
| 354 |
+
capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id)
|
| 355 |
+
def poll(self, operation_id):
|
| 356 |
+
h=self._host
|
| 357 |
+
if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 358 |
+
result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id)
|
| 359 |
+
if result is None: raise ActionRejected('UNKNOWN_OPERATION')
|
| 360 |
+
return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result))
|
| 361 |
+
def cancel(self, operation_id, request_id):
|
| 362 |
+
self.poll(operation_id); h=self._host
|
| 363 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 364 |
+
key=(self._principal,request_id)
|
| 365 |
+
if key in h._cancel_operations:
|
| 366 |
+
if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT')
|
| 367 |
+
return copy.deepcopy(h._requests[key][1])
|
| 368 |
+
if key in h._requests: raise ActionRejected('REQUEST_CONFLICT')
|
| 369 |
+
if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING')
|
| 370 |
+
result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id)
|
| 371 |
+
if result['status']=='succeeded': h._cancel_operations[key]=operation_id
|
| 372 |
+
return result
|
| 373 |
+
|
| 374 |
+
EFFECTS={
|
| 375 |
+
'plant.configure':['plant.configured','thermal.target_k'],
|
| 376 |
+
'geometry.configure':['geometry.configured'],
|
| 377 |
+
'thermal.configure':['thermal.configured','truth.bath_k','truth.sample_k','thermal.indicated_k'],
|
| 378 |
+
'sample.load':['sample.present','truth.sample_mass_kg','truth.dc_conductivity_s_m','truth.sample_k','thermal.indicated_k'],
|
| 379 |
+
'sample.remove':['sample.present','truth.sample_mass_kg','truth.dc_conductivity_s_m'],
|
| 380 |
+
'sample.set_clamp':['clamp.target_m','clamp.moving'],
|
| 381 |
+
'power.set':['power.enabled','power.angle_rad','thermal.enabled','thermal.indicated_k','excitation.frequency_hz','excitation.source_voltage_rms_v','measured.voltage_rms_v','measured.current_rms_a','acquisition.phase'],
|
| 382 |
+
'thermal.set_temperature':['thermal.target_k','thermal.enabled'],'thermal.disable':['thermal.enabled'],
|
| 383 |
+
'fixture.select_load':['fixture.load_mode'],
|
| 384 |
+
'calibration.apply':['calibration.configured'],'calibration.clear':['calibration.configured'],
|
| 385 |
+
'acquisition.start':['acquisition.phase','acquisition.elapsed_s','acquisition.expected_duration_s','acquisition.points','excitation.frequency_hz','excitation.source_voltage_rms_v','measured.voltage_rms_v','measured.current_rms_a'],
|
| 386 |
+
'acquisition.stop':['acquisition.phase','excitation.frequency_hz','excitation.source_voltage_rms_v','measured.voltage_rms_v','measured.current_rms_a'],
|
| 387 |
+
'sim.step':list(SLOTS)}
|
| 388 |
+
for k,v in EFFECTS.items():CAPS[k]['effects']=v
|
| 389 |
+
ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'POWER_OFF','USER_CANCEL','CURRENT_CONVERTER_OVERFLOW','REFERENCE_TEMPERATURE_RANGE'})
|
| 390 |
+
|
| 391 |
+
def export_novocontrol_alphat_contract_metadata():
|
| 392 |
+
slots={};caps={}
|
| 393 |
+
for k,v in SLOTS.items():slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; RMS phasors with exp(+j*omega*t),epsilon*=epsilon_real-j*epsilon_loss,Y=j*omega*C0*epsilon. Alpha-T RevC,current converter40mA;50ohmsource.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'NovocontrolAlphatSession.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Host clock only; displayed phasor is an explicitly assumed first-order demodulator endpoint estimate after actual frequency dwell, not an instantaneous AC waveform sample.'),source_ids=['simulation_assumption'])
|
| 394 |
+
limits=[
|
| 395 |
+
'Alpha-T RevC含电流转换接口;范围3µHz至40MHz。10MHz以下0至3Vrms,原表below/above边界未明,恰好10MHz本模型保守限制1Vrms并与高频同处理。源输出阻抗固定50Ω。',
|
| 396 |
+
'未选OptionF时每点等待settling+max(cycles/f,1/10.5)s;3µHz一周期至少333333.333s,不能瞬时出谱。600点/s、OptionB直流偏置和高压选件unsupported。',
|
| 397 |
+
'电流转换器物理电流超过40mA即观测不可用、完成当前点时采集失败切断源;不把测量量程伪装成源电流限流。样品端RMS电压由50Ω分压与寄生网络决定,并非始终等于源幅度。',
|
| 398 |
+
'模板提供真实文献编纂静态介电常数/温度,curves为空。Debye高频极限、松弛τ、σdc均由宿主显式假设,生成曲线为synthetic,不冒充67种真实宽频实测谱。',
|
| 399 |
+
'默认water静态ε80.1@293.2K;ε∞4.9、τ1e-11s、σdc5e-6S/m、ρ1000kg/m³和Cp4180J/kg/K仅工程水近似,库内未知字段仍null。改变τ用于教学弛豫峰不能写成物质实验结果。',
|
| 400 |
+
'Debye关系epsilon*=epsilon_inf+(epsilon_s-epsilon_inf)/(1+j*omega*tau)-j*sigma_dc/(omega*eps0);C0=eps0*A/d。复电导定义sigma*=j*omega*eps0*epsilon,实部包含介电损耗与直流导电;不能与宿主sigma_dc混称。',
|
| 401 |
+
'工程平板D20mm厚1mm的绝缘液池/固体垫片实例,电极下方为generator高电位、上方为current-converter虚地。geometry.configure影响过程几何,静态3D示例不自动缩放。装样后禁止改几何以免质量体积生灭。',
|
| 402 |
+
'本批工程夹具用串联R/L、并联C/G寄生网络;已知BDS1200上限10MHz、ZGS只适配Alpha-A,不把两者拼成Alpha-T原厂40MHz夹具。Analyzer BNC端范围不能自动等同样品端精度。',
|
| 403 |
+
'外部open/short/已知纯电阻load经实际相同网络和两个复增益通道测量,solve由三个外部观测解Möbius逆,再apply逐频点记录;不读隐藏寄生/增益,不跨未校准频率插值。fixture.select_load只是宿主接线代理,不声称自动校准机械。',
|
| 404 |
+
'所有电压电流为RMS复相量,P=Re(V*conj(I))不含1/2。样品耗散进入样品热节点,50Ω源/寄生/参考负载耗散导出外部环境,分别留账。',
|
| 405 |
+
'采用稳态周期平均有功功率及工程一阶解调估计,未求解交流逐周期波形、电磁起停暂态或电场/极化储能。能量验证限于周期平均有功与热账,不宣称瞬态总电磁能量认证。',
|
| 406 |
+
'明确选择宿主外部工程有限热容边界;温区、功率、热导由thermal.configure输入,未指定Novotherm/Quatro等原厂温控系统。温度超静态参考容差时测量失败,但现有显热仍继续交换。',
|
| 407 |
+
'样品温度在宿主参考容差内时epsilon_s/epsilon_inf/tau/sigma_dc作为常系数近似,不宣称温度谱插值。样品热节点包含固定0.1J/K夹具/电极工程热容,非OEM参数。',
|
| 408 |
+
'整片/定容样品几何确定体积,密度/Cp为宿主显式假设,载入/移出显热完整记账。开夹时样品脱离热台转与环境换热,未求解深度接触、压力或溶剂挥发。',
|
| 409 |
+
'厂家误差强依赖频率/阻抗/校准和环境,不能把条件精度套全域;这里的增益/相位/分辨率/τ是输入假设,真实噪声和准确度认证not_run。',
|
| 410 |
+
'主机有蓝色双行字符LCD,几何只保留静态外观/身份文字;动态LCD未实现,READOUTS为空不等于没有显示屏。',
|
| 411 |
+
'所有session公开result/poll统一脱敏,包括内部evaluator桥接;选中静态参考来源只在evaluator provenance.read。共享Python与磁盘不等于OS级真值隔离。',
|
| 412 |
+
'真实硬件、机器人装样、OEM夹具/温控校准、直流偏置、高压、安全联锁与电磁暂态not_run。']
|
| 413 |
+
for k,v in CAPS.items():
|
| 414 |
+
un=k in UNSUPPORTED;async_=k=='acquisition.start';caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']}
|
| 415 |
+
caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.novocontrol_alphat.NovocontrolAlphatSession.invoke',invocation=f'session.invoke(instance_id="alphat_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='明确夹具/热边界、夹持、静态参考温域、频率/电压/校准网格由运行入口原子检查。',state_ids=['power.enabled','sample.present','clamp.position_m','thermal.configured','acquisition.phase'],enforced_by='runtime',check='NovocontrolAlphatRuntime.invoke guards before commit')],state_effects=[dict(state_id=s,timing='immediate',description_zh='命令实际即时状态变化') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='只输出可映射状态,实际模型求值由独立场景报告登记。',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='每个频点累计指定真实周期和通信时间后采样,所有频点完成或实际范围错误终止' if async_ else '原子命令;电热/运动/频扫驻留仅宿主step推进',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','parallel_plate_fixture','source','current_converter'],partial_failure_zh='取消/断电切断源并冻结已完成频点,未完成点不输出;已积耗散热和显热不回滚。范围错误完成当前频点时记不可用并停止。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('POWER_OFF','USER_CANCEL','CURRENT_CONVERTER_OVERFLOW','MEASUREMENT_RANGE') else 'none') for e in ERRORS],verification=[],limitations=limits,source_ids=['manufacturer_primary','simulation_assumption','template_library'])
|
| 416 |
+
if k in ('thermal.set_temperature','thermal.disable','sample.set_clamp','acquisition.start','power.set'):
|
| 417 |
+
caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='宿主推进热过程、夹持或实际频扫') for s in SLOTS if s not in v['effects'] and s not in ('plant.configured','geometry.configured','thermal.configured','sample.present','power.enabled')]
|
| 418 |
+
mechanism=dict(component_ids=['controller','current_converter','electrode_upper','electrode_lower','sample_disc','thermal_port'],state_ids=list(slots),meaning_zh='带50Ω源和夹具寄生的复介电相量网络,有限扫频时间、外部OSL校准、有限热容与有功热守恒',implementation='lumped',equations=[
|
| 419 |
+
'epsilon*=epsilon_inf+(epsilon_s-epsilon_inf)/(1+j*omega*tau)-j*sigma_dc/(omega*eps0); Ysample=j*omega*C0*epsilon*,C0=eps0*pi*(D/2)^2/d. Static epsilon_s is source data; all dynamic parameters are explicit assumptions.',
|
| 420 |
+
'Yparallel=Ysample+Gparasitic+j*omega*Cparasitic; Zfixture=Rseries+j*omega*Lseries+1/Yparallel; I=Vs/(50ohm+Zfixture),Vfixture=I*Zfixture. External open/short/load changes the sample admittance branch only.',
|
| 421 |
+
'Measured RMS channels follow explicit complex gains and first-order demodulator response, with independently declared engineering quantization. Physical converter current>40mA returns unavailable, not clipped current.',
|
| 422 |
+
'OSL inverse Zcorrected=(a*Zmeasured+b)/(c*Zmeasured+1), c=-1/Zopen, a=Rload*(1-Zload/Zopen)/(Zload-Zshort),b=-a*Zshort; coefficients are computed solely from supplied external observed standards.',
|
| 423 |
+
'Z=V/I; epsilon=1/(Z*j*omega*C0); tan_delta=epsilon_loss/epsilon_real; sigma_real=omega*eps0*epsilon_loss and sigma_imag=omega*eps0*epsilon_real. Sample observation limits enforce C1e-15..10F and |Z|.01..2e14ohm.',
|
| 424 |
+
'Each point dwell=settling+max(cycles/f,1/10.5)s, rounded upward to nanosecond. A fractional-nanosecond residual retains normal60Hz host clock accuracy. Filter and circuit clocks never advance on read/invoke configuration.',
|
| 425 |
+
'Pgenerator=Re(Vs*conj(I)); Psource=|I|²*50; Pseries=|I|²*Rseries; Pshunt=|Vparallel|²*Gparasitic; Psample=|Vparallel|²*Re(Ysample). Pgenerator=Psource+Pseries+Pshunt+Psample+Preference with RMS convention.',
|
| 426 |
+
'Cb*dTb=Pcontroller-Gb*(Tb-Ts)-Ga*(Tb-Ta); Cs*dTs=Gb*(Tb-Ts)-Gopen*(Ts-Ta)+Psample. Closed fixture:Gb>0,Gopen=0;open:Gb=0,Gopen>0. External controller has explicit heating/cooling limits.',
|
| 427 |
+
'Matrix exponential propagates linear thermal/energy states; Radau solves the same equations if power saturation is possible. Complex demodulator state has exact exp(-dt/tau) propagation. Sample loading capacity-weights incoming sensible heat; removing exports actual sensible heat.',
|
| 428 |
+
'Electrical ledger is steady cycle-averaged active energy, excluding unmodeled turn-on/off electromagnetic stored energy and transients.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=limits)
|
| 429 |
+
spec=importlib.util.spec_from_file_location('_alpha_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'dielectric_spectroscopy':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'geometry.configure':(GEOMETRY,GEOMETRY_EXAMPLE),'thermal.configure':(THERMAL,THERMAL_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE)})
|
| 430 |
+
for key,value in SLOTS.items():slots[key]['meaning_zh']=value['meaning']
|
| 431 |
+
return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'dielectric_spectroscopy':mechanism})
|
scripts/asset_runtime/shimadzu_ags10knxd.py
ADDED
|
@@ -0,0 +1,494 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""AGS-10kNXD / high-precision10kNcell / real5kNSCG / TRAPEZIUM X.
|
| 2 |
+
One-dimensional tensile elastoplastic proxy with separate frame compliance,
|
| 3 |
+
clip-extensometer observations, fixed-rate sampling/control and irreversible
|
| 4 |
+
plastic/fracture energy. No universal-test-mode or OEM accuracy certification.
|
| 5 |
+
"""
|
| 6 |
+
from __future__ import annotations
|
| 7 |
+
import copy,importlib.util,json,math
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
import numpy as np
|
| 10 |
+
PROTOCOL_VERSION='1.0.0';SLUG='shimadzu_ags10knxd';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-144'
|
| 11 |
+
ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'mechanical_library.json'
|
| 12 |
+
LOAD_CELL_MAX_N=10000.;FIXTURE_MAX_N=5000.;MIN_SPEED_M_S=.001e-3/60;MAX_SPEED_M_S=1000e-3/60;POSITION_RESOLUTION_M=1e-6;CONTROL_PERIOD_NS=10_000_000
|
| 13 |
+
class ActionRejected(ValueError):pass
|
| 14 |
+
|
| 15 |
+
def number(unit='1',lo=None,hi=None):
|
| 16 |
+
s={'type':'number','x-unit':unit}
|
| 17 |
+
if lo is not None:s['minimum']=lo
|
| 18 |
+
if hi is not None:s['maximum']=hi
|
| 19 |
+
return s
|
| 20 |
+
|
| 21 |
+
def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False)
|
| 22 |
+
def nullable(s):return {'anyOf':[s,{'type':'null'}]}
|
| 23 |
+
def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum)
|
| 24 |
+
def enum(items):return {'type':'string','enum':items}
|
| 25 |
+
BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed'])
|
| 26 |
+
|
| 27 |
+
def validate(s,v):
|
| 28 |
+
if 'anyOf' in s:
|
| 29 |
+
for o in s['anyOf']:
|
| 30 |
+
try:validate(o,v);return
|
| 31 |
+
except ActionRejected:pass
|
| 32 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 33 |
+
k=s.get('type')
|
| 34 |
+
if k in ('number','integer'):
|
| 35 |
+
if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 36 |
+
elif k=='object':
|
| 37 |
+
if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT')
|
| 38 |
+
for key,value in v.items():validate(s['properties'][key],value)
|
| 39 |
+
elif k=='array':
|
| 40 |
+
if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 41 |
+
for x in v:validate(s['items'],x)
|
| 42 |
+
elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT')
|
| 43 |
+
elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT')
|
| 44 |
+
elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT')
|
| 45 |
+
if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT')
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def library():return {x['id']:x for x in json.loads(LIBRARY_PATH.read_text())['templates']}
|
| 49 |
+
def quant(x,res):return float(round(x/res)*res)
|
| 50 |
+
PLANT_EXAMPLE=dict(ambient_k=292.65,frame_stiffness_n_m=1e8,force_gain=1.002,force_offset_n=.02,force_response_tau_s=.002,force_resolution_n=.01,extensometer_gain=1.,extensometer_offset_m=0.,extensometer_resolution_m=1e-7,local_thermal_capacity_j_k=.01,sample_conductance_w_k=.1,plastic_heat_fraction=.9,fracture_heat_fraction=.5,grip_speed_m_s=.01,force_control_gain_m_per_n_s=5e-7,strain_control_gain_m_s=.01,accept_engineering=True)
|
| 51 |
+
PLANT=obj(dict(ambient_k=number('K',278.15,313.15),frame_stiffness_n_m=number('N/m',1e7,1e12),force_gain=number('1',.01,100),force_offset_n=number('N',-100,100),force_response_tau_s=number('s',1e-6,10),force_resolution_n=number('N',1e-9,100),extensometer_gain=number('1',.01,100),extensometer_offset_m=number('m',-.001,.001),extensometer_resolution_m=number('m',1e-12,.001),local_thermal_capacity_j_k=number('J/K',1e-6,1e5),sample_conductance_w_k=number('W/K',1e-9,1e5),plastic_heat_fraction=number('1',0,1),fracture_heat_fraction=number('1',0,1),grip_speed_m_s=number('m/s',1e-6,.1),force_control_gain_m_per_n_s=number('m/(N*s)',1e-12,1),strain_control_gain_m_s=number('m/s',1e-9,1),accept_engineering=BOOL))
|
| 52 |
+
FIXTURE_EXAMPLE=dict(rated_force_n=5000.,software_trapezium_x=True,extensometer_enabled=True,extensometer_gauge_m=.025,accept_engineering_extensometer=True)
|
| 53 |
+
FIXTURE=obj(dict(rated_force_n={'type':'number','const':5000.,'enum':[5000.],'x-unit':'N'},software_trapezium_x=BOOL,extensometer_enabled=BOOL,extensometer_gauge_m=number('m',.001,.25),accept_engineering_extensometer=BOOL))
|
| 54 |
+
SAMPLE_EXAMPLE=dict(reference_id='epfl_s355_j2m_hem320_web',gauge_length_m=.025,initial_area_m2=2e-6,volume_m3=1.1e-7,density_kg_m3=7850.,specific_heat_capacity_j_kg_k=470.,initial_temperature_k=292.65,temperature_tolerance_k=10.,host_elastic_modulus_pa=None,host_yield_strength_pa=None,hardening_modulus_pa=1e9,engineering_strain_at_break=.05,accept_bilinear_geometry_temperature_fracture_assumptions=True)
|
| 55 |
+
SAMPLE=obj(dict(reference_id=TEXT,gauge_length_m=number('m',.001,.2),initial_area_m2=number('m^2',1e-10,1e-3),volume_m3=number('m^3',1e-12,.01),density_kg_m3=number('kg/m^3',1,5e4),specific_heat_capacity_j_kg_k=number('J/(kg*K)',1,1e5),initial_temperature_k=number('K',200,500),temperature_tolerance_k=number('K',0,100),host_elastic_modulus_pa=nullable(number('Pa',1e3,1e13)),host_yield_strength_pa=nullable(number('Pa',1,1e11)),hardening_modulus_pa=number('Pa',0,1e12),engineering_strain_at_break=number('1',1e-6,.5),accept_bilinear_geometry_temperature_fracture_assumptions=BOOL))
|
| 56 |
+
METHOD_EXAMPLE=dict(mode='speed',speed_m_s=.0005,target_crosshead_m=.003,target_force_n=400.,target_strain=.01,sample_rate_hz=1000,duration_s=10.,force_stop_n=5000.,stop_on_break=True)
|
| 57 |
+
METHOD=obj(dict(mode=enum(['speed','force','strain']),speed_m_s=number('m/s',MIN_SPEED_M_S,MAX_SPEED_M_S),target_crosshead_m=number('m',0,.3),target_force_n=number('N',0,10000),target_strain=number('1',0,.5),sample_rate_hz={'type':'integer','enum':[1,10,50,100,200,500,1000],'x-unit':'Hz'},duration_s=number('s',.001,3600),force_stop_n=number('N',1,10000),stop_on_break=BOOL))
|
| 58 |
+
ROW=obj(dict(point_index={'type':'integer','x-unit':'1'},time_s=number('s'),kind=enum(['sample','fracture_pre','fracture_post']),force_n=nullable(number('N')),crosshead_m=number('m'),extensometer_extension_m=nullable(number('m')),broken=BOOL,quality=enum(['estimated','below_documented_accuracy_range','overload','temperature_invalid'])))
|
| 59 |
+
ANALYSIS=obj(dict(rows=array(ROW,3),area_prior_m2=nullable(number('m^2',1e-12,1)),gauge_prior_m=nullable(number('m',1e-9,1)),frame_compliance_prior_m_n=nullable(number('m/N',0,1)),elastic_fit_min_strain=number('1',0,.5),elastic_fit_max_strain=number('1',0,.5)))
|
| 60 |
+
ANALYSIS_OUTPUT=obj(dict(points=array(obj(dict(time_s=number('s'),stress_pa=nullable(number('Pa')),strain=nullable(number('1'))))),elastic_modulus_pa=nullable(number('Pa')),ultimate_observed_stress_pa=nullable(number('Pa')),maximum_observed_force_n=number('N'),observed_break_strain=nullable(number('1')),observed_break_extension_m=nullable(number('m')),evidence=TEXT))
|
| 61 |
+
RESULT=obj(dict(operation_id=nullable(TEXT),phase=PHASE,mode=TEXT,elapsed_s=number('s'),rows=array(ROW),terminal_reason=nullable(TEXT),template_source=nullable(TEXT),evidence=TEXT))
|
| 62 |
+
LEDGER_KEYS=['loaded_mass_kg','removed_mass_kg','mass_kg','mass_residual_kg','loaded_volume_m3','removed_volume_m3','volume_m3','volume_residual_m3','actuator_work_j','plastic_work_j','plastic_heat_j','plastic_defect_stored_j','frame_elastic_j','sample_elastic_j','hardening_stored_j','fracture_surface_j','fracture_heat_j','machine_damping_export_j','sensible_loaded_j','sensible_removed_j','internal_removed_j','sample_thermal_j','heat_export_j','energy_residual_j']
|
| 63 |
+
LEDGER=obj({k:number('kg' if k.endswith('_kg') else 'm^3' if k.endswith('_m3') else 'J') for k in LEDGER_KEYS})
|
| 64 |
+
CAPS={}
|
| 65 |
+
def cap(k,s,o,example,component,meaning,visibility='agent',kind='device_command'):CAPS[k]=dict(input_schema=s,output_schema=o,example_arguments=example,component_ids=[component],function_zh=meaning,visibility=visibility,kind=kind,effects=[])
|
| 66 |
+
for k,s,e,component in [('plant.configure',PLANT,PLANT_EXAMPLE,'crosshead'),('fixture.configure',FIXTURE,FIXTURE_EXAMPLE,'upper_grip'),('method.configure',METHOD,METHOD_EXAMPLE,'controller')]:cap(k,s,obj(dict(configured=BOOL)),e,component,'配置过程/夹具/软件或试验程序;不推进时间','evaluator' if k in ('plant.configure','fixture.configure') else 'agent','configuration')
|
| 67 |
+
cap('sample.load',SAMPLE,obj(dict(present=BOOL)),SAMPLE_EXAMPLE,'specimen_lower','载入真实材料参考与显式均匀拉伸/断裂/热参数','evaluator')
|
| 68 |
+
cap('sample.remove',obj({}),obj(dict(removed_mass_kg=number('kg'),removed_volume_m3=number('m^3'))),{},'specimen_lower','取出全部试样/碎片与塑性库存、当前显热','evaluator')
|
| 69 |
+
cap('power.set',obj(dict(enabled=BOOL)),obj(dict(enabled=BOOL)),dict(enabled=True),'power_switch','启停控制器;停止驱动不清除塑性、断裂或储能')
|
| 70 |
+
cap('grip.set_closed',obj(dict(which=enum(['upper','lower']),closed=BOOL)),obj(dict(target_opening_m=number('m'))),dict(which='upper',closed=True),'upper_jaw','手工SCG夹紧/松开有限运动代理,非夹压力实测','evaluator')
|
| 71 |
+
CAPS['grip.set_closed']['component_ids'].append('lower_jaw')
|
| 72 |
+
cap('crosshead.move_to',obj(dict(position_m=number('m',0,.3),speed_m_s=number('m/s',MIN_SPEED_M_S,MAX_SPEED_M_S))),obj(dict(target_m=number('m'))),dict(position_m=.001,speed_m_s=.0005),'crosshead','设置有限速横梁目标;带样会真实加载,含独立5kN夹具限值')
|
| 73 |
+
cap('emergency.engage',obj({}),obj(dict(engaged=BOOL)),{},'emergency_stop','停止有限驱动并保留机械/热状态,不宣称硬件安全认证')
|
| 74 |
+
cap('emergency.reset',obj({}),obj(dict(engaged=BOOL)),{},'emergency_stop','宿主手动释放急停;不自动继续试验','evaluator')
|
| 75 |
+
cap('force.zero',obj({}),obj(dict(zero_n=number('N'))),{},'load_cell','卸载条件下以当前实际传感器观测置零')
|
| 76 |
+
cap('force.calibrate',obj(dict(reference_force_n=number('N',20,10000))),obj(dict(gain=number('1'))),dict(reference_force_n=100.),'load_cell','由外部已知载荷与实际观测拟合增益,不读取隐藏gain')
|
| 77 |
+
cap('acquisition.start',obj({}),obj(dict(operation_id=TEXT)),{},'controller','按独立采样/控制时钟运行有限拉伸,记录实际力��移与引伸计')
|
| 78 |
+
cap('acquisition.stop',obj({}),obj(dict(phase=PHASE,elapsed_s=number('s'))),{},'controller','停止横梁与采样,保留塑性应变、破断和已产生热量')
|
| 79 |
+
cap('acquisition.result',obj({}),RESULT,{},'controller','冻结完成记录,公开结果所有角色隐藏选中材料身份','agent','query')
|
| 80 |
+
cap('analysis.tensile',ANALYSIS,ANALYSIS_OUTPUT,dict(rows=[],area_prior_m2=2e-6,gauge_prior_m=.025,frame_compliance_prior_m_n=None,elastic_fit_min_strain=.0002,elastic_fit_max_strain=.0015),'controller','由外部观测及独立面积/标距先验分析应力应变与模量','agent','analysis')
|
| 81 |
+
cap('provenance.read',obj({}),obj(dict(current_sample=nullable(TEXT),operation_source=nullable(TEXT))),{},'controller','独立受限当前/记录来源','evaluator','query')
|
| 82 |
+
cap('ledger.read',obj({}),LEDGER,{},'controller','受限质量体积、弹性/塑性/破断与热能账','evaluator','query')
|
| 83 |
+
cap('sim.step',obj(dict(dt_s=number('s',0,86400))),obj(dict(time_s=number('s'))),dict(dt_s=.02),'controller','唯一宿主时钟','evaluator','simulation')
|
| 84 |
+
UNSUPPORTED={'hardware.connect':'没有真实仪器驱动','robot.load':'没有机器人装样','measurement.compression':'本SCG平条一维拉伸子集不实现压缩','measurement.bending':'未配弯曲夹具','measurement.peel':'未配剥离夹具','thermal.set_temperature':'未选温控附件,样品仅被动换热和耗散发热','noise.empirical':'没有实测noise模型,±0.5%不是随机分布','accuracy.certification':'没有OEM/ISO/ASTM计量认证','analysis.strain_without_prior_or_extensometer':'横梁位移不能无条件替代试样应变'}
|
| 85 |
+
for k,v in UNSUPPORTED.items():cap(k,obj({}),obj({}),{},'controller',v)
|
| 86 |
+
SLOTS={}
|
| 87 |
+
def slot(k,s,u,o,c,meaning,vis='agent'):SLOTS[k]=dict(schema=s,unit=u,origin=o,component=c,meaning=meaning,visibility=vis,write=None)
|
| 88 |
+
slot('fixture.extensometer_enabled',BOOL,'1','setpoint','extensometer','已配置工程引伸计硬件存在标志,不随断电隐去')
|
| 89 |
+
slot('clock.time_s',number('s'),'s','derived','controller','统一宿主时间,只由step推进')
|
| 90 |
+
for k in ['plant.configured','fixture.configured','method.configured','sample.present','sample.broken','power.enabled','emergency.engaged']:slot(k,BOOL,'1','derived' if k=='sample.broken' else 'setpoint','controller','配置/存在/不可逆破断/启用状态,不等于全部硬件验证')
|
| 91 |
+
for k in ['crosshead.position_m','crosshead.target_m']:slot(k,number('m'),'m','scene' if 'position' in k else 'setpoint','crosshead','横梁绝对参考增量,+Z拉伸;不是试样单独伸长')
|
| 92 |
+
slot('crosshead.indicated_m',nullable(number('m')),'m','sensor','controller','横梁光编码器显示代理,1µm分辨,不声称±.01mm位置准确度已验证')
|
| 93 |
+
slot('frame.deflection_m',number('m'),'m','scene','compliance_carriage','串联机架/夹具工程顺应位移F/K,upper夹持点位移=横梁−该值')
|
| 94 |
+
for side in ['upper','lower']:
|
| 95 |
+
slot('grip.'+side+'_opening_m',number('m'),'m','scene',side+'_jaw','单侧jaw开口增量,0夹紧/.006m打开;手工有限运动代理')
|
| 96 |
+
slot('grip.target_'+side+'_opening_m',number('m'),'m','setpoint',side+'_jaw','夹具单侧开口目标,只在step运动')
|
| 97 |
+
slot('sample.visual_extension_m',number('m'),'m','scene','specimen_lower','未断样品实体伸长;断后两片残余塑性总长度增量,非连续体有限元网格')
|
| 98 |
+
slot('sample.fracture_gap_m',number('m'),'m','scene','specimen_upper','断后夹点分离扣除残余材料长度的裂口,断前0')
|
| 99 |
+
slot('power.angle_rad',number('rad'),'rad','scene','power_switch','电源开关显示姿态代理')
|
| 100 |
+
slot('emergency.position_m',number('m'),'m','scene','emergency_stop','急停手动闩锁显示位置,0或.004m,不冒安全认证')
|
| 101 |
+
slot('force.indicated_n',nullable(number('N')),'N','sensor','load_cell','含工程传感器响应/量化/校准的拉力读数,20N以下不承诺厂家高精度')
|
| 102 |
+
slot('extensometer.extension_m',nullable(number('m')),'m','sensor','extensometer','独立工程夹持引伸计观测伸长;未配则null,非横梁改名')
|
| 103 |
+
slot('extensometer.strain',nullable(number('1')),'1','derived','extensometer','独立引伸计伸长除其明确配置标距')
|
| 104 |
+
slot('thermal.sample_k',nullable(number('K')),'K','sensor','specimen_lower','试样和宿主局部节点被动温度,85kg整机不代入热容')
|
| 105 |
+
for k in ['calibration.force_gain','calibration.force_zero_n']:slot(k,number('N' if k.endswith('_n') else '1'),'N' if k.endswith('_n') else '1','derived','load_cell','从当前外部观测与已知载荷获得的校正')
|
| 106 |
+
slot('acquisition.phase',PHASE,'1','derived','controller','异步采集状态')
|
| 107 |
+
slot('acquisition.elapsed_s',number('s'),'s','derived','controller','试验实际耗时')
|
| 108 |
+
slot('acquisition.points',{'type':'integer','x-unit':'1'},'1','derived','controller','实际采样与明确破断事件行数')
|
| 109 |
+
for k,u in [('truth.force_n','N'),('truth.plastic_strain','1'),('truth.total_strain','1'),('truth.mass_kg','kg'),('truth.sample_k','K')]:slot(k,number(u),u,'process_truth','specimen_lower','受限一维本构���程真值','evaluator')
|
| 110 |
+
|
| 111 |
+
# Exact constitutive / scene drive coordinates are host-only. Public strain
|
| 112 |
+
# must come from the configured observable extensometer or independent priors.
|
| 113 |
+
for _private_drive in ['frame.deflection_m','sample.visual_extension_m','sample.fracture_gap_m']:
|
| 114 |
+
SLOTS[_private_drive]['visibility']='evaluator'
|
| 115 |
+
|
| 116 |
+
def analyze_tensile(rows,area_prior_m2,gauge_prior_m,frame_compliance_prior_m_n,elastic_fit_min_strain,elastic_fit_max_strain):
|
| 117 |
+
if len(rows)<3 or any(x['force_n'] is None for x in rows) or elastic_fit_max_strain<=elastic_fit_min_strain:raise ActionRejected('INVALID_OBSERVATIONS')
|
| 118 |
+
points=[];fit=[];break_e=None;break_x=None
|
| 119 |
+
for row in rows:
|
| 120 |
+
F=row['force_n'];stress=None if area_prior_m2 is None else F/area_prior_m2;extension=row['extensometer_extension_m']
|
| 121 |
+
if extension is None and frame_compliance_prior_m_n is not None and not row['broken']:extension=row['crosshead_m']-F*frame_compliance_prior_m_n
|
| 122 |
+
strain=None if gauge_prior_m is None or extension is None else extension/gauge_prior_m
|
| 123 |
+
points.append(dict(time_s=row['time_s'],stress_pa=stress,strain=strain))
|
| 124 |
+
if stress is not None and strain is not None and elastic_fit_min_strain<=strain<=elastic_fit_max_strain and not row['broken']:fit.append((strain,stress))
|
| 125 |
+
if row['kind']=='fracture_pre':break_e=strain;break_x=extension
|
| 126 |
+
modulus=None
|
| 127 |
+
if len(fit)>=3 and np.ptp(np.array(fit)[:,0])>1e-12:modulus=float(np.polyfit(np.array(fit)[:,0],np.array(fit)[:,1],1)[0])
|
| 128 |
+
return dict(points=points,elastic_modulus_pa=modulus,ultimate_observed_stress_pa=None if area_prior_m2 is None else max(x['force_n'] for x in rows)/area_prior_m2,maximum_observed_force_n=max(x['force_n'] for x in rows),observed_break_strain=break_e,observed_break_extension_m=break_x,evidence='external_force_and_extensometer_or_explicit_frame_compliance_correction; independent_area_gauge_priors; maximum_observed_stress_is_not_certified_material_UTS; fracture_pre_is_event_observation_not_hidden_breakstrain')
|
| 129 |
+
|
| 130 |
+
class ShimadzuAgs10knxdRuntime:
|
| 131 |
+
def __init__(self,instance_id='ags_01'):
|
| 132 |
+
self.instance_id=instance_id;self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.power=False;self.emergency=False;self.plant=None;self.fixture=None;self.method=None;self.sample=None;self.reference=None;self.source=None
|
| 133 |
+
self.axes={k:dict(position=v,target=v,start=v,start_ns=0,arrival_ns=0) for k,v in [('crosshead',0.),('upper',.006),('lower',.006)]};self.drive_speed=MIN_SPEED_M_S;self.force=0.;self.plastic=0.;self.broken=False;self.defect_stored=0.;self.fracture_surface=0.;self.temperature=292.65;self.sensor_force=0.;self.force_gain=1.;self.force_zero=0.;self.last_stop_reason=None
|
| 134 |
+
self.phase='idle';self.operation_id=None;self.mode='none';self.elapsed=0.;self.rows=[];self.terminal_reason=None;self._counter=0;self._operation_source=None;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._sample_ns=None;self._control_ns=None
|
| 135 |
+
self.book={k:0. for k in ['loaded_mass_kg','removed_mass_kg','loaded_volume_m3','removed_volume_m3','actuator_work_j','plastic_work_j','plastic_heat_j','fracture_heat_j','machine_damping_export_j','sensible_loaded_j','sensible_removed_j','internal_removed_j','heat_export_j']}
|
| 136 |
+
@property
|
| 137 |
+
def time_s(self):return self.time_ns/1e9
|
| 138 |
+
def register_principal(self,name,visibility):
|
| 139 |
+
if not isinstance(name,str) or not name or visibility not in ('agent','evaluator','debug') or name in self._principals:raise ActionRejected('INVALID_ARGUMENT')
|
| 140 |
+
self._principals[name]=visibility
|
| 141 |
+
def session(self,name):
|
| 142 |
+
if name not in self._principals:raise ActionRejected('ACCESS_DENIED')
|
| 143 |
+
return ShimadzuAgs10knxdSession(self,name)
|
| 144 |
+
def _pos(self,k):return self.axes[k]['position']
|
| 145 |
+
def _moving(self,k):return self.time_ns<self.axes[k]['arrival_ns']
|
| 146 |
+
def _target(self,k,value,speed=None):
|
| 147 |
+
v=speed if k=='crosshead' else self.plant['grip_speed_m_s'];a=self.axes[k];a.update(start=a['position'],target=float(value),start_ns=self.time_ns,arrival_ns=self.time_ns+int(math.ceil(abs(value-a['position'])/v*1e9)))
|
| 148 |
+
def _rate(self):
|
| 149 |
+
a=self.axes['crosshead'];return (a['target']-a['start'])/((a['arrival_ns']-a['start_ns'])/1e9) if self._moving('crosshead') else 0.
|
| 150 |
+
def _positions(self):
|
| 151 |
+
for a in self.axes.values():a['position']=a['target'] if self.time_ns>=a['arrival_ns'] else a['start']+(a['target']-a['start'])*(self.time_ns-a['start_ns'])/(a['arrival_ns']-a['start_ns'])
|
| 152 |
+
def _held(self):return self.sample is not None and all(self._pos(k)<1e-12 and not self._moving(k) for k in ['upper','lower'])
|
| 153 |
+
def _mass(self):return self.sample['volume_m3']*self.sample['density_kg_m3'] if self.sample else 0.
|
| 154 |
+
def _capacity(self):return self.plant['local_thermal_capacity_j_k']+(self._mass()*self.sample['specific_heat_capacity_j_kg_k'] if self.sample else 0.)
|
| 155 |
+
def _free_extension(self):return self.sample['gauge_length_m']*self.plastic if self.sample else 0.
|
| 156 |
+
def _strain(self):return self.plastic+(self.force/self.sample['initial_area_m2']/self.E if self.sample and not self.broken else 0.)
|
| 157 |
+
def _compliance(self):return self.sample['gauge_length_m']/(self.sample['initial_area_m2']*self.E)+1/self.plant['frame_stiffness_n_m']
|
| 158 |
+
def _solve(self,x):
|
| 159 |
+
if not self._held() or self.broken:return 0.,self.plastic
|
| 160 |
+
L=self.sample['gauge_length_m'];A=self.sample['initial_area_m2'];H=self.sample['hardening_modulus_pa'];C=self._compliance();trial=max(0.,(x-L*self.plastic)/C);yield_force=A*(self.Y+H*self.plastic)
|
| 161 |
+
plastic=self.plastic if trial<=yield_force else max(self.plastic,(x-C*A*self.Y)/(L+C*A*H));return max(0.,(x-L*plastic)/C),plastic
|
| 162 |
+
def _stored(self,F=None,plastic=None):
|
| 163 |
+
F=self.force if F is None else F;plastic=self.plastic if plastic is None else plastic
|
| 164 |
+
frame=.5*F*F/self.plant['frame_stiffness_n_m'] if self.plant else 0.;elastic=hardening=0.
|
| 165 |
+
if self.sample:
|
| 166 |
+
V=self.sample['initial_area_m2']*self.sample['gauge_length_m'];elastic=.5*(F/self.sample['initial_area_m2'])**2/self.E*V;hardening=.5*self.sample['hardening_modulus_pa']*plastic*plastic*V
|
| 167 |
+
return frame,elastic,hardening
|
| 168 |
+
def _temperature_valid(self):
|
| 169 |
+
if not self.sample:return True
|
| 170 |
+
nominal=self.reference.get('reference_temperature_K');domain=self.reference.get('valid_temperature_range_K');tol=self.sample['temperature_tolerance_k']
|
| 171 |
+
if nominal is not None and abs(self.temperature-nominal)>tol+1e-9:return False
|
| 172 |
+
if domain and domain[1]-domain[0]>1e-9 and not domain[0]-1e-9<=self.temperature<=domain[1]+1e-9:return False
|
| 173 |
+
return abs(self.temperature-self.sample['initial_temperature_k'])<=tol+1e-9
|
| 174 |
+
def _observed_force(self):
|
| 175 |
+
if not self.power:return None
|
| 176 |
+
result=quant((self.sensor_force-self.force_zero)*self.force_gain,self.plant['force_resolution_n'])
|
| 177 |
+
return result if abs(result)<=LOAD_CELL_MAX_N and self._temperature_valid() else None
|
| 178 |
+
def _observed_extension(self):
|
| 179 |
+
if not self.power or not self.fixture or not self.fixture['extensometer_enabled'] or not self.sample or self.broken:return None
|
| 180 |
+
p=self.plant;return quant(self._strain()*self.fixture['extensometer_gauge_m']*p['extensometer_gain']+p['extensometer_offset_m'],p['extensometer_resolution_m'])
|
| 181 |
+
def ledger(self):
|
| 182 |
+
d=copy.deepcopy(self.book);mass=self._mass();volume=self.sample['volume_m3'] if self.sample else 0.;frame,elastic,hardening=self._stored();thermal=self._capacity()*(self.temperature-self.plant['ambient_k']) if self.plant else 0.;d.update(mass_kg=mass,mass_residual_kg=d['loaded_mass_kg']-d['removed_mass_kg']-mass,volume_m3=volume,volume_residual_m3=d['loaded_volume_m3']-d['removed_volume_m3']-volume,plastic_defect_stored_j=self.defect_stored,frame_elastic_j=frame,sample_elastic_j=elastic,hardening_stored_j=hardening,fracture_surface_j=self.fracture_surface,sample_thermal_j=thermal)
|
| 183 |
+
d['energy_residual_j']=d['actuator_work_j']+d['sensible_loaded_j']-d['sensible_removed_j']-d['internal_removed_j']-d['heat_export_j']-d['machine_damping_export_j']-sum(d[k] for k in ['plastic_defect_stored_j','frame_elastic_j','sample_elastic_j','hardening_stored_j','fracture_surface_j','sample_thermal_j']);return d
|
| 184 |
+
def read(self,visibility='agent'):
|
| 185 |
+
extension=self._free_extension() if self.broken else self._strain()*self.sample['gauge_length_m'] if self.sample else 0.;frame=self.force/self.plant['frame_stiffness_n_m'] if self.plant else 0.;gap=max(0.,self._pos('crosshead')-extension) if self.sample and self.broken else 0.;ext=self._observed_extension()
|
| 186 |
+
d={'clock.time_s':self.time_s,'plant.configured':self.plant is not None,'fixture.configured':self.fixture is not None,'fixture.extensometer_enabled':bool(self.fixture and self.fixture['extensometer_enabled']),'method.configured':self.method is not None,'sample.present':self.sample is not None,'sample.broken':self.broken,'power.enabled':self.power,'emergency.engaged':self.emergency,'crosshead.position_m':self._pos('crosshead'),'crosshead.target_m':self.axes['crosshead']['target'],'crosshead.indicated_m':quant(self._pos('crosshead'),POSITION_RESOLUTION_M) if self.power else None,'frame.deflection_m':frame,'sample.visual_extension_m':extension,'sample.fracture_gap_m':gap,'power.angle_rad':.28 if self.power else 0.,'emergency.position_m':.004 if self.emergency else 0.,'force.indicated_n':self._observed_force(),'extensometer.extension_m':ext,'extensometer.strain':None if ext is None else ext/self.fixture['extensometer_gauge_m'],'thermal.sample_k':self.temperature if self.plant else None,'calibration.force_gain':self.force_gain,'calibration.force_zero_n':self.force_zero,'acquisition.phase':self.phase,'acquisition.elapsed_s':self.elapsed,'acquisition.points':len(self.rows),'truth.force_n':self.force,'truth.plastic_strain':self.plastic,'truth.total_strain':self._strain(),'truth.mass_kg':self._mass(),'truth.sample_k':self.temperature}
|
| 187 |
+
for side in ['upper','lower']:d['grip.'+side+'_opening_m']=self._pos(side);d['grip.target_'+side+'_opening_m']=self.axes[side]['target']
|
| 188 |
+
return {k:copy.deepcopy(v) for k,v in d.items() if visibility!='agent' or SLOTS[k]['visibility']=='agent'}
|
| 189 |
+
def _propagate(self,ns):
|
| 190 |
+
dt=ns/1e9
|
| 191 |
+
if dt<=0 or not self.plant:return
|
| 192 |
+
x1=self._pos('crosshead')+self._rate()*dt;F0=self.force;p0=self.plastic;F1,p1=self._solve(x1);before=sum(self._stored(F0,p0));after=sum(self._stored(F1,p1));plasticwork=0.
|
| 193 |
+
if self.sample:plasticwork=self.Y*(p1-p0)*self.sample['initial_area_m2']*self.sample['gauge_length_m']
|
| 194 |
+
heat=plasticwork*self.plant['plastic_heat_fraction'];self.book['actuator_work_j']+=after-before+plasticwork;self.book['plastic_work_j']+=plasticwork;self.book['plastic_heat_j']+=heat;self.defect_stored+=plasticwork-heat;self.force=F1;self.plastic=p1
|
| 195 |
+
C=self._capacity();G=self.plant['sample_conductance_w_k'];u0=C*(self.temperature-self.plant['ambient_k']);decay=math.exp(-G*dt/C);u1=u0*decay+(heat/dt)*C/G*(-math.expm1(-G*dt/C));self.temperature=self.plant['ambient_k']+u1/C;self.book['heat_export_j']+=heat-(u1-u0)
|
| 196 |
+
gain=self.plant['force_gain'] if self.power else 0.;f0=gain*F0+(self.plant['force_offset_n'] if self.power else 0.);slope=gain*(F1-F0)/dt;tau=self.plant['force_response_tau_s'];self.sensor_force=f0+slope*(dt-tau)+(self.sensor_force-f0+slope*tau)*math.exp(-dt/tau)
|
| 197 |
+
def _fracture_position(self):
|
| 198 |
+
ep=self.sample['engineering_strain_at_break'];A=self.sample['initial_area_m2'];L=self.sample['gauge_length_m'];H=self.sample['hardening_modulus_pa'];sigma=self.E*(ep-self.plastic)
|
| 199 |
+
if sigma>self.Y+H*self.plastic:sigma=self.E*(self.Y+H*ep)/(self.E+H)
|
| 200 |
+
return L*ep+A*max(0,sigma)/self.plant['frame_stiffness_n_m']
|
| 201 |
+
def _force_position(self,load):
|
| 202 |
+
L=self.sample['gauge_length_m'];A=self.sample['initial_area_m2'];H=self.sample['hardening_modulus_pa'];plastic=self.plastic
|
| 203 |
+
if load>A*(self.Y+H*plastic):
|
| 204 |
+
if H<=0:return math.inf
|
| 205 |
+
plastic=(load/A-self.Y)/H
|
| 206 |
+
return self._compliance()*load+L*plastic
|
| 207 |
+
def _next_material_event(self):
|
| 208 |
+
rate=self._rate();x=self._pos('crosshead')
|
| 209 |
+
if rate<=0 or not self._held() or self.broken:return None
|
| 210 |
+
A=self.sample['initial_area_m2'];yield_x=self._compliance()*A*(self.Y+self.sample['hardening_modulus_pa']*self.plastic)+self._free_extension();limit=min(FIXTURE_MAX_N,self.method['force_stop_n'] if self.phase=='running' else FIXTURE_MAX_N);positions=[(self._fracture_position(),'fracture'),(self._force_position(limit),'force_limit')]
|
| 211 |
+
if yield_x>x+1e-12:positions.append((yield_x,'yield'))
|
| 212 |
+
candidates=[]
|
| 213 |
+
for target,kind in positions:
|
| 214 |
+
if math.isfinite(target) and target>=x-1e-12:candidates.append((self.time_ns+max(1,int(math.ceil((target-x)/rate*1e9-1e-7))),kind))
|
| 215 |
+
return min(candidates) if candidates else None
|
| 216 |
+
def _record(self,kind='sample'):
|
| 217 |
+
F=self._observed_force();quality='estimated'
|
| 218 |
+
if not self._temperature_valid():quality='temperature_invalid'
|
| 219 |
+
elif F is None:quality='overload'
|
| 220 |
+
elif abs(F)<20:quality='below_documented_accuracy_range'
|
| 221 |
+
self.rows.append(dict(point_index=len(self.rows),time_s=self.time_s,kind=kind,force_n=F,crosshead_m=quant(self._pos('crosshead'),POSITION_RESOLUTION_M),extensometer_extension_m=self._observed_extension(),broken=self.broken,quality=quality))
|
| 222 |
+
return F is not None
|
| 223 |
+
def _break(self):
|
| 224 |
+
if self.broken:return
|
| 225 |
+
valid_pre=self._record('fracture_pre') if self.phase=='running' else True
|
| 226 |
+
frame,elastic,_=self._stored();heat=elastic*self.plant['fracture_heat_fraction'];self.fracture_surface+=elastic-heat;self.book['fracture_heat_j']+=heat;self.book['machine_damping_export_j']+=frame;self.temperature+=heat/self._capacity();self.force=0.;self.broken=True
|
| 227 |
+
if self.phase=='running':
|
| 228 |
+
valid_post=self._record('fracture_post')
|
| 229 |
+
if not valid_pre or not valid_post:self._finish('failed','REFERENCE_TEMPERATURE_RANGE' if not self._temperature_valid() else 'LOAD_CELL_OVERFLOW')
|
| 230 |
+
elif self.method['stop_on_break'] or self.mode!='speed':self._finish('succeeded','fracture')
|
| 231 |
+
def _stop_drive(self):self._target('crosshead',self._pos('crosshead'),MIN_SPEED_M_S)
|
| 232 |
+
def _finish(self,phase,reason):
|
| 233 |
+
self._stop_drive();self.phase=phase;self.terminal_reason=reason;self.last_stop_reason=reason;self._sample_ns=self._control_ns=None
|
| 234 |
+
if self.operation_id:self.records[self.operation_id]=dict(operation_id=self.operation_id,phase=phase,mode=self.mode,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),terminal_reason=reason,template_source=self._operation_source,evidence='synthetic_forward_model; literature_E_yield_reference_and_explicit_bilinear_hardening_fracture_geometry_thermal_assumptions; actual_external_observations')
|
| 235 |
+
def _result(self):
|
| 236 |
+
if self.phase!='running' and self.operation_id in self.records:return copy.deepcopy(self.records[self.operation_id])
|
| 237 |
+
return dict(operation_id=self.operation_id,phase=self.phase,mode=self.mode,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),terminal_reason=self.terminal_reason,template_source=self._operation_source,evidence='synthetic_forward_model; actual_time_samples_and_explicit_fracture_events; not_original_material_test')
|
| 238 |
+
def _control(self):
|
| 239 |
+
if self.mode=='speed':return
|
| 240 |
+
if self.mode=='force':
|
| 241 |
+
observed=self._observed_force()
|
| 242 |
+
if observed is None:self._finish('failed','REFERENCE_TEMPERATURE_RANGE' if not self._temperature_valid() else 'LOAD_CELL_OVERFLOW');return
|
| 243 |
+
error=self.method['target_force_n']-observed;v=self.plant['force_control_gain_m_per_n_s']*error
|
| 244 |
+
else:
|
| 245 |
+
ext=self._observed_extension()
|
| 246 |
+
if ext is None:self._finish('failed','EXTENSOMETER_UNAVAILABLE');return
|
| 247 |
+
error=self.method['target_strain']-ext/self.fixture['extensometer_gauge_m'];v=self.plant['strain_control_gain_m_s']*error
|
| 248 |
+
speed=min(abs(v),self.method['speed_m_s']);target=self.method['target_crosshead_m'] if v>0 else self._free_extension()
|
| 249 |
+
if speed<MIN_SPEED_M_S:self._stop_drive()
|
| 250 |
+
else:self._target('crosshead',target,speed)
|
| 251 |
+
def invoke(self,capability_id,**arguments):
|
| 252 |
+
if capability_id not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 253 |
+
validate(CAPS[capability_id]['input_schema'],arguments);k=capability_id;a=copy.deepcopy(arguments)
|
| 254 |
+
if k in UNSUPPORTED:raise ActionRejected('UNSUPPORTED')
|
| 255 |
+
if k=='acquisition.result':return self._result()
|
| 256 |
+
if k=='provenance.read':return dict(current_sample=self.source,operation_source=self._operation_source)
|
| 257 |
+
if k=='ledger.read':return self.ledger()
|
| 258 |
+
if k=='analysis.tensile':return analyze_tensile(**a)
|
| 259 |
+
if k=='sim.step':self.step(a['dt_s']);return dict(time_s=self.time_s)
|
| 260 |
+
if self.phase=='running' and k not in ('acquisition.stop','emergency.engage','power.set'):raise ActionRejected('BUSY')
|
| 261 |
+
if k=='plant.configure':
|
| 262 |
+
if self.plant is not None or self.sample or self.power:raise ActionRejected('PLANT_ALREADY_CONFIGURED')
|
| 263 |
+
if not a['accept_engineering']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED')
|
| 264 |
+
self.plant=a;self.temperature=a['ambient_k'];result=dict(configured=True)
|
| 265 |
+
elif k=='fixture.configure':
|
| 266 |
+
if self.sample or any(self._moving(x) for x in self.axes):raise ActionRejected('SAMPLE_PRESENT_OR_MOVING')
|
| 267 |
+
if a['extensometer_enabled'] and not a['accept_engineering_extensometer']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED')
|
| 268 |
+
self.fixture=a;self.method=None;result=dict(configured=True)
|
| 269 |
+
elif k=='method.configure':
|
| 270 |
+
if not self.fixture:raise ActionRejected('FIXTURE_REQUIRED')
|
| 271 |
+
if a['mode']!='speed' and a['sample_rate_hz']>100:raise ActionRejected('AUTOMATIC_CONTROL_MAX_100HZ')
|
| 272 |
+
if not self.fixture['software_trapezium_x'] and (a['sample_rate_hz']>10 or a['mode']!='speed'):raise ActionRejected('SOFTWARE_OPTION_REQUIRED')
|
| 273 |
+
if a['mode']=='strain' and not self.fixture['extensometer_enabled']:raise ActionRejected('EXTENSOMETER_REQUIRED')
|
| 274 |
+
if a['force_stop_n']>FIXTURE_MAX_N or a['target_force_n']>FIXTURE_MAX_N:raise ActionRejected('FIXTURE_FORCE_LIMIT')
|
| 275 |
+
self.method=a;result=dict(configured=True)
|
| 276 |
+
elif k=='sample.load':
|
| 277 |
+
if not self.plant or not self.fixture:raise ActionRejected('CONFIGURATION_REQUIRED')
|
| 278 |
+
if self.sample:raise ActionRejected('SAMPLE_PRESENT')
|
| 279 |
+
if any(self._moving(x) for x in self.axes) or self._pos('crosshead')>1e-12 or any(self._pos(x)<.006-1e-12 for x in ['upper','lower']):raise ActionRejected('LOADING_GEOMETRY')
|
| 280 |
+
if not a['accept_bilinear_geometry_temperature_fracture_assumptions']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED')
|
| 281 |
+
ref=library().get(a['reference_id'])
|
| 282 |
+
if ref is None:raise ActionRejected('UNKNOWN_REFERENCE')
|
| 283 |
+
E=a['host_elastic_modulus_pa'] if a['host_elastic_modulus_pa'] is not None else ref.get('elastic_modulus_Pa');Y=a['host_yield_strength_pa'] if a['host_yield_strength_pa'] is not None else ref.get('yield_strength_Pa')
|
| 284 |
+
if E is None or Y is None or E<=0 or Y<=0:raise ActionRejected('MISSING_CONSTITUTIVE_PRIOR')
|
| 285 |
+
if a['volume_m3']<a['gauge_length_m']*a['initial_area_m2']:raise ActionRejected('VOLUME_BELOW_GAUGE')
|
| 286 |
+
if self.fixture['extensometer_enabled'] and self.fixture['extensometer_gauge_m']>a['gauge_length_m']+1e-12:raise ActionRejected('EXTENSOMETER_GAUGE_OUTSIDE_SAMPLE')
|
| 287 |
+
T=a['initial_temperature_k'];domain=ref.get('valid_temperature_range_K');nominal=ref.get('reference_temperature_K');tol=a['temperature_tolerance_k']
|
| 288 |
+
if nominal is not None and abs(T-nominal)>tol+1e-9 or domain and domain[1]-domain[0]>1e-9 and not domain[0]<=T<=domain[1]:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 289 |
+
incoming=a['volume_m3']*a['density_kg_m3']*a['specific_heat_capacity_j_kg_k']*(T-self.plant['ambient_k']);old=self._capacity()*(self.temperature-self.plant['ambient_k']);self.sample=a;self.reference=ref;self.E=float(E);self.Y=float(Y);self.source=json.dumps(dict(reference_id=a['reference_id'],source=ref.get('source'),evidence=ref.get('evidence')),sort_keys=True);self.plastic=0.;self.force=0.;self.broken=False;self.defect_stored=0.;self.fracture_surface=0.;self.temperature=self.plant['ambient_k']+(old+incoming)/self._capacity();self.book['loaded_mass_kg']+=self._mass();self.book['loaded_volume_m3']+=a['volume_m3'];self.book['sensible_loaded_j']+=incoming;result=dict(present=True)
|
| 290 |
+
elif k=='sample.remove':
|
| 291 |
+
if not self.sample:raise ActionRejected('NO_SAMPLE')
|
| 292 |
+
if any(self._moving(x) for x in self.axes) or any(self._pos(x)<.006-1e-12 for x in ['upper','lower']) or abs(self.force)>1e-6:raise ActionRejected('UNLOAD_REQUIRED')
|
| 293 |
+
mass=self._mass();volume=self.sample['volume_m3'];self.book['removed_mass_kg']+=mass;self.book['removed_volume_m3']+=volume;self.book['sensible_removed_j']+=mass*self.sample['specific_heat_capacity_j_kg_k']*(self.temperature-self.plant['ambient_k']);self.book['internal_removed_j']+=sum(self._stored())+self.defect_stored+self.fracture_surface;self.sample=self.reference=self.source=None;self.plastic=0.;self.broken=False;self.force=0.;self.defect_stored=self.fracture_surface=0.;result=dict(removed_mass_kg=mass,removed_volume_m3=volume)
|
| 294 |
+
elif k=='power.set':
|
| 295 |
+
if not self.plant:raise ActionRejected('PLANT_REQUIRED')
|
| 296 |
+
if not a['enabled']:
|
| 297 |
+
if self.phase=='running':self._finish('cancelled','POWER_OFF')
|
| 298 |
+
for axis in self.axes:self._target(axis,self._pos(axis),MIN_SPEED_M_S if axis=='crosshead' else None)
|
| 299 |
+
self.power=a['enabled'];result=dict(enabled=self.power)
|
| 300 |
+
elif k=='grip.set_closed':
|
| 301 |
+
if not self.plant:raise ActionRejected('PLANT_REQUIRED')
|
| 302 |
+
if self._moving('crosshead') or abs(self.force)>1e-6:raise ActionRejected('UNLOAD_REQUIRED')
|
| 303 |
+
if self.sample and a['closed'] and abs(self._pos('crosshead')-self._free_extension())>1e-10:raise ActionRejected('GRIP_PRESTRAIN_UNSUPPORTED')
|
| 304 |
+
target=0. if a['closed'] else .006;self._target(a['which'],target);result=dict(target_opening_m=target)
|
| 305 |
+
elif k=='crosshead.move_to':
|
| 306 |
+
if not self.power:raise ActionRejected('POWER_OFF')
|
| 307 |
+
if self.emergency:raise ActionRejected('EMERGENCY_ENGAGED')
|
| 308 |
+
if self.sample and not self._held():raise ActionRejected('GRIPS_NOT_CLOSED')
|
| 309 |
+
if self.sample and a['position_m']<self._free_extension()-1e-12:raise ActionRejected('COMPRESSION_OR_SLACK_UNSUPPORTED')
|
| 310 |
+
self._target('crosshead',a['position_m'],a['speed_m_s']);result=dict(target_m=a['position_m'])
|
| 311 |
+
elif k=='emergency.engage':
|
| 312 |
+
if self.phase=='running':self._finish('cancelled','EMERGENCY_STOP')
|
| 313 |
+
if self.plant:
|
| 314 |
+
for axis in self.axes:self._target(axis,self._pos(axis),MIN_SPEED_M_S if axis=='crosshead' else None)
|
| 315 |
+
self.emergency=True;result=dict(engaged=True)
|
| 316 |
+
elif k=='emergency.reset':self.emergency=False;result=dict(engaged=False)
|
| 317 |
+
elif k=='force.zero':
|
| 318 |
+
if not self.power:raise ActionRejected('POWER_OFF')
|
| 319 |
+
if abs(self.force)>1e-6 or any(self._moving(x) for x in self.axes):raise ActionRejected('UNLOAD_REQUIRED')
|
| 320 |
+
self.force_zero=self.sensor_force;result=dict(zero_n=self.force_zero)
|
| 321 |
+
elif k=='force.calibrate':
|
| 322 |
+
if not self.power:raise ActionRejected('POWER_OFF')
|
| 323 |
+
if any(self._moving(x) for x in self.axes):raise ActionRejected('MOVING')
|
| 324 |
+
if self.sample and a['reference_force_n']>FIXTURE_MAX_N:raise ActionRejected('FIXTURE_FORCE_LIMIT')
|
| 325 |
+
observation=self.sensor_force-self.force_zero
|
| 326 |
+
if observation<=0:raise ActionRejected('ZERO_CALIBRATION_SIGNAL')
|
| 327 |
+
gain=a['reference_force_n']/observation
|
| 328 |
+
if not math.isfinite(gain) or not .001<=gain<=1000:raise ActionRejected('INVALID_CALIBRATION')
|
| 329 |
+
self.force_gain=gain;result=dict(gain=gain)
|
| 330 |
+
elif k=='acquisition.start':
|
| 331 |
+
if not self.power:raise ActionRejected('POWER_OFF')
|
| 332 |
+
if self.emergency:raise ActionRejected('EMERGENCY_ENGAGED')
|
| 333 |
+
if not self.method or not self.fixture or not self.plant:raise ActionRejected('CONFIGURATION_REQUIRED')
|
| 334 |
+
if not self.sample:raise ActionRejected('NO_SAMPLE')
|
| 335 |
+
if self.broken:raise ActionRejected('SAMPLE_BROKEN')
|
| 336 |
+
if not self._held():raise ActionRejected('GRIPS_NOT_CLOSED')
|
| 337 |
+
if any(self._moving(x) for x in self.axes):raise ActionRejected('MOVING')
|
| 338 |
+
if not self._temperature_valid():raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 339 |
+
if self.force>=self.method['force_stop_n']:raise ActionRejected('METHOD_FORCE_STOP')
|
| 340 |
+
if self._observed_force() is None:raise ActionRejected('LOAD_CELL_OVERFLOW')
|
| 341 |
+
if self.method['target_crosshead_m']<self._free_extension()-1e-12:raise ActionRejected('COMPRESSION_OR_SLACK_UNSUPPORTED')
|
| 342 |
+
self._counter+=1;self.operation_id=f'{self.instance_id}:test:{self._counter}';self.phase='running';self.mode=self.method['mode'];self.elapsed=0.;self.rows=[];self.terminal_reason=None;self._operation_source=self.source;self._start_ns=self.time_ns;self._end_ns=self.time_ns+round(self.method['duration_s']*1e9);self._period_ns=1_000_000_000//self.method['sample_rate_hz'];self._sample_ns=self.time_ns+self._period_ns;self._control_ns=self.time_ns+CONTROL_PERIOD_NS if self.mode!='speed' else None
|
| 343 |
+
self._record()
|
| 344 |
+
if self.mode=='speed':self._target('crosshead',self.method['target_crosshead_m'],self.method['speed_m_s'])
|
| 345 |
+
else:self._control()
|
| 346 |
+
result=dict(operation_id=self.operation_id)
|
| 347 |
+
elif k=='acquisition.stop':
|
| 348 |
+
if self.phase!='running':raise ActionRejected('NOT_RUNNING')
|
| 349 |
+
self._finish('cancelled','USER_CANCEL');result=dict(phase=self.phase,elapsed_s=self.elapsed)
|
| 350 |
+
else:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 351 |
+
self.revision+=1;return copy.deepcopy(result)
|
| 352 |
+
def step(self,dt_s):
|
| 353 |
+
validate(number('s',0,86400),dt_s)
|
| 354 |
+
raw=float(dt_s)*1e9+self._clock_remainder_ns;nanos=round(raw);self._clock_remainder_ns=raw-nanos
|
| 355 |
+
if not nanos:return
|
| 356 |
+
end=self.time_ns+nanos
|
| 357 |
+
while self.time_ns<end:
|
| 358 |
+
candidates=[end]+[a['arrival_ns'] for a in self.axes.values() if a['arrival_ns']>self.time_ns];event=self._next_material_event()
|
| 359 |
+
if event:candidates.append(event[0])
|
| 360 |
+
if self.phase=='running':candidates.extend(x for x in [self._sample_ns,self._control_ns,self._end_ns] if x is not None and x>self.time_ns)
|
| 361 |
+
nxt=min(candidates);self._propagate(nxt-self.time_ns);self.time_ns=nxt;self._positions()
|
| 362 |
+
if self.phase=='running':self.elapsed=(self.time_ns-self._start_ns)/1e9
|
| 363 |
+
if event and event[0]==self.time_ns:
|
| 364 |
+
if event[1]=='fracture':self._break()
|
| 365 |
+
elif event[1]=='force_limit':
|
| 366 |
+
self.last_stop_reason='FIXTURE_FORCE_LIMIT' if self.force>=FIXTURE_MAX_N-1e-4 else 'METHOD_FORCE_STOP'
|
| 367 |
+
if self.phase=='running':self._record();self._finish('failed',self.last_stop_reason)
|
| 368 |
+
else:self._stop_drive()
|
| 369 |
+
if self.phase=='running' and self._sample_ns==self.time_ns:
|
| 370 |
+
valid=self._record();self._sample_ns+=self._period_ns
|
| 371 |
+
if not valid:self._finish('failed','REFERENCE_TEMPERATURE_RANGE' if not self._temperature_valid() else 'LOAD_CELL_OVERFLOW')
|
| 372 |
+
if self.phase=='running' and self._control_ns==self.time_ns:self._control();self._control_ns=self.time_ns+CONTROL_PERIOD_NS if self.phase=='running' else None
|
| 373 |
+
if self.phase=='running' and (self.time_ns>=self._end_ns or self.mode=='speed' and not self._moving('crosshead')):
|
| 374 |
+
valid=self._record() if not self.rows or self.rows[-1]['time_s']!=self.time_s else self.rows[-1]['force_n'] is not None
|
| 375 |
+
if not valid:self._finish('failed','REFERENCE_TEMPERATURE_RANGE' if not self._temperature_valid() else 'LOAD_CELL_OVERFLOW')
|
| 376 |
+
else:self._finish('succeeded','duration_limit' if self.time_ns>=self._end_ns else 'target_reached')
|
| 377 |
+
self.revision+=1
|
| 378 |
+
|
| 379 |
+
class ShimadzuAgs10knxdSession:
|
| 380 |
+
def __init__(self, host, principal_id): self._host = host; self._principal = principal_id
|
| 381 |
+
@property
|
| 382 |
+
def _role(self): return self._host._principals[self._principal]
|
| 383 |
+
def _target(self, instance_id):
|
| 384 |
+
if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 385 |
+
def describe(self, *, instance_id=None, asset_type_id=None):
|
| 386 |
+
if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT')
|
| 387 |
+
if instance_id is not None: self._target(instance_id)
|
| 388 |
+
if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 389 |
+
meta = export_shimadzu_ags10knxd_contract_metadata()
|
| 390 |
+
return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'})
|
| 391 |
+
def read(self, *, instance_id, state_ids=None):
|
| 392 |
+
self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids
|
| 393 |
+
if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT')
|
| 394 |
+
if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED')
|
| 395 |
+
return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids})
|
| 396 |
+
def _filter_result(self, result):
|
| 397 |
+
result = copy.deepcopy(result)
|
| 398 |
+
# A bridge may dispatch agent-visible capabilities through a privileged
|
| 399 |
+
# session. Public acquisition payloads therefore use the SAME redaction
|
| 400 |
+
# for every role. Full provenance has its own evaluator-only capability.
|
| 401 |
+
if 'rows' in result and 'template_source' in result:
|
| 402 |
+
result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None
|
| 403 |
+
result['evidence'] = 'synthetic_forward_model; actual_force_crosshead_extensometer_observations; literature_reference_and_explicit_bilinear_geometry_thermal_fracture_assumptions; selected record restricted' if result['operation_id'] is not None else 'no_measurement'
|
| 404 |
+
return result
|
| 405 |
+
def invoke(self, *, instance_id, capability_id, arguments, request_id):
|
| 406 |
+
h=self._host
|
| 407 |
+
try:
|
| 408 |
+
self._target(instance_id)
|
| 409 |
+
if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 410 |
+
if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED')
|
| 411 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 412 |
+
validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False)
|
| 413 |
+
if key in h._requests:
|
| 414 |
+
old,response=h._requests[key]
|
| 415 |
+
if old!=digest: raise ActionRejected('REQUEST_CONFLICT')
|
| 416 |
+
return copy.deepcopy(response)
|
| 417 |
+
if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 418 |
+
if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 419 |
+
result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id in ('acquisition.start',) else None
|
| 420 |
+
if operation: h._owners[operation]=self._principal
|
| 421 |
+
response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None)
|
| 422 |
+
h._requests[key]=(digest,copy.deepcopy(response)); return response
|
| 423 |
+
except ActionRejected as exc:
|
| 424 |
+
return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none'))
|
| 425 |
+
def write(self, *, instance_id, state_id, value, request_id):
|
| 426 |
+
self._target(instance_id); entry=SLOTS.get(state_id)
|
| 427 |
+
if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED')
|
| 428 |
+
capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id)
|
| 429 |
+
def poll(self, operation_id):
|
| 430 |
+
h=self._host
|
| 431 |
+
if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 432 |
+
result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id)
|
| 433 |
+
if result is None: raise ActionRejected('UNKNOWN_OPERATION')
|
| 434 |
+
return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result))
|
| 435 |
+
def cancel(self, operation_id, request_id):
|
| 436 |
+
self.poll(operation_id); h=self._host
|
| 437 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 438 |
+
key=(self._principal,request_id)
|
| 439 |
+
if key in h._cancel_operations:
|
| 440 |
+
if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT')
|
| 441 |
+
return copy.deepcopy(h._requests[key][1])
|
| 442 |
+
if key in h._requests: raise ActionRejected('REQUEST_CONFLICT')
|
| 443 |
+
if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING')
|
| 444 |
+
result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id)
|
| 445 |
+
if result['status']=='succeeded': h._cancel_operations[key]=operation_id
|
| 446 |
+
return result
|
| 447 |
+
|
| 448 |
+
for i,strain in enumerate([.0002,.0005,.001]):
|
| 449 |
+
CAPS['analysis.tensile']['example_arguments']['rows'].append(dict(point_index=i,time_s=i*.1,kind='sample',force_n=2e11*strain*2e-6,crosshead_m=strain*.025+(2e11*strain*2e-6)/1e8,extensometer_extension_m=strain*.025,broken=False,quality='estimated'))
|
| 450 |
+
EFFECTS={
|
| 451 |
+
'plant.configure':['plant.configured','thermal.sample_k','truth.sample_k'],
|
| 452 |
+
'fixture.configure':['fixture.configured','fixture.extensometer_enabled','method.configured'],
|
| 453 |
+
'method.configure':['method.configured'],
|
| 454 |
+
'sample.load':['sample.present','sample.broken','thermal.sample_k','truth.sample_k','truth.mass_kg','extensometer.extension_m','extensometer.strain'],
|
| 455 |
+
'sample.remove':['sample.present','sample.broken','truth.mass_kg','truth.plastic_strain','truth.total_strain','sample.visual_extension_m','sample.fracture_gap_m','extensometer.extension_m','extensometer.strain'],
|
| 456 |
+
'power.set':['power.enabled','power.angle_rad','force.indicated_n','crosshead.indicated_m','extensometer.extension_m','extensometer.strain','crosshead.target_m','grip.target_upper_opening_m','grip.target_lower_opening_m','acquisition.phase'],
|
| 457 |
+
'grip.set_closed':['grip.target_upper_opening_m','grip.target_lower_opening_m'],
|
| 458 |
+
'crosshead.move_to':['crosshead.target_m'],
|
| 459 |
+
'emergency.engage':['emergency.engaged','emergency.position_m','crosshead.target_m','grip.target_upper_opening_m','grip.target_lower_opening_m','acquisition.phase'],
|
| 460 |
+
'emergency.reset':['emergency.engaged','emergency.position_m'],
|
| 461 |
+
'force.zero':['calibration.force_zero_n','force.indicated_n'],
|
| 462 |
+
'force.calibrate':['calibration.force_gain','force.indicated_n'],
|
| 463 |
+
'acquisition.start':['acquisition.phase','acquisition.elapsed_s','acquisition.points','crosshead.target_m'],
|
| 464 |
+
'acquisition.stop':['acquisition.phase','crosshead.target_m'],
|
| 465 |
+
'sim.step':list(SLOTS)}
|
| 466 |
+
for k,v in EFFECTS.items():CAPS[k]['effects']=v
|
| 467 |
+
ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'USER_CANCEL','EMERGENCY_STOP','LOAD_CELL_OVERFLOW','METHOD_FORCE_STOP'})
|
| 468 |
+
LIMITATIONS=[
|
| 469 |
+
'配置AGS-10kNXD高精度10kN传感器、真实SCG5kN手动拉伸夹具、TRAPEZIUM X软件;5000N夹具限值独立于10000N传感器量程,不实现弯曲/剥离/压缩和温控附件。',
|
| 470 |
+
'试验速度0.001..1000mm/min;最大1500mm/min回程不是本试验速度范围。1µm是位移显示分辨,不是定位准确度;±0.5% indicated仅20..10000N厂家条件,不自动变模拟噪声或已测精度。',
|
| 471 |
+
'有选定TRAPEZIUM软件时速度模式最多1000Hz真实采样;厂家自动force/stress或strain控制10ms,因此力/应变控制最多100Hz,工程反馈也严格每10ms更新。无软件选项仅保守10Hz速度模式,不声称OEM所有无软件模式。',
|
| 472 |
+
'材料库真实金属processed true/log曲线及E/0.2%yield和独立聚合物汇总标量是参考,不是本机器原生输出。真实E/Y驱动显式一维双线性代理;硬化H、工程断裂ε、温域常数近似、尺寸迁移和热参数须宿主接受。真实局部断口true strain不冒充engineering break elongation,截断曲线末点不是UTS或断裂。',
|
| 473 |
+
'均匀有效标距采用engineering strain、固定initial area的小变形一维代理,不解颈缩、面积演变、局部损伤或全场应变;源true-stress标量迁移到该代理是工程假设。rate-independent plasticity不是真实全速率材料响应。',
|
| 474 |
+
'横梁q=L*(elastic_strain+plastic_strain)+F/K;K包含机架/夹具串联顺应,不能把q/L直接当试样应变。工程夹持引伸计独立输出标距伸长,可显式不配;面积和标距均需独立先验才分析stress/strain。',
|
| 475 |
+
'H使用储能硬化变量:Uhard=.5*H*ep²*A*L;不可逆plasticwork=Y*d(ep)*A*L,β变热其余保留缺陷能。显式断裂阈值释放sampleelastic至热/新表面,frameelastic导出至机架阻尼;残余塑性及硬化/缺陷能随碎片保留。',
|
| 476 |
+
'准静态一维力平衡不解横梁惯性或真实破断应力波。理想瞬时断裂时F物理突降,传感器仍有一阶响应;断裂pre/post是额外明确事件记录,不能冒充1000Hz时间网格中的额外独立采样。',
|
| 477 |
+
'被动热节点=宿主输入完整样品质量*Cp+局部接触热容,不使用85kg整机质量。塑性只对有效AL积分,完整体积/密度是独立先验并包含未变形tabs;视觉tabs形状不作为精确体积计量。没有主动温控器。',
|
| 478 |
+
'取消/急停/断电停止位移并按自锁丝杆假设保留静载弹性能,之后仍被动换热;不会重置塑性或断裂。带样不允许横梁进入低于残余自由长度的压缩/松弛区域,开夹须F≈0。夹具动作是有限时间手工代理,不声称真实电动SCG。',
|
| 479 |
+
'校准从当前实际传感器观测和外部已知力先验求zero/gain;不存在未接加载标准的自动已知真值,外部力先验没有证书即非计量认证。仅输出校准参数,不声称闭环准确度达标。',
|
| 480 |
+
'固定3D示例自由标距25mm、2mm×1mm,两个15mm夹持tabs。过程可配置其它尺寸但当前视觉仍是固定示例,不声称自动匹配任意试样。sample.present=false须隐藏试样,卸样后q可非零。',
|
| 481 |
+
'所有普通Session acquisition.result/poll跨角色��一隐藏选中材料身份,独立provenance.read仅evaluator;共享磁盘/Python不是操作系统隔离。实机驱动、机器人、经验噪声与OEM/ASTM/ISO认证均not_run。']
|
| 482 |
+
|
| 483 |
+
def export_shimadzu_ags10knxd_contract_metadata():
|
| 484 |
+
slots={};caps={}
|
| 485 |
+
for k,v in SLOTS.items():slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; 10kN high-precision load cell / 5kN SCG tensile fixture / configured software and engineering extensometer.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'ShimadzuAgs10knxdSession.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Pure read; sampling at configured fixed time grid with separately labelled fracture event observations.'),source_ids=['simulation_assumption'])
|
| 486 |
+
for k,v in CAPS.items():
|
| 487 |
+
un=k in UNSUPPORTED;async_=k=='acquisition.start';caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']}
|
| 488 |
+
caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.shimadzu_ags10knxd.ShimadzuAgs10knxdSession.invoke',invocation=f'session.invoke(instance_id="ags_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='入口原子核对夹具/软件、载荷、夹持和独立材料/热/断裂先验;采样与控制必须显式step。',state_ids=['power.enabled','sample.present','fixture.configured','emergency.engaged','acquisition.phase'],enforced_by='runtime',check='ShimadzuAgs10knxdRuntime.invoke')],state_effects=[dict(state_id=s,timing='on_step' if k=='sim.step' else 'immediate',description_zh='声明设置或观测变化,真实驱动/热/传感器过程由step推进') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='运行层输出绑定状态,实际几何、双片变形和读数联动由独立scene验证。',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='实际有限位移/时限/明确破断条件完成;力/应变控制为限时反馈,完成不等于误差为零' if async_ else '原子命令,step为唯一物理时钟',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','crosshead','tensile_fixture','load_cell','extensometer'],partial_failure_zh='保留已采样点、真实位移/力、塑性、断裂和全部热/弹性/缺陷能账。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('USER_CANCEL','EMERGENCY_STOP','LOAD_CELL_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','FIXTURE_FORCE_LIMIT','METHOD_FORCE_STOP') else 'none') for e in ERRORS],verification=[],limitations=LIMITATIONS,source_ids=['manufacturer_primary','simulation_assumption','template_library'])
|
| 489 |
+
if k in ('acquisition.start','crosshead.move_to','grip.set_closed','power.set','emergency.engage'):
|
| 490 |
+
caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='由统一宿主时钟推进准静态本构、被动热和实际传感器响应') for s in SLOTS if s not in v['effects'] and SLOTS[s]['origin'] in ('sensor','derived','scene','process_truth')]
|
| 491 |
+
mechanism=dict(component_ids=['crosshead','compliance_carriage','load_cell','upper_grip','lower_grip','specimen_lower','specimen_upper','extensometer','controller'],state_ids=list(slots),meaning_zh='串联顺应的拉伸双线性塑性、明确破断与可核算热/储能;独立传感器、固定采样和10ms反馈时钟',implementation='lumped',equations=['q=L*(ep+F/(A*E))+F/K; engineering strain=ep+F/(A*E).','yield stress=Y+H*ep; tensile return mapping enforces irreversible ep and quasi-static series equilibrium.','Uelastic=F²/(2K)+0.5*(F/A)²/E*A*L; Uhardening=0.5*H*ep²*A*L.','dWactuator=d(Uelastic+Uhardening)+Y*A*L*d(ep); Qplastic=beta*Y*A*L*d(ep), remaining work stored as defect energy.','At host-assumed fracture strain, sample elastic energy partitions into heat/surface; frame elastic energy exports as damping. ep and hardening/defect/surface energy remain with fragments.','C*dT/dt=-G*(T-Tambient)+Pplastic; sample load/remove transfers physical mass, volume, sensible heat and internal inventory.','tau*dFdet/dt=gain*F+offset-Fdet; Fobs=round((Fdet-zero)*cal_gain/res)*res.','Calibration cal_gain=external_known_force/(actual_detector_observation-zero); no hidden truth is used.','External analysis: sigma=Fobs/Aprior; strain=extension_observed/Lprior or (qobs-Fobs*Cframe_prior)/Lprior; no joint inversion of unknown geometry.','Sampling grid up to1000Hz with selected software; automatic force/strain feedback and associated sampling max100Hz. Fractional-nanosecond carry and yield/fracture/axis events maintain partition invariance.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=LIMITATIONS)
|
| 492 |
+
spec=importlib.util.spec_from_file_location('_ags_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'uniaxial_tension':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'fixture.configure':(FIXTURE,FIXTURE_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE)})
|
| 493 |
+
for k,v in SLOTS.items():slots[k]['meaning_zh']=v['meaning']
|
| 494 |
+
return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'uniaxial_tension':mechanism})
|
scripts/asset_runtime/signatone_quadpro2.py
ADDED
|
@@ -0,0 +1,543 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""QuadPro2-DAC0 with Keithley2450: timed four-contact thin-film wafer mapping."""
|
| 2 |
+
from __future__ import annotations
|
| 3 |
+
import copy,importlib.util,json,math
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
import numpy as np
|
| 6 |
+
from scipy.integrate import solve_ivp
|
| 7 |
+
PROTOCOL_VERSION='1.0.0';SLUG='signatone_quadpro2';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-142'
|
| 8 |
+
ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'sheet_resistance_library.json'
|
| 9 |
+
|
| 10 |
+
class ActionRejected(ValueError):pass
|
| 11 |
+
|
| 12 |
+
def number(unit='1',lo=None,hi=None):
|
| 13 |
+
s={'type':'number','x-unit':unit}
|
| 14 |
+
if lo is not None:s['minimum']=lo
|
| 15 |
+
if hi is not None:s['maximum']=hi
|
| 16 |
+
return s
|
| 17 |
+
|
| 18 |
+
def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False)
|
| 19 |
+
def nullable(s):return {'anyOf':[s,{'type':'null'}]}
|
| 20 |
+
def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum)
|
| 21 |
+
def enum(items):return {'type':'string','enum':items}
|
| 22 |
+
BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed'])
|
| 23 |
+
|
| 24 |
+
def validate(s,v):
|
| 25 |
+
if 'anyOf' in s:
|
| 26 |
+
for o in s['anyOf']:
|
| 27 |
+
try:validate(o,v);return
|
| 28 |
+
except ActionRejected:pass
|
| 29 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 30 |
+
k=s.get('type')
|
| 31 |
+
if k in ('number','integer'):
|
| 32 |
+
if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 33 |
+
elif k=='object':
|
| 34 |
+
if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT')
|
| 35 |
+
for key,value in v.items():validate(s['properties'][key],value)
|
| 36 |
+
elif k=='array':
|
| 37 |
+
if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 38 |
+
for x in v:validate(s['items'],x)
|
| 39 |
+
elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT')
|
| 40 |
+
elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT')
|
| 41 |
+
elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT')
|
| 42 |
+
if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT')
|
| 43 |
+
|
| 44 |
+
from scipy.linalg import expm
|
| 45 |
+
CURRENT_RANGES=[10.**p for p in range(-8,1)]
|
| 46 |
+
VOLTAGE_RANGES=[.02,.2,2.,20.,200.]
|
| 47 |
+
PROBE_SPACINGS=[.001016,.00127,.0015875]
|
| 48 |
+
CONFIGURATIONS={'a_14_23':(0,3,1,2),'b_13_24':(0,2,1,3)}
|
| 49 |
+
WARMUP_S=3600.;CALIBRATION_S=180.;PROBE_RAISED_M=.01
|
| 50 |
+
|
| 51 |
+
def library():return {v['id']:v for v in json.loads(LIBRARY_PATH.read_text())['templates']}
|
| 52 |
+
def reference_rho(record,T,allow_invalid=False):
|
| 53 |
+
rows=record['curves']['resistivity'];lo=max(rows[0]['temperature_K'],record['valid_temperature_range_K'][0]);hi=min(rows[-1]['temperature_K'],record['valid_temperature_range_K'][1]);valid=lo-1e-6<=T<=hi+1e-6
|
| 54 |
+
if not valid and not allow_invalid:return None
|
| 55 |
+
return float(np.interp(T,[p['temperature_K'] for p in rows],[p['value_ohm_m'] for p in rows])),valid
|
| 56 |
+
|
| 57 |
+
def probe_points(x_m,y_m,spacing_m,orientation_rad=0.):
|
| 58 |
+
direction=complex(math.cos(orientation_rad),math.sin(orientation_rad));center=complex(x_m,y_m)
|
| 59 |
+
return [center+v*spacing_m*direction for v in [-1.5,-.5,.5,1.5]]
|
| 60 |
+
def disk_kernel(z,a,radius_m,contact_radius_m=None):
|
| 61 |
+
# Neumann disk source kernel, modulo constants which cancel for source/sink.
|
| 62 |
+
distance=abs(z-a) if contact_radius_m is None else max(abs(z-a),contact_radius_m)
|
| 63 |
+
return math.log(distance/radius_m)+math.log(abs(1-z*a.conjugate()/radius_m**2))
|
| 64 |
+
def disk_transfer_coefficient(diameter_m,spacing_m,x_m,y_m,configuration='a_14_23',orientation_rad=0.,contact_radius_m=0.):
|
| 65 |
+
R=diameter_m/2;pts=probe_points(x_m,y_m,spacing_m,orientation_rad)
|
| 66 |
+
if any(abs(p)+max(contact_radius_m,1e-10)>=R for p in pts):raise ActionRejected('PROBE_OUTSIDE_WAFER')
|
| 67 |
+
a,b,c,d=CONFIGURATIONS[configuration]
|
| 68 |
+
potential=lambda z:-(disk_kernel(z,pts[a],R)-disk_kernel(z,pts[b],R))/(2*math.pi)
|
| 69 |
+
value=potential(pts[c])-potential(pts[d])
|
| 70 |
+
if not value>0:raise ActionRejected('GEOMETRY_UNRESOLVED')
|
| 71 |
+
return float(value)
|
| 72 |
+
def disk_drive_coefficient(diameter_m,spacing_m,x_m,y_m,configuration,contact_radius_m):
|
| 73 |
+
R=diameter_m/2;pts=probe_points(x_m,y_m,spacing_m);a,b,_,_=CONFIGURATIONS[configuration]
|
| 74 |
+
potential=lambda z:-(disk_kernel(z,pts[a],R,contact_radius_m)-disk_kernel(z,pts[b],R,contact_radius_m))/(2*math.pi)
|
| 75 |
+
return float(potential(pts[a])-potential(pts[b]))
|
| 76 |
+
|
| 77 |
+
def infer_sheet_resistance(diameter_m,spacing_m,x_m,y_m,observations,calibration_gain,thickness_prior_m):
|
| 78 |
+
estimates=[]
|
| 79 |
+
for configuration in CONFIGURATIONS:
|
| 80 |
+
rows=[p for p in observations if p['configuration']==configuration]
|
| 81 |
+
if len(rows)!=2 or rows[0]['current_a']*rows[1]['current_a']>=0:raise ActionRejected('CURRENT_REVERSAL_REQUIRED')
|
| 82 |
+
dI=rows[0]['current_a']-rows[1]['current_a'];dV=rows[0]['voltage_v']-rows[1]['voltage_v']
|
| 83 |
+
if abs(dI)<1e-20:raise ActionRejected('CURRENT_UNRESOLVED')
|
| 84 |
+
coefficient=disk_transfer_coefficient(diameter_m,spacing_m,x_m,y_m,configuration);value=calibration_gain*dV/dI/coefficient
|
| 85 |
+
if not math.isfinite(value) or value<=0:raise ActionRejected('NONPOSITIVE_SHEET_RESISTANCE')
|
| 86 |
+
estimates.append(value)
|
| 87 |
+
mean=float(np.mean(estimates));spread=abs(estimates[0]-estimates[1])/mean
|
| 88 |
+
return dict(sheet_resistance_ohm_sq=mean,resistivity_ohm_m=None if thickness_prior_m is None else mean*thickness_prior_m,configuration_a_ohm_sq=estimates[0],configuration_b_ohm_sq=estimates[1],configuration_disagreement_fraction=spread,evidence='external_reversed_VI_and_finite_disk_Neumann_correction; rho_only_with_explicit_thickness_prior; not_OEM_ASTM_certification')
|
| 89 |
+
|
| 90 |
+
PLANT_EXAMPLE=dict(ambient_k=300.,voltage_gain=1.03,voltage_offset_v=2e-6,voltage_response_tau_s=.01,current_gain=1.,electrical_contact_radius_m=10e-6,current_contact_resistance_ohm=20.,thermal_conductance_w_k=.05,local_thermal_capacity_j_k=.1,xy_speed_m_s=.04,z_speed_m_s=.005,hood_speed_rad_s=.5,temperature_resolution_k=.001,rear_triax_connected=True,accept_engineering=True)
|
| 91 |
+
PLANT=obj({'ambient_k':number('K',283.15,313.15),'voltage_gain':number('1',.1,10),'voltage_offset_v':number('V',-.1,.1),'voltage_response_tau_s':number('s',1e-5,10),'current_gain':number('1',.1,10),'electrical_contact_radius_m':number('m',1e-7,4e-5),'current_contact_resistance_ohm':number('ohm',0,1e9),'thermal_conductance_w_k':number('W/K',0,1000),'local_thermal_capacity_j_k':number('J/K',.001,100),'xy_speed_m_s':number('m/s',1e-5,.3),'z_speed_m_s':number('m/s',1e-5,.03),'hood_speed_rad_s':number('rad/s',.001,2),'temperature_resolution_k':number('K',1e-5,1),'rear_triax_connected':BOOL,'accept_engineering':BOOL})
|
| 92 |
+
WAFER_EXAMPLE=dict(diameter_m=.1,substrate_thickness_m=.0005)
|
| 93 |
+
WAFER=obj({'diameter_m':number('m',.01,.3),'substrate_thickness_m':number('m',1e-5,.01)})
|
| 94 |
+
PROBE_EXAMPLE=dict(spacing_m=.00127,force_per_pin_n=.83356525,tip_radius_m=40.64e-6,tip_material='tungsten_carbide')
|
| 95 |
+
PROBE=obj({'spacing_m':dict(type='number',enum=PROBE_SPACINGS,**{'x-unit':'m'}),'force_per_pin_n':dict(type='number',enum=[.44129925,.83356525,1.765197],**{'x-unit':'N'}),'tip_radius_m':dict(type='number',enum=[40.64e-6,127e-6,254e-6],**{'x-unit':'m'}),'tip_material':enum(['tungsten_carbide','osmium'])})
|
| 96 |
+
THERMAL_SAMPLE=dict(conducting_thickness_m=1e-6,film_density_kg_m3=6000.,film_cp_j_kg_k=300.,substrate_density_kg_m3=2330.,substrate_cp_j_kg_k=700.,initial_temperature_k=300.,accept_thin_layer_and_thermal_assumptions=True)
|
| 97 |
+
THERMAL_PROPERTIES={'conducting_thickness_m':number('m',1e-9,5e-5),'film_density_kg_m3':number('kg/m^3',1,30000),'film_cp_j_kg_k':number('J/kg/K',1,10000),'substrate_density_kg_m3':number('kg/m^3',1,30000),'substrate_cp_j_kg_k':number('J/kg/K',1,10000),'initial_temperature_k':number('K',1,363.14),'accept_thin_layer_and_thermal_assumptions':BOOL}
|
| 98 |
+
SAMPLE_EXAMPLE=dict(THERMAL_SAMPLE,reference_id='starry_40927',gradient_x_fraction=.1,gradient_y_fraction=-.05,radial_fraction=.03,accept_synthetic_map_and_bulk_reference=True)
|
| 99 |
+
SAMPLE=obj(dict(THERMAL_PROPERTIES,reference_id=TEXT,gradient_x_fraction=number('1',-.2,.2),gradient_y_fraction=number('1',-.2,.2),radial_fraction=number('1',-.2,.2),accept_synthetic_map_and_bulk_reference=BOOL))
|
| 100 |
+
STANDARD_EXAMPLE=dict(THERMAL_SAMPLE,actual_sheet_resistance_ohm_sq=100.,accept_host_standard_not_certified=True)
|
| 101 |
+
STANDARD=obj(dict(THERMAL_PROPERTIES,actual_sheet_resistance_ohm_sq=number('ohm/sq',1e-12,1e15),accept_host_standard_not_certified=BOOL))
|
| 102 |
+
POINT=obj({'x_m':number('m',-.15,.15),'y_m':number('m',-.15,.15)})
|
| 103 |
+
MAP_EXAMPLE=dict(points=[dict(x_m=x,y_m=y) for x,y in [(0,0),(.02,0),(0,.02),(-.02,0),(0,-.02),(.049,0)]],edge_exclusion_m=.003,thickness_prior_m=1e-6)
|
| 104 |
+
MAP=obj({'points':array(POINT,1,14000),'edge_exclusion_m':number('m',0,.15),'thickness_prior_m':nullable(number('m',1e-9,5e-5))})
|
| 105 |
+
METHOD_EXAMPLE=dict(auto_current=True,current_min_a=1e-8,current_max_a=.001,fixed_current_a=.0001,voltage_range_v=.2,voltage_compliance_v=20.,target_voltage_min_v=.005,target_voltage_max_v=.08,phase_duration_s=.3,settling_s=.2,require_calibration=True,require_warmup=False)
|
| 106 |
+
METHOD=obj({'auto_current':BOOL,'current_min_a':dict(type='number',enum=CURRENT_RANGES,**{'x-unit':'A'}),'current_max_a':dict(type='number',enum=CURRENT_RANGES,**{'x-unit':'A'}),'fixed_current_a':number('A',0,1),'voltage_range_v':dict(type='number',enum=VOLTAGE_RANGES,**{'x-unit':'V'}),'voltage_compliance_v':number('V',.002,200),'target_voltage_min_v':number('V',1e-8,100),'target_voltage_max_v':number('V',1e-7,200),'phase_duration_s':number('s',.3,30),'settling_s':number('s',0,60),'require_calibration':BOOL,'require_warmup':BOOL})
|
| 107 |
+
OBSERVATION=obj({'configuration':enum(list(CONFIGURATIONS)),'current_a':number('A'),'voltage_v':number('V'),'host_time_s':number('s',0)})
|
| 108 |
+
OBS_INPUT=obj({'configuration':enum(list(CONFIGURATIONS)),'current_a':number('A'),'voltage_v':number('V')})
|
| 109 |
+
INFERENCE=obj({'sheet_resistance_ohm_sq':number('ohm/sq',0),'resistivity_ohm_m':nullable(number('ohm*m',0)),'configuration_a_ohm_sq':number('ohm/sq',0),'configuration_b_ohm_sq':number('ohm/sq',0),'configuration_disagreement_fraction':number('1',0),'evidence':TEXT})
|
| 110 |
+
ANALYSIS_INPUT=obj({'diameter_m':number('m',.01,.3),'spacing_m':dict(type='number',enum=PROBE_SPACINGS,**{'x-unit':'m'}),'x_m':number('m',-.15,.15),'y_m':number('m',-.15,.15),'observations':array(OBS_INPUT,4,4),'calibration_gain':number('1',.1,10),'thickness_prior_m':nullable(number('m',1e-9,5e-5))})
|
| 111 |
+
ANALYSIS_EXAMPLE=dict(diameter_m=.1,spacing_m=.00127,x_m=0.,y_m=0.,observations=[dict(configuration=c,current_a=I,voltage_v=I*100*disk_transfer_coefficient(.1,.00127,0,0,c)+2e-6) for c in CONFIGURATIONS for I in [.0001,-.0001]],calibration_gain=1.,thickness_prior_m=None)
|
| 112 |
+
MAP_ROW=obj({'point_index':dict(type='integer',minimum=0,maximum=13999,**{'x-unit':'1'}),'x_m':number('m'),'y_m':number('m'),'time_s':number('s',0),'host_time_s':number('s',0),'observations':array(OBSERVATION,0,4),'sheet_resistance_ohm_sq':nullable(number('ohm/sq')),'resistivity_ohm_m':nullable(number('ohm*m')),'configuration_disagreement_fraction':nullable(number('1')),'quality':enum(['estimated','unavailable']),'error_code':nullable(TEXT)})
|
| 113 |
+
STATS=obj({'count':dict(type='integer',minimum=0,maximum=14000,**{'x-unit':'1'}),'mean_ohm_sq':nullable(number('ohm/sq')),'std_ohm_sq':nullable(number('ohm/sq')),'minimum_ohm_sq':nullable(number('ohm/sq')),'maximum_ohm_sq':nullable(number('ohm/sq')),'relative_std_percent':nullable(number('%'))})
|
| 114 |
+
AUTO_ROW=obj({'requested_current_a':number('A'),'measured_current_positive_a':number('A'),'measured_current_negative_a':number('A'),'voltage_positive_v':nullable(number('V')),'voltage_negative_v':nullable(number('V')),'reversal_signal_v':nullable(number('V')),'time_s':number('s',0),'source_compliance':BOOL})
|
| 115 |
+
EXCLUDED=obj({'point_index':dict(type='integer',minimum=0,maximum=13999,**{'x-unit':'1'}),'x_m':number('m'),'y_m':number('m'),'reason':TEXT})
|
| 116 |
+
RESULT=obj({'operation_id':nullable(TEXT),'operation_kind':nullable(enum(['mapping','calibration'])),'phase':PHASE,'elapsed_s':number('s',0),'rows':array(MAP_ROW,0,14000),'excluded_points':array(EXCLUDED,0,14000),'auto_trials':array(AUTO_ROW,0,9),'selected_current_a':number('A',0,1),'statistics':STATS,'calibration_gain':nullable(number('1')),'template_source':nullable(TEXT),'evidence':TEXT,'error_code':nullable(TEXT)})
|
| 117 |
+
CAPS={};SLOTS={}
|
| 118 |
+
def cap(k,i,o,c,z,kind='device_command',visibility='agent',example=None):CAPS[k]=dict(input_schema=i,output_schema=o,component_ids=c,function_zh=z,kind=kind,visibility=visibility,example_arguments=copy.deepcopy(example or {}),effects=[])
|
| 119 |
+
def slot(k,s,u,z,origin='derived',visibility='agent',component='controller'):SLOTS[k]=dict(schema=s,unit=u,meaning=z,origin=origin,visibility=visibility,component=component,write=None)
|
| 120 |
+
cap('plant.configure',PLANT,obj({'configured':BOOL}),['controller','source_meter','sample_stage'],'宿主明确误差、运动速度、被动热参数及2450 rear triax连接,不注入厂家准确度','configuration','evaluator',PLANT_EXAMPLE)
|
| 121 |
+
cap('wafer.configure',WAFER,obj({'configured':BOOL}),['sample_wafer'],'10至300mm圆片和绝缘支承基底厚度,载入后锁定几何','configuration','evaluator',WAFER_EXAMPLE)
|
| 122 |
+
cap('probe.configure',PROBE,obj({'configured':BOOL}),['probe_head'],'选择SP4间距、tip/载荷并使既有校准失效;不伪装Pa压力或动态重建3D探针','configuration',example=PROBE_EXAMPLE)
|
| 123 |
+
cap('sample.load',SAMPLE,obj({'loaded':BOOL}),['sample_wafer'],'装载真实rho文献参考驱动的薄膜+基底;地图/膜厚/热参数明确宿主假设','configuration','evaluator',SAMPLE_EXAMPLE)
|
| 124 |
+
cap('standard.load',STANDARD,obj({'loaded':BOOL}),['sample_wafer'],'宿主装入独立给定实际Rs的薄膜标样代理,证书/NIST真实性未验证','configuration','evaluator',STANDARD_EXAMPLE)
|
| 125 |
+
cap('sample.remove',obj({}),obj({'loaded':BOOL}),['sample_wafer'],'卸除全部膜/基底质量和显热,既有测量与耗散账不回滚','configuration','evaluator')
|
| 126 |
+
cap('power.set',obj({'enabled':BOOL}),obj({'enabled':BOOL}),['power_switch','source_meter'],'整系统源与自动运动电源,2450额定精度预热状态随真实时间累计',example={'enabled':True})
|
| 127 |
+
cap('stage.move',POINT,obj({'target_x_m':number('m'),'target_y_m':number('m')}),['stage_x','sample_stage'],'安全抬针后移动真实XY机械坐标,测点坐标与样品台位移取反',example={'x_m':.01,'y_m':-.01})
|
| 128 |
+
cap('probe.set_contact',obj({'contact':BOOL}),obj({'target_m':number('m',0,PROBE_RAISED_M)}),['probe_head'],'有限速度下降接触或抬针,不跳跃针尖姿态',example={'contact':True})
|
| 129 |
+
cap('enclosure.set_open',obj({'opened':BOOL}),obj({'target_rad':number('rad',0,1.1)}),['hood'],'宿主手动暗箱翻盖有限速度代理,打开装样、关闭测量','simulation','evaluator',{'opened':False})
|
| 130 |
+
cap('map.configure',MAP,obj({'configured':BOOL,'accepted_points':dict(type='integer',minimum=0,maximum=14000,**{'x-unit':'1'}),'excluded_points':dict(type='integer',minimum=0,maximum=14000,**{'x-unit':'1'})}),['sample_stage','controller'],'最多14000自定义点及边缘排除;无导电厚度先验时仅报告Rs','configuration',example=MAP_EXAMPLE)
|
| 131 |
+
cap('method.configure',METHOD,obj({'configured':BOOL}),['source_meter','controller'],'AutoRange只首点逐档真试测,后续地图固定该电流;每点双接线正反四相≥1.2s','configuration',example=METHOD_EXAMPLE)
|
| 132 |
+
cap('calibration.start',obj({'reference_sheet_resistance_ohm_sq':number('ohm/sq',1e-12,1e15)}),obj({'operation_id':TEXT,'minimum_duration_s':number('s',180)}),['source_meter','probe_head','controller'],'外部给定标样值与真实4相观测决定校正;实际累计至少180s,换针后重做',example={'reference_sheet_resistance_ohm_sq':100.})
|
| 133 |
+
cap('calibration.clear',obj({}),obj({'calibrated':BOOL}),['controller'],'显式清除既有校正','configuration')
|
| 134 |
+
cap('acquisition.start',obj({}),obj({'operation_id':TEXT,'accepted_points':dict(type='integer',minimum=1,maximum=14000,**{'x-unit':'1'})}),['source_meter','stage_x','sample_stage','probe_head','controller'],'自动抬针/XY移动/下针/等待/首点量程/双接线正反四相,逐点建立实际地图')
|
| 135 |
+
cap('acquisition.stop',obj({}),obj({'phase':PHASE,'elapsed_s':number('s',0)}),['controller','source_meter','probe_head'],'切断激励、停止当前运动并保留完成点及已生热;不瞬移回零')
|
| 136 |
+
cap('acquisition.result',obj({}),RESULT,['controller'],'公开地图/统计/量程试测/原始VI,所有角色统一去除所选参考身份','query')
|
| 137 |
+
cap('analysis.sheet_resistance',ANALYSIS_INPUT,INFERENCE,['controller'],'仅外部VI/几何/校正反演Rs,rho必须有独立导电膜厚先验','analysis',example=ANALYSIS_EXAMPLE)
|
| 138 |
+
cap('provenance.read',obj({}),obj({'reference_id':nullable(TEXT),'template_source':nullable(TEXT),'evidence':TEXT}),['controller'],'仅宿主读取当前参考曲线或输入标样来源','query','evaluator')
|
| 139 |
+
LEDGER_UNITS=dict(mass_loaded_kg='kg',mass_present_kg='kg',mass_removed_kg='kg',mass_error_kg='kg',volume_loaded_m3='m^3',volume_present_m3='m^3',volume_removed_m3='m^3',volume_error_m3='m^3',source_input_j='J',sample_joule_j='J',contact_heat_export_j='J',electrical_error_j='J',ambient_heat_export_j='J',loaded_sensible_j='J',removed_sensible_j='J',thermal_stored_j='J',thermal_energy_error_j='J')
|
| 140 |
+
cap('ledger.read',obj({}),obj({k:number(u) for k,u in LEDGER_UNITS.items()}),['controller'],'薄膜/基底质量体积、被动温度、样品焦耳热/接触热外流账','query','evaluator')
|
| 141 |
+
cap('sim.step',obj({'dt_s':number('s',0,86400)}),obj({'time_s':number('s',0)}),['controller'],'唯一宿主时钟,有限自动运动、首点量程、180s校准、预热/采样/被动热','simulation','evaluator',{'dt_s':10.})
|
| 142 |
+
UNSUPPORTED=['hardware.connect','robot.load','temperature.tcr_control','measurement.thick_bulk_wafer','analysis.joint_unknown_thickness_and_resistivity','measurement.astm_certification','noise.empirical','accuracy.certification']
|
| 143 |
+
for k in UNSUPPORTED:cap(k,obj({}),obj({}),['controller'],'本配置未实现:'+k)
|
| 144 |
+
for k,c in [('plant.configured','controller'),('wafer.configured','sample_wafer'),('probe.configured','probe_head'),('sample.present','sample_wafer'),('power.enabled','power_switch'),('source.warmup_ready','source_meter'),('calibration.valid','controller'),('stage.moving','sample_stage')]:slot(k,BOOL,'1','当前配置/运行状态',component=c)
|
| 145 |
+
for k,u,z,c in [('stage.x_m','m','真实X台位置','stage_x'),('stage.y_m','m','真实Y台位置','sample_stage'),('stage.target_x_m','m','X台目标','stage_x'),('stage.target_y_m','m','Y台目标','sample_stage'),('probe.position_m','m','探针当前上提量;0接触','probe_head'),('probe.target_m','m','探针目标上提量;0接触','probe_head')]:slot(k,number(u,-.15,.15),u,z+';运动只随step改变','setpoint' if 'target' in k else 'scene',component=c)
|
| 146 |
+
slot('hood.angle_rad',number('rad',0,1.1),'rad','暗箱翻盖当前角,0闭合/1.1打开','scene',component='hood')
|
| 147 |
+
slot('hood.target_angle_rad',number('rad',0,1.1),'rad','暗箱翻盖目标角','setpoint',component='hood')
|
| 148 |
+
slot('power.angle_rad',number('rad',0,.28),'rad','电源开关姿态代理','scene',component='power_switch')
|
| 149 |
+
slot('source.warmup_elapsed_s',number('s',0,3600),'s','2450当前连续上电预热,3600s封顶;不构成额定准确度认证',component='source_meter')
|
| 150 |
+
slot('thermal.indicated_k',nullable(number('K')),'K','薄膜/基底及局部显式热容节点的量化温度,仅被动环境热交换','sensor',component='sample_wafer')
|
| 151 |
+
slot('measurement.selected_current_a',number('A',0,1),'A','本图首点AutoRange选定后固定的电流幅度','derived',component='source_meter')
|
| 152 |
+
slot('measured.current_a',nullable(number('A')),'A','2450实际电流经显式增益及厂家测量分辨率量化后的观测','sensor',component='source_meter')
|
| 153 |
+
slot('measured.voltage_v',nullable(number('V')),'V','四针输入电压增益/偏置/一阶响应及2450测量分辨率量化观测','sensor',component='source_meter')
|
| 154 |
+
slot('measurement.last_sheet_resistance_ohm_sq',nullable(number('ohm/sq')),'ohm/sq','最后实际完成点的几何修正Rs,未完���点不输出')
|
| 155 |
+
slot('display.sheet_resistance_ohm_sq',nullable(number('ohm/sq')),'ohm/sq','通电时PC显示最后已测点Rs;断电返回不可用,历史测量值仍保留')
|
| 156 |
+
slot('measurement.mean_sheet_resistance_ohm_sq',nullable(number('ohm/sq')),'ohm/sq','已完成地图点的算术平均Rs,非隐藏全图真值')
|
| 157 |
+
slot('calibration.gain',nullable(number('1')),'1','由外部参考Rs与实际观测比值形成的校正,换针失效')
|
| 158 |
+
slot('acquisition.phase',PHASE,'1','异步地图/校准运行状态')
|
| 159 |
+
slot('acquisition.stage',TEXT,'1','真实自动序列阶段:运动、接触、量程、四相、抬针')
|
| 160 |
+
slot('acquisition.points',{'type':'integer','minimum':0,'maximum':14000,'x-unit':'1'},'1','实际完成有效或失败测点行数')
|
| 161 |
+
slot('acquisition.elapsed_s',number('s',0),'s','当前作业实际宿主历时')
|
| 162 |
+
slot('clock.time_s',number('s',0),'s','唯一宿主时间')
|
| 163 |
+
for k,u,z in [('truth.sample_k','K','薄膜/基底集中节点真温'),('truth.sample_mass_kg','kg','薄膜及基底总质量'),('truth.conducting_thickness_m','m','隐藏导电膜厚,不等于基底厚度')]:slot(k,nullable(number(u)),u,z,'process_truth','evaluator','sample_wafer')
|
| 164 |
+
|
| 165 |
+
class SignatoneQuadpro2Runtime:
|
| 166 |
+
def __init__(self,instance_id='quadpro2_01'):
|
| 167 |
+
self.instance_id=instance_id;self.plant=self.wafer=self.probe=self.sample=self.record=None;self.sample_kind=None;self.map=None;self.accepted=[];self.excluded=[];self.method=copy.deepcopy(METHOD_EXAMPLE);self.power=False;self.power_started_ns=None;self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0
|
| 168 |
+
self.axes={k:dict(position=v,target=v,start=v,start_ns=0,arrival_ns=0) for k,v in [('x',0.),('y',0.),('z',PROBE_RAISED_M),('hood',1.1)]};self.x=np.zeros(6) # theta,voltage detector,sourceJ,sampleJ,contactJ,ambientJ
|
| 169 |
+
self.calibration_gain=None;self.phase='idle';self.stage='idle';self.operation_kind=None;self.operation_id=None;self.elapsed=0.;self.rows=[];self.auto_trials=[];self.selected_current=0.;self.error=None;self._counter=0;self._start_ns=0;self._event_ns=None;self._job_points=[];self._job_excluded=[];self._site=0;self._measure_phase=0;self._partial=[];self._auto_candidates=[];self._auto_index=0;self._auto_positive=None;self._calibration_reference=None;self._last_sheet=None
|
| 170 |
+
self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={};self._source=self._reference_id=None;self._evidence='no_sample';self._operation_source=None;self._operation_evidence='no_measurement';self.mass_loaded=self.mass_removed=self.volume_loaded=self.volume_removed=self.loaded_sensible=self.removed_sensible=0.
|
| 171 |
+
@property
|
| 172 |
+
def time_s(self):return self.time_ns/1e9
|
| 173 |
+
def register_principal(self,principal_id,visibility='agent'):
|
| 174 |
+
if not isinstance(principal_id,str) or not principal_id or principal_id in self._principals or visibility not in ('agent','debug','evaluator'):raise ActionRejected('REQUEST_CONFLICT')
|
| 175 |
+
self._principals[principal_id]=visibility
|
| 176 |
+
def session(self,principal_id):
|
| 177 |
+
if principal_id not in self._principals:raise ActionRejected('ACCESS_DENIED')
|
| 178 |
+
return SignatoneQuadpro2Session(self,principal_id)
|
| 179 |
+
def describe(self):return export_signatone_quadpro2_contract_metadata()
|
| 180 |
+
def _warmup(self):return min(WARMUP_S,(self.time_ns-self.power_started_ns)/1e9) if self.power and self.power_started_ns is not None else 0.
|
| 181 |
+
def _moving(self,key=None):return any(self.time_ns<self.axes[k]['arrival_ns'] for k in ([key] if key else ['x','y','z']))
|
| 182 |
+
def _raised(self):return self.axes['z']['position']>=PROBE_RAISED_M-1e-12 and not self._moving('z')
|
| 183 |
+
def _closed(self):return self.axes['hood']['position']<=1e-12 and self.axes['hood']['target']==0 and not self._moving('hood')
|
| 184 |
+
def _volume(self):return math.pi*(self.wafer['diameter_m']/2)**2*(self.wafer['substrate_thickness_m']+self.sample['conducting_thickness_m']) if self.sample else 0.
|
| 185 |
+
def _masses(self):
|
| 186 |
+
if not self.sample:return 0.,0.
|
| 187 |
+
A=math.pi*(self.wafer['diameter_m']/2)**2;return A*self.wafer['substrate_thickness_m']*self.sample['substrate_density_kg_m3'],A*self.sample['conducting_thickness_m']*self.sample['film_density_kg_m3']
|
| 188 |
+
def _mass(self):return sum(self._masses())
|
| 189 |
+
def _sample_capacity(self):
|
| 190 |
+
if not self.sample:return 0.
|
| 191 |
+
ms,mf=self._masses();return ms*self.sample['substrate_cp_j_kg_k']+mf*self.sample['film_cp_j_kg_k']
|
| 192 |
+
def _capacity(self):return (self.plant['local_thermal_capacity_j_k'] if self.plant else .1)+self._sample_capacity()
|
| 193 |
+
def _temperature(self):return self.plant['ambient_k']+float(self.x[0]) if self.plant else None
|
| 194 |
+
def _axis_speed(self,k):return self.plant['hood_speed_rad_s' if k=='hood' else 'z_speed_m_s' if k=='z' else 'xy_speed_m_s']
|
| 195 |
+
def _move(self,**targets):
|
| 196 |
+
for k,target in targets.items():
|
| 197 |
+
a=self.axes[k];a.update(target=target,start=a['position'],start_ns=self.time_ns,arrival_ns=self.time_ns+round(abs(target-a['position'])/self._axis_speed(k)*1e9))
|
| 198 |
+
def _stop_motion(self):
|
| 199 |
+
for k in ['x','y','z']:
|
| 200 |
+
a=self.axes[k];a.update(target=a['position'],start=a['position'],start_ns=self.time_ns,arrival_ns=self.time_ns)
|
| 201 |
+
def _set_stage(self,stage,wait_s=None):self.stage=stage;self._event_ns=self.time_ns+round(wait_s*1e9) if wait_s is not None else max(self.axes[k]['arrival_ns'] for k in ['x','y','z'])
|
| 202 |
+
def _point(self):return self._job_points[self._site] if self._job_points else dict(point_index=0,x_m=-self.axes['x']['position'],y_m=-self.axes['y']['position'])
|
| 203 |
+
def _electrically_active(self):return self.power and self.phase=='running' and self.stage in ('auto_positive','auto_negative','measure') and self.axes['z']['position']<=1e-12 and self._closed()
|
| 204 |
+
def _configuration(self):return 'a_14_23' if self.stage.startswith('auto') or self._measure_phase<2 else 'b_13_24'
|
| 205 |
+
def _requested_current(self):
|
| 206 |
+
if not self._electrically_active():return 0.
|
| 207 |
+
if self.stage.startswith('auto'):return self._auto_candidates[self._auto_index]*(1 if self.stage=='auto_positive' else -1)
|
| 208 |
+
return self.selected_current*(1 if self._measure_phase%2==0 else -1)
|
| 209 |
+
def _current_range(self,I=None):
|
| 210 |
+
value=abs(self._requested_current() if I is None else I);return next((v for v in CURRENT_RANGES if v>=value*(1-1e-12)),1.)
|
| 211 |
+
def _local_sheet(self,T):
|
| 212 |
+
if self.sample_kind=='standard':return self.sample['actual_sheet_resistance_ohm_sq'],T<363.15
|
| 213 |
+
raw=reference_rho(self.record,T,allow_invalid=True);p=self._point();R=self.wafer['diameter_m']/2;xx=p['x_m']/R;yy=p['y_m']/R;factor=1+self.sample['gradient_x_fraction']*xx+self.sample['gradient_y_fraction']*yy+self.sample['radial_fraction']*(xx*xx+yy*yy)
|
| 214 |
+
return raw[0]/self.sample['conducting_thickness_m']*factor,raw[1] and T<363.15
|
| 215 |
+
def _electrical(self,T=None):
|
| 216 |
+
if not self._electrically_active():return dict(current=0.,voltage=0.,source_voltage=0.,sample_power=0.,contact_power=0.,compliance=False,valid=True)
|
| 217 |
+
T=self._temperature() if T is None else T;Rs,valid=self._local_sheet(T);p=self._point();c=self._configuration();geo=(self.wafer['diameter_m'],self.probe['spacing_m'],p['x_m'],p['y_m']);K=disk_transfer_coefficient(*geo,c);drive=Rs*disk_drive_coefficient(*geo,c,self.plant['electrical_contact_radius_m']);contact=self.plant['current_contact_resistance_ohm'];total=drive+contact;requested=self._requested_current();I=math.copysign(min(abs(requested),self.method['voltage_compliance_v']/total,math.sqrt(20./total),.1 if self.method['voltage_compliance_v']>20 else 1.),requested)
|
| 218 |
+
return dict(current=I,voltage=I*Rs*K,source_voltage=I*total,sample_power=I*I*drive,contact_power=I*I*contact,compliance=abs(I-requested)>max(abs(requested)*1e-10,1e-18),valid=bool(valid))
|
| 219 |
+
def _observed(self,e=None):
|
| 220 |
+
if not self._electrically_active():return None,None
|
| 221 |
+
e=self._electrical() if e is None else e;v=float(self.x[1]);full=self.method['voltage_range_v'];qv=full*5e-7;qi=self._current_range()*1e-6;return float(round(e['current']*self.plant['current_gain']/qi)*qi),None if abs(v)>full else float(round(v/qv)*qv)
|
| 222 |
+
def _stats(self):
|
| 223 |
+
values=[x['sheet_resistance_ohm_sq'] for x in self.rows if x['sheet_resistance_ohm_sq'] is not None]
|
| 224 |
+
if not values:return dict(count=0,mean_ohm_sq=None,std_ohm_sq=None,minimum_ohm_sq=None,maximum_ohm_sq=None,relative_std_percent=None)
|
| 225 |
+
mean=float(np.mean(values));std=float(np.std(values));return dict(count=len(values),mean_ohm_sq=mean,std_ohm_sq=std,minimum_ohm_sq=min(values),maximum_ohm_sq=max(values),relative_std_percent=100*std/mean)
|
| 226 |
+
def read(self,role='evaluator'):
|
| 227 |
+
if role not in ('agent','debug','evaluator'):raise ActionRejected('ACCESS_DENIED')
|
| 228 |
+
current,voltage=self._observed();d={'plant.configured':self.plant is not None,'wafer.configured':self.wafer is not None,'probe.configured':self.probe is not None,'sample.present':self.sample is not None,'power.enabled':self.power,'source.warmup_ready':self._warmup()>=WARMUP_S,'calibration.valid':self.calibration_gain is not None,'stage.moving':self._moving(),'stage.x_m':self.axes['x']['position'],'stage.y_m':self.axes['y']['position'],'stage.target_x_m':self.axes['x']['target'],'stage.target_y_m':self.axes['y']['target'],'probe.position_m':self.axes['z']['position'],'probe.target_m':self.axes['z']['target'],'hood.angle_rad':self.axes['hood']['position'],'hood.target_angle_rad':self.axes['hood']['target'],'power.angle_rad':.28 if self.power else 0.,'source.warmup_elapsed_s':self._warmup(),'thermal.indicated_k':float(round(self._temperature()/self.plant['temperature_resolution_k'])*self.plant['temperature_resolution_k']) if self.plant else None,'measurement.selected_current_a':self.selected_current,'measured.current_a':current,'measured.voltage_v':voltage,'measurement.last_sheet_resistance_ohm_sq':self._last_sheet,'display.sheet_resistance_ohm_sq':self._last_sheet if self.power else None,'measurement.mean_sheet_resistance_ohm_sq':self._stats()['mean_ohm_sq'],'calibration.gain':self.calibration_gain,'acquisition.phase':self.phase,'acquisition.stage':self.stage,'acquisition.points':len(self.rows),'acquisition.elapsed_s':self.elapsed,'clock.time_s':self.time_s,'truth.sample_k':self._temperature(),'truth.sample_mass_kg':self._mass() if self.sample else None,'truth.conducting_thickness_m':self.sample['conducting_thickness_m'] if self.sample else None}
|
| 229 |
+
return {k:v for k,v in d.items() if role!='agent' or SLOTS[k]['visibility']=='agent'}
|
| 230 |
+
def _propagate(self,ns):
|
| 231 |
+
if not ns or not self.plant:return
|
| 232 |
+
dt=ns/1e9;p=self.plant;C=self._capacity();G=p['thermal_conductance_w_k']
|
| 233 |
+
if self._electrically_active():
|
| 234 |
+
def rhs(_t,y):
|
| 235 |
+
e=self._electrical(p['ambient_k']+y[0]);loss=G*y[0];return [(e['sample_power']-loss)/C,(p['voltage_gain']*e['voltage']+p['voltage_offset_v']-y[1])/p['voltage_response_tau_s'],e['current']*e['source_voltage'],e['sample_power'],e['contact_power'],loss]
|
| 236 |
+
sol=solve_ivp(rhs,(0.,dt),self.x,method='Radau',rtol=1e-10,atol=[1e-11,1e-13,1e-13,1e-13,1e-13,1e-12])
|
| 237 |
+
if not sol.success:raise RuntimeError('ELECTROTHERMAL_INTEGRATION_FAILED')
|
| 238 |
+
self.x=sol.y[:,-1]
|
| 239 |
+
else:
|
| 240 |
+
initial=self.x[0];self.x[0]*=math.exp(-G*dt/C);self.x[5]+=C*(initial-self.x[0]);self.x[1]*=math.exp(-dt/p['voltage_response_tau_s'])
|
| 241 |
+
def _ledger(self):
|
| 242 |
+
source,sample,contact,ambient=self.x[2:];stored=self._capacity()*float(self.x[0]);return dict(mass_loaded_kg=self.mass_loaded,mass_present_kg=self._mass(),mass_removed_kg=self.mass_removed,mass_error_kg=self.mass_loaded-self._mass()-self.mass_removed,volume_loaded_m3=self.volume_loaded,volume_present_m3=self._volume(),volume_removed_m3=self.volume_removed,volume_error_m3=self.volume_loaded-self._volume()-self.volume_removed,source_input_j=float(source),sample_joule_j=float(sample),contact_heat_export_j=float(contact),electrical_error_j=float(source-sample-contact),ambient_heat_export_j=float(ambient),loaded_sensible_j=self.loaded_sensible,removed_sensible_j=self.removed_sensible,thermal_stored_j=stored,thermal_energy_error_j=float(sample-ambient+self.loaded_sensible-self.removed_sensible-stored))
|
| 243 |
+
def _result(self):
|
| 244 |
+
if self.phase!='running' and self.operation_id in self.records:return copy.deepcopy(self.records[self.operation_id])
|
| 245 |
+
return dict(operation_id=self.operation_id,operation_kind=self.operation_kind,phase=self.phase,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),excluded_points=copy.deepcopy(self._job_excluded),auto_trials=copy.deepcopy(self.auto_trials),selected_current_a=self.selected_current,statistics=self._stats(),calibration_gain=self.calibration_gain,template_source=self._operation_source,evidence=self._operation_evidence,error_code=self.error)
|
| 246 |
+
def _finish(self,phase,error=None):
|
| 247 |
+
self.phase=phase;self.stage='idle';self.error=error;self._event_ns=None;self._stop_motion()
|
| 248 |
+
if self.operation_id:self.records[self.operation_id]=self._result()
|
| 249 |
+
def _capture(self):
|
| 250 |
+
e=self._electrical();I,V=self._observed(e);error='REFERENCE_TEMPERATURE_RANGE' if not e['valid'] else 'SOURCE_COMPLIANCE' if e['compliance'] else 'VOLTAGE_OVERFLOW' if V is None else None
|
| 251 |
+
return I,V,error,e
|
| 252 |
+
def _failure_row(self,error):
|
| 253 |
+
p=self._point();self.rows.append(dict(point_index=p['point_index'],x_m=p['x_m'],y_m=p['y_m'],time_s=self.elapsed,host_time_s=self.time_s,observations=copy.deepcopy(self._partial),sheet_resistance_ohm_sq=None,resistivity_ohm_m=None,configuration_disagreement_fraction=None,quality='unavailable',error_code=error));self._finish('failed',error)
|
| 254 |
+
def _begin_measure(self):
|
| 255 |
+
self._measure_phase=0;self._partial=[];dwell=max(self.method['phase_duration_s'],CALIBRATION_S/4) if self.operation_kind=='calibration' else self.method['phase_duration_s'];self._set_stage('measure',dwell)
|
| 256 |
+
def _begin_point(self):
|
| 257 |
+
self._partial=[];self._move(z=PROBE_RAISED_M);self._set_stage('raise')
|
| 258 |
+
def _advance_event(self):
|
| 259 |
+
if self.stage=='raise':
|
| 260 |
+
p=self._point();self._move(x=-p['x_m'],y=-p['y_m']);self._set_stage('move')
|
| 261 |
+
elif self.stage=='move':self._move(z=0.);self._set_stage('lower')
|
| 262 |
+
elif self.stage=='lower':self._set_stage('settle',self.method['settling_s'])
|
| 263 |
+
elif self.stage=='settle':
|
| 264 |
+
if self._site==0 and self.method['auto_current']:
|
| 265 |
+
self._auto_index=0;self._set_stage('auto_positive',.6)
|
| 266 |
+
else:self._begin_measure()
|
| 267 |
+
elif self.stage=='auto_positive':
|
| 268 |
+
self._auto_positive=self._capture();self._set_stage('auto_negative',.6)
|
| 269 |
+
elif self.stage=='auto_negative':
|
| 270 |
+
Ip,Vp,ep,physical_p=self._auto_positive;In,Vn,en,physical_n=self._capture();signal=None if Vp is None or Vn is None else abs(Vp-Vn)/2;current=self._auto_candidates[self._auto_index];self.auto_trials.append(dict(requested_current_a=current,measured_current_positive_a=Ip,measured_current_negative_a=In,voltage_positive_v=Vp,voltage_negative_v=Vn,reversal_signal_v=signal,time_s=self.elapsed,source_compliance=physical_p['compliance'] or physical_n['compliance']))
|
| 271 |
+
if ep or en:
|
| 272 |
+
previous=self.auto_trials[-2] if len(self.auto_trials)>1 else None
|
| 273 |
+
if (ep or en)=='REFERENCE_TEMPERATURE_RANGE' or previous is None or previous['reversal_signal_v'] is None or previous['reversal_signal_v']<=10*self.method['voltage_range_v']*5e-7:self._failure_row(ep or en);return
|
| 274 |
+
self.selected_current=previous['requested_current_a'];self._begin_measure()
|
| 275 |
+
elif signal<self.method['target_voltage_min_v'] and self._auto_index+1<len(self._auto_candidates):self._auto_index+=1;self._set_stage('auto_positive',.6)
|
| 276 |
+
else:
|
| 277 |
+
if signal is None or signal<=10*self.method['voltage_range_v']*5e-7:self._failure_row('AUTORANGE_UNRESOLVED');return
|
| 278 |
+
self.selected_current=self.auto_trials[-2]['requested_current_a'] if signal>self.method['target_voltage_max_v'] and len(self.auto_trials)>1 else current;self._begin_measure()
|
| 279 |
+
elif self.stage=='measure':
|
| 280 |
+
I,V,error,_e=self._capture()
|
| 281 |
+
if error:self._failure_row(error);return
|
| 282 |
+
self._partial.append(dict(configuration=self._configuration(),current_a=I,voltage_v=V,host_time_s=self.time_s));self._measure_phase+=1
|
| 283 |
+
if self._measure_phase<4:
|
| 284 |
+
self._set_stage('measure',max(self.method['phase_duration_s'],CALIBRATION_S/4) if self.operation_kind=='calibration' else self.method['phase_duration_s']);return
|
| 285 |
+
p=self._point();prior=None if self.operation_kind=='calibration' else self.map['thickness_prior_m'];args=dict(diameter_m=self.wafer['diameter_m'],spacing_m=self.probe['spacing_m'],x_m=p['x_m'],y_m=p['y_m'],observations=[{k:x[k] for k in OBS_INPUT['properties']} for x in self._partial],calibration_gain=1. if self.operation_kind=='calibration' else self.calibration_gain or 1.,thickness_prior_m=prior)
|
| 286 |
+
try:inferred=infer_sheet_resistance(**args)
|
| 287 |
+
except ActionRejected as exc:self._failure_row(str(exc));return
|
| 288 |
+
self.rows.append(dict(point_index=p['point_index'],x_m=p['x_m'],y_m=p['y_m'],time_s=self.elapsed,host_time_s=self.time_s,observations=copy.deepcopy(self._partial),sheet_resistance_ohm_sq=inferred['sheet_resistance_ohm_sq'],resistivity_ohm_m=inferred['resistivity_ohm_m'],configuration_disagreement_fraction=inferred['configuration_disagreement_fraction'],quality='estimated',error_code=None));self._last_sheet=inferred['sheet_resistance_ohm_sq']
|
| 289 |
+
if self.operation_kind=='calibration':
|
| 290 |
+
gain=self._calibration_reference/inferred['sheet_resistance_ohm_sq']
|
| 291 |
+
if not .1<=gain<=10:self._finish('failed','CALIBRATION_RANGE');return
|
| 292 |
+
self.calibration_gain=gain
|
| 293 |
+
self._move(z=PROBE_RAISED_M);self._set_stage('raise_after')
|
| 294 |
+
elif self.stage=='raise_after':
|
| 295 |
+
self._site+=1
|
| 296 |
+
if self._site>=len(self._job_points):self._finish('succeeded')
|
| 297 |
+
else:self._begin_point()
|
| 298 |
+
else:raise RuntimeError('UNKNOWN_SEQUENCE_STAGE')
|
| 299 |
+
def _filter_points(self,a):
|
| 300 |
+
accepted=[];excluded=[];R=self.wafer['diameter_m']/2
|
| 301 |
+
for i,p in enumerate(a['points']):
|
| 302 |
+
reason=None
|
| 303 |
+
if math.hypot(p['x_m'],p['y_m'])>R-a['edge_exclusion_m']+1e-12:reason='EDGE_EXCLUSION'
|
| 304 |
+
elif max(abs(p['x_m']),abs(p['y_m']))>.13:reason='STAGE_TRAVEL'
|
| 305 |
+
else:
|
| 306 |
+
try:disk_transfer_coefficient(self.wafer['diameter_m'],self.probe['spacing_m'],p['x_m'],p['y_m'],contact_radius_m=self.plant['electrical_contact_radius_m'])
|
| 307 |
+
except ActionRejected:reason='PROBE_FOOTPRINT_OUTSIDE_WAFER'
|
| 308 |
+
row=dict(point_index=i,**p)
|
| 309 |
+
if reason:excluded.append(dict(row,reason=reason))
|
| 310 |
+
else:accepted.append(row)
|
| 311 |
+
return accepted,excluded
|
| 312 |
+
def _load(self,a,standard):
|
| 313 |
+
if not self.plant or not self.wafer or not self.probe or self.sample or not self._raised() or self._moving() or self.axes['hood']['position']<1.0 or self._moving('hood') or max(abs(self.axes['x']['position']),abs(self.axes['y']['position']))>1e-12 or not a['accept_thin_layer_and_thermal_assumptions']:raise ActionRejected('PRECONDITION_FAILED')
|
| 314 |
+
if a['conducting_thickness_m']/self.probe['spacing_m']>.05:raise ActionRejected('THIN_LAYER_DOMAIN')
|
| 315 |
+
if standard:
|
| 316 |
+
if not a['accept_host_standard_not_certified']:raise ActionRejected('ASSUMPTION_NOT_ACCEPTED')
|
| 317 |
+
record=None
|
| 318 |
+
else:
|
| 319 |
+
if not a['accept_synthetic_map_and_bulk_reference']:raise ActionRejected('ASSUMPTION_NOT_ACCEPTED')
|
| 320 |
+
record=library().get(a['reference_id'])
|
| 321 |
+
if record is None:raise ActionRejected('UNKNOWN_REFERENCE')
|
| 322 |
+
if reference_rho(record,a['initial_temperature_k']) is None:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 323 |
+
old=self._capacity();self.sample=copy.deepcopy(a);self.sample_kind='standard' if standard else 'material';self.record=copy.deepcopy(record);new=self._capacity();delta=a['initial_temperature_k']-self.plant['ambient_k'];self.x[0]=(old*self.x[0]+(new-old)*delta)/new;self.loaded_sensible+=(new-old)*delta;self.mass_loaded+=self._mass();self.volume_loaded+=self._volume();self._reference_id=None if standard else a['reference_id'];self._source='host_input_thin_film_standard_no_certificate' if standard else json.dumps(record['source'],ensure_ascii=False,sort_keys=True);self._evidence='explicit_host_standard_and_thermal_assumptions' if standard else 'measured_literature_rho; assumed_bulk_to_thin_film_and_synthetic_spatial_map';return {'loaded':True}
|
| 324 |
+
def invoke(self,capability,**a):
|
| 325 |
+
if capability not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 326 |
+
validate(CAPS[capability]['input_schema'],a)
|
| 327 |
+
if capability in UNSUPPORTED:raise ActionRejected('UNSUPPORTED')
|
| 328 |
+
if capability=='analysis.sheet_resistance':return infer_sheet_resistance(**a)
|
| 329 |
+
if capability=='acquisition.result':return self._result()
|
| 330 |
+
if capability=='provenance.read':return dict(reference_id=self._reference_id,template_source=self._source,evidence=self._evidence)
|
| 331 |
+
if capability=='ledger.read':return self._ledger()
|
| 332 |
+
if capability=='sim.step':self.step(a['dt_s']);return {'time_s':self.time_s}
|
| 333 |
+
if self.phase=='running' and capability not in ('acquisition.stop','power.set'):raise ActionRejected('BUSY')
|
| 334 |
+
if capability=='plant.configure':
|
| 335 |
+
if self.plant or not a['accept_engineering']:raise ActionRejected('PRECONDITION_FAILED')
|
| 336 |
+
self.plant=copy.deepcopy(a);out={'configured':True}
|
| 337 |
+
elif capability=='wafer.configure':
|
| 338 |
+
if self.sample:raise ActionRejected('PRECONDITION_FAILED')
|
| 339 |
+
self.wafer=copy.deepcopy(a);self.map=None;self.accepted=[];self.excluded=[];out={'configured':True}
|
| 340 |
+
elif capability=='probe.configure':
|
| 341 |
+
if not self.plant or not self._raised() or self._moving() or self.axes['hood']['position']<1.0 or self._moving('hood'):raise ActionRejected('PRECONDITION_FAILED')
|
| 342 |
+
if self.sample and self.sample['conducting_thickness_m']/a['spacing_m']>.05:raise ActionRejected('THIN_LAYER_DOMAIN')
|
| 343 |
+
self.probe=copy.deepcopy(a);self.calibration_gain=None;self.map=None;self.accepted=[];self.excluded=[];out={'configured':True}
|
| 344 |
+
elif capability in ('sample.load','standard.load'):out=self._load(a,capability=='standard.load')
|
| 345 |
+
elif capability=='sample.remove':
|
| 346 |
+
if not self.sample or not self._raised() or self._moving() or self.axes['hood']['position']<1.0 or self._moving('hood') or max(abs(self.axes['x']['position']),abs(self.axes['y']['position']))>1e-12:raise ActionRejected('PRECONDITION_FAILED')
|
| 347 |
+
self.mass_removed+=self._mass();self.volume_removed+=self._volume();self.removed_sensible+=self._sample_capacity()*float(self.x[0]);self.sample=self.record=self.sample_kind=None;self._source=self._reference_id=None;self._evidence='no_sample';out={'loaded':False}
|
| 348 |
+
elif capability=='power.set':
|
| 349 |
+
if not a['enabled']:
|
| 350 |
+
if self.phase=='running':self._finish('cancelled','POWER_OFF')
|
| 351 |
+
else:self._stop_motion()
|
| 352 |
+
if self.power!=a['enabled']:self.power_started_ns=self.time_ns if a['enabled'] else None
|
| 353 |
+
self.power=a['enabled'];out={'enabled':self.power}
|
| 354 |
+
elif capability=='enclosure.set_open':
|
| 355 |
+
if not self.plant or self._moving() or not self._raised():raise ActionRejected('PRECONDITION_FAILED')
|
| 356 |
+
target=1.1 if a['opened'] else 0.;self._move(hood=target);out={'target_rad':target}
|
| 357 |
+
elif capability=='stage.move':
|
| 358 |
+
if not self.power or not self.plant or not self._raised() or self._moving('hood') or max(abs(a['x_m']),abs(a['y_m']))>.13:raise ActionRejected('STAGE_TRAVEL_OR_CLEARANCE')
|
| 359 |
+
self._move(x=a['x_m'],y=a['y_m']);out={'target_x_m':a['x_m'],'target_y_m':a['y_m']}
|
| 360 |
+
elif capability=='probe.set_contact':
|
| 361 |
+
if not self.power or not self.plant or self._moving('x') or self._moving('y') or self._moving('hood') or a['contact'] and (not self.sample or not self.probe or not self._closed()):raise ActionRejected('PRECONDITION_FAILED')
|
| 362 |
+
if a['contact']:disk_transfer_coefficient(self.wafer['diameter_m'],self.probe['spacing_m'],-self.axes['x']['position'],-self.axes['y']['position'],contact_radius_m=self.plant['electrical_contact_radius_m'])
|
| 363 |
+
target=0. if a['contact'] else PROBE_RAISED_M;self._move(z=target);out={'target_m':target}
|
| 364 |
+
elif capability=='map.configure':
|
| 365 |
+
if not self.wafer or not self.probe or not self.plant:raise ActionRejected('PRECONDITION_FAILED')
|
| 366 |
+
if a['edge_exclusion_m']>=self.wafer['diameter_m']/2:raise ActionRejected('EDGE_EXCLUSION_RANGE')
|
| 367 |
+
if a['edge_exclusion_m']+1e-12<max(0.,self.wafer['diameter_m']/2-.13):raise ActionRejected('STAGE_TRAVEL_ENVELOPE')
|
| 368 |
+
accepted,excluded=self._filter_points(a);self.map=copy.deepcopy(a);self.accepted=accepted;self.excluded=excluded;out={'configured':True,'accepted_points':len(accepted),'excluded_points':len(excluded)}
|
| 369 |
+
elif capability=='method.configure':
|
| 370 |
+
if a['voltage_compliance_v']>20 and a['current_max_a']>.1:raise ActionRejected('SOURCE_RANGE_ENVELOPE')
|
| 371 |
+
if a['current_min_a']>a['current_max_a'] or a['fixed_current_a']>a['current_max_a'] or a['target_voltage_min_v']>=a['target_voltage_max_v'] or a['target_voltage_max_v']>a['voltage_range_v']:raise ActionRejected('METHOD_RANGE')
|
| 372 |
+
if any(abs(a[k]*1e9-round(a[k]*1e9))>1e-4 for k in ['phase_duration_s','settling_s']):raise ActionRejected('TIME_GRID')
|
| 373 |
+
self.method=copy.deepcopy(a);out={'configured':True}
|
| 374 |
+
elif capability=='calibration.clear':self.calibration_gain=None;out={'calibrated':False}
|
| 375 |
+
elif capability in ('acquisition.start','calibration.start'):
|
| 376 |
+
if not self.power or not self.plant or not self.wafer or not self.probe or not self.sample or not self._closed() or self._moving():raise ActionRejected('PRECONDITION_FAILED')
|
| 377 |
+
if self.method['require_warmup'] and self._warmup()<WARMUP_S:raise ActionRejected('WARMUP_REQUIRED')
|
| 378 |
+
if self.sample_kind=='material' and reference_rho(self.record,self._temperature()) is None:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 379 |
+
if self._temperature()>=363.15:raise ActionRejected('PROBE_TEMPERATURE_RANGE')
|
| 380 |
+
if not self.plant['rear_triax_connected'] and (self.method['current_min_a']<1e-6 if self.method['auto_current'] else self._current_range(self.method['fixed_current_a'])<1e-6):raise ActionRejected('REAR_TRIAX_REQUIRED')
|
| 381 |
+
iscal=capability=='calibration.start'
|
| 382 |
+
if iscal and self.sample_kind!='standard':raise ActionRejected('STANDARD_REQUIRED')
|
| 383 |
+
if not iscal and (not self.map or not self.accepted):raise ActionRejected('MAP_REQUIRED')
|
| 384 |
+
if not iscal and self.method['require_calibration'] and self.calibration_gain is None:raise ActionRejected('CALIBRATION_REQUIRED')
|
| 385 |
+
if not self.method['auto_current'] and self.method['fixed_current_a']<=0:raise ActionRejected('ZERO_EXCITATION')
|
| 386 |
+
points=[dict(point_index=0,x_m=0.,y_m=0.)] if iscal else self.accepted
|
| 387 |
+
for p in points:disk_transfer_coefficient(self.wafer['diameter_m'],self.probe['spacing_m'],p['x_m'],p['y_m'],contact_radius_m=self.plant['electrical_contact_radius_m'])
|
| 388 |
+
self._counter+=1;self.operation_id=f'{self.instance_id}:acquisition:{self._counter}';self.operation_kind='calibration' if iscal else 'mapping';self._operation_source=self._source;self._operation_evidence=self._evidence;self.phase='running';self.elapsed=0.;self.rows=[];self.auto_trials=[];self.error=None;self._start_ns=self.time_ns;self._site=0;self._job_points=copy.deepcopy(points);self._job_excluded=[] if iscal else copy.deepcopy(self.excluded);self._calibration_reference=a['reference_sheet_resistance_ohm_sq'] if iscal else None;self._auto_candidates=[v for v in CURRENT_RANGES if self.method['current_min_a']<=v<=self.method['current_max_a']];q=self._current_range(self.method['fixed_current_a'])*5e-5;self.selected_current=0. if self.method['auto_current'] else float(round(self.method['fixed_current_a']/q)*q);self._begin_point();out={'operation_id':self.operation_id,'minimum_duration_s':CALIBRATION_S} if iscal else {'operation_id':self.operation_id,'accepted_points':len(points)}
|
| 389 |
+
elif capability=='acquisition.stop':
|
| 390 |
+
if self.phase!='running':raise ActionRejected('NOT_RUNNING')
|
| 391 |
+
self._finish('cancelled','USER_CANCEL');out={'phase':self.phase,'elapsed_s':self.elapsed}
|
| 392 |
+
else:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 393 |
+
self.revision+=1;return copy.deepcopy(out)
|
| 394 |
+
def step(self,dt_s):
|
| 395 |
+
validate(number('s',0,86400),dt_s);total=math.fsum((self._clock_remainder_ns,dt_s*1e9));ns=round(total);self._clock_remainder_ns=total-ns
|
| 396 |
+
if not ns:return
|
| 397 |
+
end=self.time_ns+ns
|
| 398 |
+
while self.time_ns<end:
|
| 399 |
+
boundary=end
|
| 400 |
+
for k in self.axes:
|
| 401 |
+
if self._moving(k):boundary=min(boundary,self.axes[k]['arrival_ns'])
|
| 402 |
+
if self.phase=='running':boundary=min(boundary,self._event_ns)
|
| 403 |
+
self._propagate(boundary-self.time_ns);self.time_ns=boundary
|
| 404 |
+
if self.plant:
|
| 405 |
+
for k,a in self.axes.items():a['position']=a['target'] if self.time_ns>=a['arrival_ns'] else a['start']+math.copysign(self._axis_speed(k)*(self.time_ns-a['start_ns'])/1e9,a['target']-a['start'])
|
| 406 |
+
if self.phase=='running':
|
| 407 |
+
self.elapsed=(self.time_ns-self._start_ns)/1e9
|
| 408 |
+
if self.time_ns==self._event_ns:self._advance_event()
|
| 409 |
+
self.revision+=1
|
| 410 |
+
|
| 411 |
+
class SignatoneQuadpro2Session:
|
| 412 |
+
def __init__(self, host, principal_id): self._host = host; self._principal = principal_id
|
| 413 |
+
@property
|
| 414 |
+
def _role(self): return self._host._principals[self._principal]
|
| 415 |
+
def _target(self, instance_id):
|
| 416 |
+
if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 417 |
+
def describe(self, *, instance_id=None, asset_type_id=None):
|
| 418 |
+
if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT')
|
| 419 |
+
if instance_id is not None: self._target(instance_id)
|
| 420 |
+
if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 421 |
+
meta = export_signatone_quadpro2_contract_metadata()
|
| 422 |
+
return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'})
|
| 423 |
+
def read(self, *, instance_id, state_ids=None):
|
| 424 |
+
self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids
|
| 425 |
+
if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT')
|
| 426 |
+
if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED')
|
| 427 |
+
return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids})
|
| 428 |
+
def _filter_result(self, result):
|
| 429 |
+
result = copy.deepcopy(result)
|
| 430 |
+
# A bridge may dispatch agent-visible capabilities through a privileged
|
| 431 |
+
# session. Public acquisition payloads therefore use the SAME redaction
|
| 432 |
+
# for every role. Full provenance has its own evaluator-only capability.
|
| 433 |
+
if 'rows' in result and 'template_source' in result:
|
| 434 |
+
result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None
|
| 435 |
+
result['evidence'] = 'observed_four_probe_VI_with_finite_disk_thin_layer_and_explicit_synthetic_map_assumptions; selected template details require evaluator provenance.read' if result['operation_id'] is not None else 'no_measurement'
|
| 436 |
+
return result
|
| 437 |
+
def invoke(self, *, instance_id, capability_id, arguments, request_id):
|
| 438 |
+
h=self._host
|
| 439 |
+
try:
|
| 440 |
+
self._target(instance_id)
|
| 441 |
+
if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 442 |
+
if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED')
|
| 443 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 444 |
+
validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False)
|
| 445 |
+
if key in h._requests:
|
| 446 |
+
old,response=h._requests[key]
|
| 447 |
+
if old!=digest: raise ActionRejected('REQUEST_CONFLICT')
|
| 448 |
+
return copy.deepcopy(response)
|
| 449 |
+
if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 450 |
+
if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 451 |
+
result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id in ('acquisition.start','calibration.start') else None
|
| 452 |
+
if operation: h._owners[operation]=self._principal
|
| 453 |
+
response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None)
|
| 454 |
+
h._requests[key]=(digest,copy.deepcopy(response)); return response
|
| 455 |
+
except ActionRejected as exc:
|
| 456 |
+
return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none'))
|
| 457 |
+
def write(self, *, instance_id, state_id, value, request_id):
|
| 458 |
+
self._target(instance_id); entry=SLOTS.get(state_id)
|
| 459 |
+
if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED')
|
| 460 |
+
capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id)
|
| 461 |
+
def poll(self, operation_id):
|
| 462 |
+
h=self._host
|
| 463 |
+
if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 464 |
+
result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id)
|
| 465 |
+
if result is None: raise ActionRejected('UNKNOWN_OPERATION')
|
| 466 |
+
return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result))
|
| 467 |
+
def cancel(self, operation_id, request_id):
|
| 468 |
+
self.poll(operation_id); h=self._host
|
| 469 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 470 |
+
key=(self._principal,request_id)
|
| 471 |
+
if key in h._cancel_operations:
|
| 472 |
+
if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT')
|
| 473 |
+
return copy.deepcopy(h._requests[key][1])
|
| 474 |
+
if key in h._requests: raise ActionRejected('REQUEST_CONFLICT')
|
| 475 |
+
if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING')
|
| 476 |
+
result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id)
|
| 477 |
+
if result['status']=='succeeded': h._cancel_operations[key]=operation_id
|
| 478 |
+
return result
|
| 479 |
+
|
| 480 |
+
EFFECTS={
|
| 481 |
+
'plant.configure':['plant.configured','thermal.indicated_k','truth.sample_k'],
|
| 482 |
+
'wafer.configure':['wafer.configured'],
|
| 483 |
+
'probe.configure':['probe.configured','calibration.valid','calibration.gain'],
|
| 484 |
+
'sample.load':['sample.present','thermal.indicated_k','truth.sample_k','truth.sample_mass_kg','truth.conducting_thickness_m'],
|
| 485 |
+
'standard.load':['sample.present','thermal.indicated_k','truth.sample_k','truth.sample_mass_kg','truth.conducting_thickness_m'],
|
| 486 |
+
'sample.remove':['sample.present','truth.sample_mass_kg','truth.conducting_thickness_m'],
|
| 487 |
+
'power.set':['display.sheet_resistance_ohm_sq','power.enabled','power.angle_rad','source.warmup_ready','source.warmup_elapsed_s','stage.moving','stage.target_x_m','stage.target_y_m','probe.target_m','acquisition.phase','acquisition.stage','measured.current_a','measured.voltage_v'],
|
| 488 |
+
'stage.move':['stage.target_x_m','stage.target_y_m','stage.moving'],
|
| 489 |
+
'probe.set_contact':['probe.target_m','stage.moving'],
|
| 490 |
+
'enclosure.set_open':['hood.target_angle_rad'],
|
| 491 |
+
'calibration.clear':['calibration.valid','calibration.gain'],
|
| 492 |
+
'acquisition.start':['acquisition.phase','acquisition.stage','acquisition.elapsed_s','acquisition.points','measurement.mean_sheet_resistance_ohm_sq','measurement.selected_current_a','probe.target_m','stage.moving','measured.current_a','measured.voltage_v'],
|
| 493 |
+
'calibration.start':['acquisition.phase','acquisition.stage','acquisition.elapsed_s','acquisition.points','measurement.mean_sheet_resistance_ohm_sq','measurement.selected_current_a','probe.target_m','stage.moving','measured.current_a','measured.voltage_v'],
|
| 494 |
+
'acquisition.stop':['acquisition.phase','acquisition.stage','stage.moving','stage.target_x_m','stage.target_y_m','probe.target_m','measured.current_a','measured.voltage_v'],
|
| 495 |
+
'sim.step':list(SLOTS)}
|
| 496 |
+
for k,v in EFFECTS.items():CAPS[k]['effects']=v
|
| 497 |
+
ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'POWER_OFF','USER_CANCEL','SOURCE_COMPLIANCE','VOLTAGE_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','CALIBRATION_RANGE','AUTORANGE_UNRESOLVED'})
|
| 498 |
+
|
| 499 |
+
def export_signatone_quadpro2_contract_metadata():
|
| 500 |
+
slots={};caps={}
|
| 501 |
+
for k,v in SLOTS.items():slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; QuadPro2-DAC0/Keithley2450/SP4; thin conducting film on insulating circular substrate, passive thermal boundary.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'SignatoneQuadpro2Session.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Motion/electrothermal/warmup/sample clocks advance only with host step. Measurements record endpoint after explicit settled positive/negative current dwell.'),source_ids=['simulation_assumption'])
|
| 502 |
+
limits=[
|
| 503 |
+
'固定QuadPro2-DAC0:D为Keithley2450,A自动型,C300mm晶片,0无TCR;不是用其它源表参数替代,基础配置没有主动温控。SP4几何默认50085TRQ(1.27mm、85gf/针、WC、40.64µm tip radius、Q适配)。',
|
| 504 |
+
'wafer直径10至300mm。默认100mm直径、0.5mm绝缘基底上1µm导电膜;导电厚度/密度/Cp/空间分布是宿主假设。geometry.configure式变形未实现,wafer.configure/probe.configure改变过程几何不自动重建静态3D示例。',
|
| 505 |
+
'导电层厚度必须不超过针距5%,采用二维薄片模型;0.5mm基底厚度不能被当成导电厚度。厚块晶片、体硅有限厚度、有限接触电流场、各向异性张量未实现。',
|
| 506 |
+
'电气接触半径是独立宿主工程输入,不等于厂家针尖球面曲率半径。点源Green用于电压探针;驱动电阻在实际电流接触处按声明接触半径截断对数奇点,附加接触阻抗导热至外界。',
|
| 507 |
+
'有限圆片绝缘边界采用Neumann Green同号镜像:g(z,a)=ln(|z-a|/R)+ln|1-z*conj(a)/R²|;源汇差的法向导数在圆周为零。中心大圆极限Rs=(π/ln2)V/I;用Smits1958表及独立边界/互易性检查,不宣称复刻ASTM或厂商内部算法。',
|
| 508 |
+
'每点两接线A=I14/V23、B=I13/V24,各正负电流共4次端点观测。这里明确实现这两种接线与圆片校正,不假称已验证OEM Dual Configuration具体私有处理。',
|
| 509 |
+
'库提供64种真实实验数字化rho(T),独立插值且限制原论文有效温域;无真实二维map、薄膜厚度或薄膜尺寸效应数据。rho由bulk方向参考转换为薄膜是明确假设。',
|
| 510 |
+
'空间梯度/径向项仅局部均匀近似:以测点附近Rs标量缩放均匀圆盘Green,不是解非均匀电导全域PDE,输出地图标synthetic spatial assumption。',
|
| 511 |
+
'反演仅使用观察到的±I/±V及几何/外部校正,先得到每配置Rs再平均;提供额外厚度先验才计算rho=Rs*t_prior。不同时从同一VI反演未知rho和未知厚度。',
|
| 512 |
+
'AutoRange只在每幅图的第一个接受测点按实际正反试测逐档寻找电流;全部后续site固定同一选定电流,不每点重新量程。自定义地图最多14000点,不采用另一页5至1400摘要限制;冲突在source_evidence。',
|
| 513 |
+
'4相每相至少0.3s,总电测驻留至少1.2s/点,外加真实抬针、XY、下针和settling;首点每个AutoRange档还要实际1.2s。不能用host大dt把这些时长省略。',
|
| 514 |
+
'SP4换针使校准失效。calibration.start用宿主装入的薄膜标样和单独输入参考Rs,实际四相每相至少45s、合计180s,再加移动/量程;增益仅由外部参考/观测比值得出。不把厂家VLSI508µm硅标准硬套本薄膜模型,也不冒充实际NIST证书。',
|
| 515 |
+
'Keithley2450源电流档10nA至1A,每档源分辨率FS*5e-5、观测电流分辨率FS*1e-6;电压观测档20mV至200V,分辨率FS*5e-7。工程增益/偏置/τ不代表厂家精度或噪声分布。10/100nA档明确要求rear triax配置。',
|
| 516 |
+
'源量程与电压观测档分离;源compliance≤20V档可至1A,>20V至200V档最多100mA,并同时≤20W;compliance至少源电压档10%;达到compliance/功率限制时实际I下降,电能依实际端压/电流累计并标观测失败,不能组合1A和200V。未利用105%过量程能力。',
|
| 517 |
+
'Signatone D系统原表10µΩ至100MΩ只写Ω,未明确Ω/sq;本模型不把它偷换成面电阻硬范围。输入标样1e-12至1e15Ω/sq仅工程数值域,反演要求正有限,实际读数可解析性由2450电流/电压档、分辨率和compliance限制。',
|
| 518 |
+
'2450到额定精度需真实3600s连续上电,warmup状态真实累计。默认require_warmup=False为工程估算,设True会在3600s前拒绝测量/校准;任何模式均不承诺OEM额定精度或系统<1%。',
|
| 519 |
+
'本几何工程XY行程±130mm;300mm片的圆形采区须至少20mm边缘排除,属于当前结构代理的安全域而非厂家限制。所有四针接点还须在边界内;被排除点有原因,不伪装为实际测量。',
|
| 520 |
+
'机械stage实际位移=-测点坐标,固定世界探针落到wafer指定点;针抬起后才能XY,暗箱合上测量。取消/断电在当前姿态停止,不瞬移归零;仅已完成点输出,热量和质量留账。',
|
| 521 |
+
'膜与基底共被动集中热节点,局部附加热容由宿主输入(默认0.1J/K,非整机218kg或夹具质量热容)。源电能=样品焦耳热+接触热外流;载入/移出两种材料质量体积和当前显热明确守恒。',
|
| 522 |
+
'所有Session公开result/poll均隐藏所选参考身份,内部evaluator转发同样脱敏;privileged provenance.read单独访问。共享Python/磁盘不是OS隔离。',
|
| 523 |
+
'真实仪器、机器人装样、TCR温控、真实标样证书/漂移/OEM准确度、完整非均匀PDE和厚晶片计量、急停硬件电路not_run。']
|
| 524 |
+
for k,v in CAPS.items():
|
| 525 |
+
un=k in UNSUPPORTED;async_=k in ('acquisition.start','calibration.start');caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']}
|
| 526 |
+
caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.signatone_quadpro2.SignatoneQuadpro2Session.invoke',invocation=f'session.invoke(instance_id="quadpro2_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='运行入口原子核对薄层/参考温域、选型、暗箱/针尖/移动安全域、量程、校准与可选预热。',state_ids=['power.enabled','sample.present','probe.position_m','hood.angle_rad','calibration.valid','source.warmup_ready','acquisition.phase'],enforced_by='runtime',check='SignatoneQuadpro2Runtime.invoke guards before commit')],state_effects=[dict(state_id=s,timing='immediate',description_zh='命令实际即时状态变化') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='仅输出独立可绑定状态;真实姿态/显示联动由场景报告取证。',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='真实>=180s校准4相及抬针完成' if k=='calibration.start' else '所有接受点依真实运动/等待/首点量程/四相测量后抬针完成' if async_ else '原子命令;物理推进仅由宿主step',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','xy_stage','sp4_probe','keithley2450_source_meter'],partial_failure_zh='取消/断电截断激励并停当前XY/Z,保留已测点、完成的试量程及已积耗散/显热;不能回滚样品质量或已生热。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('POWER_OFF','USER_CANCEL','SOURCE_COMPLIANCE','VOLTAGE_OVERFLOW','REFERENCE_TEMPERATURE_RANGE','AUTORANGE_UNRESOLVED') else 'none') for e in ERRORS],verification=[],limitations=limits,source_ids=['manufacturer_primary','simulation_assumption','template_library'])
|
| 527 |
+
if k in ('stage.move','probe.set_contact','enclosure.set_open','acquisition.start','calibration.start','power.set'):
|
| 528 |
+
caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='宿主推进有限运动、真实等待、热量、预热与逐点观测') for s in SLOTS if s not in v['effects'] and s not in ('plant.configured','wafer.configured','probe.configured','sample.present','power.enabled')]
|
| 529 |
+
mechanism=dict(component_ids=['controller','source_meter','stage_x','sample_stage','probe_head','sample_wafer','hood'],state_ids=list(slots),meaning_zh='有限圆片薄膜四探针Green几何、首点固定图量程、实际标样反演校准、双接线正反测绘与被动电热质量账',implementation='lumped',equations=[
|
| 530 |
+
'g(z,a)=ln(|z-a|/R)+ln|1-z*conj(a)/R²|; phi(z)=-(Rs*I/(2*pi))*(g(z,a_source)-g(z,a_sink)). For a source/sink pair the circular boundary has zero normal current. V=phi(c)-phi(d).',
|
| 531 |
+
'For center collinear equally-spaced probes and R/s→infinity, K=ln(2)/pi and Rs=(pi/ln2)*V/I. Finite disk K is evaluated per site/configuration, not an arbitrary edge multiplier.',
|
| 532 |
+
'Configurations A=(source1,sink4,V2-V3),B=(source1,sink3,V2-V4). Rtransfer=(Vpositive-Vnegative)/(Ipositive-Inegative); Rs_config=calibration_gain*Rtransfer/K_config; Rs is the mean of two configurations.',
|
| 533 |
+
'rho_output=Rs*thickness_prior only when an independent thickness prior is supplied; no thickness is inferred from a single four-probe resistance experiment.',
|
| 534 |
+
'Rs_forward(T,x,y)=rho_reference(T)/t_film * [1+gx*x/R+gy*y/R+gr*(x²+y²)/R²]. This is an explicitly local homogeneous approximation to a synthetic spatial profile, not a global nonuniform-conductivity PDE solve.',
|
| 535 |
+
'Rdrive regularizes the same Green source potentials at a declared finite current-contact radius. Iactual=sign(Irequested)*min(abs(Irequested),Vcompliance/(Rdrive+Rcontact),sqrt(20W/(Rdrive+Rcontact)),Isource_range_max), where range max is1A for compliance<=20V and0.1A for>20V through200V; measurement voltage range is independent.',
|
| 536 |
+
'Psource=Iactual²*(Rdrive+Rcontact); Psample=Iactual²*Rdrive; Pcontact_export=Iactual²*Rcontact. Ctotal*dT/dt=Psample-G*(T-Ta); Ctotal=Clocal+mfilm*Cpfilm+msubstrate*Cpsubstrate.',
|
| 537 |
+
'Detector dz/dt=(gain*V+offset-z)/tau, observed voltage/current follow declared2450 resolution steps; source resolutionFS*5e-5, measured IFS*1e-6 and measured VFS*5e-7.',
|
| 538 |
+
'Motion axes advance with explicit finite speed. Stage_xy=-sample_point_xy. Each point spends4*dwell>=1.2s measuring plus motion/settling; initial auto-range trials each use1.2s before locking current for entire map.',
|
| 539 |
+
'Calibration waits4*max(dwell,45s)>=180s and obtains gain=external_standard_Rs/observed_uncorrected_Rs. No hidden gain or reference material property is read by inverse.',
|
| 540 |
+
'Only host step advances axes, powerup3600s warmup clock, sequence events and electrothermal ODE. Fractional nanoseconds carry across normal60Hz floating timesteps. Samples carry independently ledgered sensible heat when loaded or removed.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=limits)
|
| 541 |
+
spec=importlib.util.spec_from_file_location('_quadpro_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'four_probe_mapping':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'wafer.configure':(WAFER,WAFER_EXAMPLE),'probe.configure':(PROBE,PROBE_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'standard.load':(STANDARD,STANDARD_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE),'map.configure':(MAP,MAP_EXAMPLE)})
|
| 542 |
+
for key,value in SLOTS.items():slots[key]['meaning_zh']=value['meaning']
|
| 543 |
+
return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'four_probe_mapping':mechanism})
|
scripts/asset_runtime/zwick_hit5p.py
ADDED
|
@@ -0,0 +1,418 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""HIT5P / ISO179 .5J: real-time nonlinear pendulum and observed empty correction.
|
| 2 |
+
Manual raising / host catching are external engineering actions, not OEM motors.
|
| 3 |
+
"""
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
import copy,importlib.util,json,math
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import numpy as np
|
| 8 |
+
from scipy.integrate import solve_ivp
|
| 9 |
+
PROTOCOL_VERSION='1.0.0';SLUG='zwick_hit5p';ASSET_TYPE_ID='instrument.'+SLUG;CATALOG_ID='CHEM-145'
|
| 10 |
+
ROOT=Path(__file__).resolve().parents[2];ASSET=ROOT/'assets/expansion_batch04/t1_thermal'/SLUG;LIBRARY_PATH=ASSET/'impact_library.json'
|
| 11 |
+
RELEASE_ANGLE_RAD=math.radians(135.72);ENCODER_RESOLUTION_RAD=math.radians(.018);NOMINAL_ENERGY_J=.5;STRIKE_RADIUS_M=.25;NOMINAL_SPEED_M_S=2.9
|
| 12 |
+
GRAVITY_COEFFICIENT_NM=NOMINAL_ENERGY_J/(1-math.cos(RELEASE_ANGLE_RAD));INERTIA_KG_M2=2*NOMINAL_ENERGY_J/(NOMINAL_SPEED_M_S/STRIKE_RADIUS_M)**2;SUPPORT_SPAN_M=.062
|
| 13 |
+
class ActionRejected(ValueError):pass
|
| 14 |
+
|
| 15 |
+
def number(unit='1',lo=None,hi=None):
|
| 16 |
+
s={'type':'number','x-unit':unit}
|
| 17 |
+
if lo is not None:s['minimum']=lo
|
| 18 |
+
if hi is not None:s['maximum']=hi
|
| 19 |
+
return s
|
| 20 |
+
|
| 21 |
+
def obj(properties):return dict(type='object',properties=properties,required=list(properties),additionalProperties=False)
|
| 22 |
+
def nullable(s):return {'anyOf':[s,{'type':'null'}]}
|
| 23 |
+
def array(s,minimum=0,maximum=200001):return dict(type='array',items=s,minItems=minimum,maxItems=maximum)
|
| 24 |
+
def enum(items):return {'type':'string','enum':items}
|
| 25 |
+
BOOL={'type':'boolean'};TEXT={'type':'string'};PHASE=enum(['idle','running','succeeded','cancelled','failed'])
|
| 26 |
+
|
| 27 |
+
def validate(s,v):
|
| 28 |
+
if 'anyOf' in s:
|
| 29 |
+
for o in s['anyOf']:
|
| 30 |
+
try:validate(o,v);return
|
| 31 |
+
except ActionRejected:pass
|
| 32 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 33 |
+
k=s.get('type')
|
| 34 |
+
if k in ('number','integer'):
|
| 35 |
+
if isinstance(v,bool) or not isinstance(v,(int,float)) or not math.isfinite(v) or k=='integer' and type(v) is not int or not s.get('minimum',-math.inf)<=v<=s.get('maximum',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 36 |
+
elif k=='object':
|
| 37 |
+
if not isinstance(v,dict) or set(v)!=set(s['properties']):raise ActionRejected('INVALID_ARGUMENT')
|
| 38 |
+
for key,value in v.items():validate(s['properties'][key],value)
|
| 39 |
+
elif k=='array':
|
| 40 |
+
if not isinstance(v,list) or not s.get('minItems',0)<=len(v)<=s.get('maxItems',math.inf):raise ActionRejected('INVALID_ARGUMENT')
|
| 41 |
+
for x in v:validate(s['items'],x)
|
| 42 |
+
elif k=='boolean' and type(v) is not bool:raise ActionRejected('INVALID_ARGUMENT')
|
| 43 |
+
elif k=='string' and not isinstance(v,str):raise ActionRejected('INVALID_ARGUMENT')
|
| 44 |
+
elif k=='null' and v is not None:raise ActionRejected('INVALID_ARGUMENT')
|
| 45 |
+
if 'enum' in s and v not in s['enum']:raise ActionRejected('INVALID_ARGUMENT')
|
| 46 |
+
|
| 47 |
+
def library():return {r['id']:r for r in json.loads(LIBRARY_PATH.read_text())['templates']}
|
| 48 |
+
def encoder(angle):return round(angle/ENCODER_RESOLUTION_RAD)*ENCODER_RESOLUTION_RAD
|
| 49 |
+
PLANT_EXAMPLE=dict(ambient_k=296.15,friction_torque_nm=.001,host_raise_speed_rad_s=1.,shield_speed_rad_s=2.,bearing_heat_capacity_j_k=5.,bearing_conductance_w_k=.2,local_sample_heat_capacity_j_k=.01,sample_conductance_w_k=.03,sample_heat_fraction=.8,accept_engineering=True)
|
| 50 |
+
PLANT=obj(dict(ambient_k=number('K',273.15,323.15),friction_torque_nm=number('N*m',0,.1),host_raise_speed_rad_s=number('rad/s',.01,2),shield_speed_rad_s=number('rad/s',.01,5),bearing_heat_capacity_j_k=number('J/K',.001,1e5),bearing_conductance_w_k=number('W/K',1e-9,1e4),local_sample_heat_capacity_j_k=number('J/K',1e-6,100),sample_conductance_w_k=number('W/K',1e-9,1e4),sample_heat_fraction=number('1',0,1),accept_engineering=BOOL))
|
| 51 |
+
FIXTURE_EXAMPLE=dict(standard='ISO179_Charpy',pendulum_energy_j=.5,strike_radius_m=.25,support_span_m=.062,release_angle_rad=RELEASE_ANGLE_RAD,accept_effective_inertia=True)
|
| 52 |
+
FIXTURE=obj(dict(standard=enum(['ISO179_Charpy']),pendulum_energy_j=dict(type='number',enum=[.5],**{'x-unit':'J'}),strike_radius_m=dict(type='number',enum=[.25],**{'x-unit':'m'}),support_span_m=dict(type='number',enum=[.062],**{'x-unit':'m'}),release_angle_rad=dict(type='number',enum=[RELEASE_ANGLE_RAD],**{'x-unit':'rad'}),accept_effective_inertia=BOOL))
|
| 53 |
+
SAMPLE_EXAMPLE=dict(reference_id='basf_ultradur_b4520',notch='A',length_m=.08,width_m=.01,thickness_m=.004,notch_depth_m=.002,volume_m3=3.192e-6,mass_kg=.00415,specific_heat_capacity_j_kg_k=1200.,initial_temperature_k=296.15,temperature_tolerance_k=2.,host_charpy_strength_j_m2=None,behavior='energy_threshold',no_break_restitution=.2,accept_reference_transfer_and_fracture_proxy=True)
|
| 54 |
+
SAMPLE=obj(dict(reference_id=TEXT,notch=enum(['A','unnotched']),length_m=number('m',.063,.15),width_m=number('m',.001,.03),thickness_m=number('m',.0005,.02),notch_depth_m=number('m',0,.025),volume_m3=number('m^3',1e-10,.001),mass_kg=number('kg',1e-7,.2),specific_heat_capacity_j_kg_k=number('J/(kg*K)',1,1e5),initial_temperature_k=number('K',200,400),temperature_tolerance_k=number('K',0,30),host_charpy_strength_j_m2=nullable(number('J/m^2',1,1e7)),behavior=enum(['energy_threshold','unbreakable_proxy']),no_break_restitution=number('1',0,1),accept_reference_transfer_and_fracture_proxy=BOOL))
|
| 55 |
+
METHOD_EXAMPLE=dict(sample_interval_s=.002,timeout_s=10.,remaining_area_prior_m2=3.2e-5)
|
| 56 |
+
METHOD=obj(dict(sample_interval_s=number('s',.001,.1),timeout_s=number('s',2,60),remaining_area_prior_m2=nullable(number('m^2',1e-12,.1))))
|
| 57 |
+
ROW=obj(dict(point_index={'type':'integer','x-unit':'1'},time_s=number('s'),encoder_angle_rad=nullable(number('rad')),kind=enum(['sample','impact','apex']),broken=BOOL))
|
| 58 |
+
VALIDITY=enum(['not_completed','valid','below_working_range','above_working_range','no_break','invalid_speed','temperature_invalid','negative_corrected_energy'])
|
| 59 |
+
ANALYSIS=obj(dict(release_angle_rad=number('rad',0,math.pi),rebound_angle_rad=number('rad',-math.pi,math.pi),friction_torque_nm=number('N*m',0,1),remaining_area_prior_m2=nullable(number('m^2',1e-12,.1)),outcome=enum(['break','no_break'])))
|
| 60 |
+
ANALYSIS_OUTPUT=obj(dict(raw_energy_j=number('J'),corrected_energy_j=number('J'),impact_strength_j_m2=nullable(number('J/m^2')),validity=VALIDITY,evidence=TEXT))
|
| 61 |
+
RESULT=obj(dict(operation_id=nullable(TEXT),phase=PHASE,mode=TEXT,elapsed_s=number('s'),rows=array(ROW),release_angle_rad=nullable(number('rad')),rebound_angle_rad=nullable(number('rad')),raw_energy_j=nullable(number('J')),corrected_energy_j=nullable(number('J')),impact_strength_j_m2=nullable(number('J/m^2')),observed_impact_speed_m_s=nullable(number('m/s')),outcome=enum(['pending','empty','break','no_break']),validity=VALIDITY,terminal_reason=nullable(TEXT),template_source=nullable(TEXT),evidence=TEXT))
|
| 62 |
+
LEDGER_KEYS=['loaded_mass_kg','removed_mass_kg','sample_mass_kg','mass_residual_kg','loaded_volume_m3','removed_volume_m3','sample_volume_m3','volume_residual_m3','host_work_j','pendulum_kinetic_j','pendulum_potential_j','friction_heat_j','bearing_thermal_j','bearing_heat_export_j','sample_absorbed_j','sample_heat_j','sample_damage_stored_j','sample_thermal_j','sample_heat_export_j','sensible_loaded_j','sensible_removed_j','internal_removed_j','energy_residual_j']
|
| 63 |
+
LEDGER=obj({k:number('kg' if k.endswith('_kg') else 'm^3' if k.endswith('_m3') else 'J') for k in LEDGER_KEYS})
|
| 64 |
+
CAPS={}
|
| 65 |
+
def cap(k,s,o,e,c,meaning,visibility='agent',kind='device_command'):CAPS[k]=dict(input_schema=s,output_schema=o,example_arguments=e,component_ids=[c],function_zh=meaning,visibility=visibility,kind=kind,effects=[])
|
| 66 |
+
for k,s,e,c in [('plant.configure',PLANT,PLANT_EXAMPLE,'pendulum'),('fixture.configure',FIXTURE,FIXTURE_EXAMPLE,'fixture_base'),('method.configure',METHOD,METHOD_EXAMPLE,'controller')]:cap(k,s,obj(dict(configured=BOOL)),e,c,'配置工程过程、固定ISO179 .5J/62mm夹具或真实观测采样方法','agent' if k=='method.configure' else 'evaluator','configuration')
|
| 67 |
+
cap('sample.load',SAMPLE,obj(dict(present=BOOL)),SAMPLE_EXAMPLE,'sample_left','载入Charpy真实参考及显式温度/几何/破坏代理','evaluator')
|
| 68 |
+
cap('sample.remove',obj({}),obj(dict(removed_mass_kg=number('kg'),removed_volume_m3=number('m^3'))),{},'sample_left','取出整条或全部收集碎片,带走质量/显热/损伤能','evaluator')
|
| 69 |
+
cap('power.set',obj(dict(enabled=BOOL)),obj(dict(enabled=BOOL)),dict(enabled=True),'power_switch','启停电子显示/记录;掉电不删除自由摆机械能')
|
| 70 |
+
cap('shield.set_open',obj(dict(opened=BOOL)),obj(dict(target_angle_rad=number('rad'))),dict(opened=True),'shield','宿主有限速开合已选可选Charpy局部防碎片罩','evaluator')
|
| 71 |
+
cap('pendulum.raise',obj({}),obj(dict(target_angle_rad=number('rad'))),{},'pendulum','外部手动抬摆有限速代理;非HIT5P电机或自动回摆','evaluator')
|
| 72 |
+
cap('pendulum.catch',obj({}),obj(dict(requested=BOOL)),{},'pendulum','请求宿主在下一实际转折点接住,非仪器自带刹车','evaluator')
|
| 73 |
+
cap('calibration.start',obj({}),obj(dict(operation_id=TEXT)),{},'latch','真实空摆至首个回升峰值,以量化角度估计有效摩擦')
|
| 74 |
+
cap('calibration.clear',obj({}),obj(dict(valid=BOOL)),{},'controller','清除摩擦校正,不改变机械物理')
|
| 75 |
+
cap('acquisition.start',obj({}),obj(dict(operation_id=TEXT)),{},'latch','机械释放后的有限时间Charpy冲击和真实角度记录')
|
| 76 |
+
cap('acquisition.stop',obj({}),obj(dict(phase=PHASE,elapsed_s=number('s'))),{},'controller','只停记录,自由摆/撞击/摩擦仍随step继续,不回滚损伤')
|
| 77 |
+
cap('acquisition.result',obj({}),RESULT,{},'controller','公开角色统一去选中材料身份的能量与破坏状态','agent','query')
|
| 78 |
+
cap('analysis.impact',ANALYSIS,ANALYSIS_OUTPUT,dict(release_angle_rad=RELEASE_ANGLE_RAD,rebound_angle_rad=-1.8,friction_torque_nm=.001,remaining_area_prior_m2=3.2e-5,outcome='break'),'controller','从外部量化角度/独立面积先验反演J与J/m²,非Izod J/m','agent','analysis')
|
| 79 |
+
cap('ledger.read',obj({}),LEDGER,{},'controller','受限机械/热/损伤/质量体积账','evaluator','query')
|
| 80 |
+
cap('provenance.read',obj({}),obj(dict(current_sample=nullable(TEXT),operation_source=nullable(TEXT))),{},'controller','受限当前和已启动操作来源快照','evaluator','query')
|
| 81 |
+
cap('sim.step',obj(dict(dt_s=number('s',0,86400))),obj(dict(time_s=number('s'))),dict(dt_s=.02),'controller','唯一宿主时间推进','evaluator','simulation')
|
| 82 |
+
UNSUPPORTED={'hardware.connect':'无真实仪器通信','robot.load':'无机器人装样或机械抓取验证','measurement.izod':'选ISO179 Charpy,未配Izod','measurement.tensile_impact':'未配拉伸冲击夹具/摆锤','measurement.instrumented_force':'无仪器化锤/高速力电子学','pendulum.oem_motor_return':'本HIT5P配置无已证自动回摆','brake.oem_disc':'本HIT5P无已配盘式制动','thermal.set_temperature':'未选冷却/加热附件','accuracy.certification':'没有标准认证或实测噪声数据'}
|
| 83 |
+
for k,v in UNSUPPORTED.items():cap(k,obj({}),obj({}),{},'controller',v)
|
| 84 |
+
SLOTS={}
|
| 85 |
+
def slot(k,s,u,o,c,meaning,vis='agent'):SLOTS[k]=dict(schema=s,unit=u,origin=o,component=c,meaning=meaning,visibility=vis,write=None)
|
| 86 |
+
slot('clock.time_s',number('s'),'s','derived','controller','唯一宿主时钟,read不推进')
|
| 87 |
+
for k in ['plant.configured','fixture.configured','method.configured','sample.present','sample.broken','sample.spent','power.enabled','pendulum.held','latch.engaged','catch.requested','calibration.valid']:slot(k,BOOL,'1','derived','controller','配置/样品/机械边界状态;不是硬件安全认证')
|
| 88 |
+
slot('pendulum.angle_rad',number('rad'),'rad','scene','pendulum','精确场景角:0竖下,+135.72°释放侧;世界轴−Y,受限不可绕过encoder','evaluator')
|
| 89 |
+
slot('pendulum.target_angle_rad',number('rad'),'rad','setpoint','pendulum','外部手动抬摆目标,不代表已到达')
|
| 90 |
+
slot('encoder.angle_rad',nullable(number('rad')),'rad','sensor','controller','0.018°量化角度,分辨率不代表准确度或随机噪声')
|
| 91 |
+
for k in ['shield.angle_rad','shield.target_angle_rad']:slot(k,number('rad'),'rad','scene' if '.angle' in k else 'setpoint','shield','局部可选防碎片罩角度,0闭合/1.1打开')
|
| 92 |
+
slot('latch.position_m',number('m'),'m','scene','latch','释放锁扣显示代理,0在正释放角锁入/.004退出,非实测锁扣运动')
|
| 93 |
+
slot('power.angle_rad',number('rad'),'rad','scene','power_switch','电子电源显示姿态0/.28')
|
| 94 |
+
slot('fragments.offset_m',number('m'),'m','scene','sample_right','破断后两半视觉分離示意.006m,不是碎片弹道或新增能量','evaluator')
|
| 95 |
+
slot('calibration.friction_torque_nm',nullable(number('N*m')),'N*m','derived','controller','由实际空摆量化α/β求等效Coulomb摩擦,非隐藏plant参数')
|
| 96 |
+
slot('measurement.energy_j',nullable(number('J')),'J','sensor','controller','最后外部角度反演校正吸能,量程有效性另读validity;掉电不亮')
|
| 97 |
+
slot('measurement.validity',VALIDITY,'1','derived','controller','当前测量有效性,.5J所选工作范围.05.. .4J')
|
| 98 |
+
slot('acquisition.phase',PHASE,'1','derived','controller','异步记录状态,完成/取消不等于机械停摆')
|
| 99 |
+
slot('acquisition.elapsed_s',number('s'),'s','derived','controller','记录实际时间')
|
| 100 |
+
slot('acquisition.points',{'type':'integer','x-unit':'1'},'1','derived','controller','采样及明确impact/apex事件行数')
|
| 101 |
+
for k,u in [('truth.angular_velocity_rad_s','rad/s'),('truth.sample_absorbed_j','J'),('truth.sample_temperature_k','K'),('truth.bearing_temperature_k','K'),('truth.sample_mass_kg','kg')]:slot(k,number(u),u,'process_truth','pendulum','受限非线性摆锤/热库存真值','evaluator')
|
| 102 |
+
|
| 103 |
+
def analyze_impact(release_angle_rad,rebound_angle_rad,friction_torque_nm,remaining_area_prior_m2,outcome):
|
| 104 |
+
alpha=abs(release_angle_rad);beta=abs(rebound_angle_rad);raw=GRAVITY_COEFFICIENT_NM*(math.cos(beta)-math.cos(alpha));corrected=raw-friction_torque_nm*(alpha+beta)
|
| 105 |
+
validity='negative_corrected_energy' if corrected<0 else 'below_working_range' if corrected<.05 else 'above_working_range' if corrected>.4 else 'no_break' if outcome=='no_break' else 'valid'
|
| 106 |
+
return dict(raw_energy_j=raw,corrected_energy_j=corrected,impact_strength_j_m2=corrected/remaining_area_prior_m2 if remaining_area_prior_m2 is not None and validity=='valid' else None,validity=validity,evidence='external_quantized_angles_and_empty_swing_correction; independent_remaining_area_prior; ISO179_J_per_m2_not_Izod_J_per_m; not_certified_standard_compliance')
|
| 107 |
+
|
| 108 |
+
class ZwickHit5pRuntime:
|
| 109 |
+
def __init__(self,instance_id='hit_01'):
|
| 110 |
+
self.instance_id=instance_id;self.time_ns=0;self._clock_remainder_ns=0.;self.revision=0;self.power=False;self.plant=None;self.fixture=None;self.method=None;self.sample=None;self.reference=None;self.source=None
|
| 111 |
+
self.theta=0.;self.omega=0.;self.mechanical='held';self.raise_target=0.;self._raise_start_ns=0;self._raise_end_ns=0;self._raise_angle0=0.;self._raise_started=False;self._raise_rate=0.;self.shield=1.1;self.shield_target=1.1;self.shield_start=1.1;self.shield_start_ns=0;self.shield_end_ns=0;self.catch_requested=False;self._segment=None;self._pending_impact=False;self._first_apex=False
|
| 112 |
+
self.broken=False;self.spent=False;self.absorbed=0.;self.damage=0.;self.bearing_U=0.;self.sample_U=0.;self.calibration=None;self.phase='idle';self.operation_id=None;self.mode='none';self.elapsed=0.;self.rows=[];self._counter=0;self.terminal_reason=None;self._operation_source=None;self._release_observed=None;self._rebound_observed=None;self._observed_speed=None;self._outcome='pending';self._validity='not_completed';self._analysis=None;self.last_energy=None;self.records={};self._principals={};self._requests={};self._owners={};self._cancel_operations={}
|
| 113 |
+
self.book={k:0. for k in ['loaded_mass_kg','removed_mass_kg','loaded_volume_m3','removed_volume_m3','host_work_j','friction_heat_j','bearing_heat_export_j','sample_absorbed_j','sample_heat_j','sample_heat_export_j','sensible_loaded_j','sensible_removed_j','internal_removed_j']}
|
| 114 |
+
@property
|
| 115 |
+
def time_s(self):return self.time_ns/1e9
|
| 116 |
+
def register_principal(self,name,visibility):
|
| 117 |
+
if not isinstance(name,str) or not name or visibility not in ('agent','evaluator','debug') or name in self._principals:raise ActionRejected('INVALID_ARGUMENT')
|
| 118 |
+
self._principals[name]=visibility
|
| 119 |
+
def session(self,name):
|
| 120 |
+
if name not in self._principals:raise ActionRejected('ACCESS_DENIED')
|
| 121 |
+
return ZwickHit5pSession(self,name)
|
| 122 |
+
def _mass(self):return self.sample['mass_kg'] if self.sample else 0.
|
| 123 |
+
def _capacity(self):return self.plant['local_sample_heat_capacity_j_k']+(self._mass()*self.sample['specific_heat_capacity_j_kg_k'] if self.sample else 0.)
|
| 124 |
+
def _temperature(self):return self.plant['ambient_k']+self.sample_U/self._capacity() if self.plant else 296.15
|
| 125 |
+
def _energy(self):return .5*INERTIA_KG_M2*self.omega**2+GRAVITY_COEFFICIENT_NM*(1-math.cos(self.theta))
|
| 126 |
+
def _latch(self):return self.mechanical=='held' and abs(self.theta-RELEASE_ANGLE_RAD)<1e-10
|
| 127 |
+
def _shield_moving(self):return self.time_ns<self.shield_end_ns
|
| 128 |
+
def _temperature_valid(self):
|
| 129 |
+
if not self.sample:return True
|
| 130 |
+
t=self._temperature();ref=self.reference.get('reference_temperature_K');domain=self.reference.get('valid_temperature_range_K');tol=self.sample['temperature_tolerance_k']
|
| 131 |
+
return (ref is None or abs(t-ref)<=tol+1e-9) and (not domain or abs(domain[1]-domain[0])<1e-9 or domain[0]<=t<=domain[1]) and abs(t-self.sample['initial_temperature_k'])<=tol+1e-9
|
| 132 |
+
def read(self,visibility='agent'):
|
| 133 |
+
d={'clock.time_s':self.time_s,'plant.configured':self.plant is not None,'fixture.configured':self.fixture is not None,'method.configured':self.method is not None,'sample.present':self.sample is not None,'sample.broken':self.broken,'sample.spent':self.spent,'power.enabled':self.power,'pendulum.held':self.mechanical=='held','latch.engaged':self._latch(),'catch.requested':self.catch_requested,'calibration.valid':self.calibration is not None,'pendulum.angle_rad':self.theta,'pendulum.target_angle_rad':self.raise_target,'encoder.angle_rad':encoder(self.theta) if self.power else None,'shield.angle_rad':self.shield,'shield.target_angle_rad':self.shield_target,'latch.position_m':0. if self._latch() else .004,'power.angle_rad':.28 if self.power else 0.,'fragments.offset_m':.006 if self.broken and self.sample else 0.,'calibration.friction_torque_nm':self.calibration,'measurement.energy_j':self.last_energy if self.power else None,'measurement.validity':self._validity,'acquisition.phase':self.phase,'acquisition.elapsed_s':self.elapsed,'acquisition.points':len(self.rows),'truth.angular_velocity_rad_s':self.omega,'truth.sample_absorbed_j':self.absorbed,'truth.sample_temperature_k':self._temperature(),'truth.bearing_temperature_k':self.plant['ambient_k']+self.bearing_U/self.plant['bearing_heat_capacity_j_k'] if self.plant else 296.15,'truth.sample_mass_kg':self._mass()}
|
| 134 |
+
return {k:copy.deepcopy(v) for k,v in d.items() if visibility!='agent' or SLOTS[k]['visibility']=='agent'}
|
| 135 |
+
def ledger(self):
|
| 136 |
+
b=copy.deepcopy(self.book);m=self._mass();v=self.sample['volume_m3'] if self.sample else 0.;b.update(sample_mass_kg=m,mass_residual_kg=b['loaded_mass_kg']-b['removed_mass_kg']-m,sample_volume_m3=v,volume_residual_m3=b['loaded_volume_m3']-b['removed_volume_m3']-v,pendulum_kinetic_j=.5*INERTIA_KG_M2*self.omega**2,pendulum_potential_j=GRAVITY_COEFFICIENT_NM*(1-math.cos(self.theta)),bearing_thermal_j=self.bearing_U,sample_damage_stored_j=self.damage,sample_thermal_j=self.sample_U)
|
| 137 |
+
b['energy_residual_j']=b['host_work_j']+b['sensible_loaded_j']-b['sensible_removed_j']-b['internal_removed_j']-b['bearing_heat_export_j']-b['sample_heat_export_j']-self._energy()-self.bearing_U-self.sample_U-self.damage;return b
|
| 138 |
+
def _record(self,kind='sample'):
|
| 139 |
+
self.rows.append(dict(point_index=len(self.rows),time_s=self.time_s,encoder_angle_rad=encoder(self.theta) if self.power else None,kind=kind,broken=self.broken))
|
| 140 |
+
def _finish(self,phase,reason):
|
| 141 |
+
self.phase=phase;self.terminal_reason=reason
|
| 142 |
+
if self.operation_id:self.records[self.operation_id]=self._result(use_cache=False)
|
| 143 |
+
def _result(self,use_cache=True):
|
| 144 |
+
if use_cache and self.phase!='running' and self.operation_id in self.records:return copy.deepcopy(self.records[self.operation_id])
|
| 145 |
+
a=self._analysis or {};return dict(operation_id=self.operation_id,phase=self.phase,mode=self.mode,elapsed_s=self.elapsed,rows=copy.deepcopy(self.rows),release_angle_rad=self._release_observed,rebound_angle_rad=self._rebound_observed,raw_energy_j=a.get('raw_energy_j'),corrected_energy_j=a.get('corrected_energy_j'),impact_strength_j_m2=a.get('impact_strength_j_m2'),observed_impact_speed_m_s=self._observed_speed,outcome=self._outcome,validity=self._validity,terminal_reason=self.terminal_reason,template_source=self._operation_source,evidence='synthetic_forward_model; actual_quantized_encoder_trajectory; ISO179_manufacturer_material_reference_plus_explicit_energy_threshold_no_break_thermal_transfer_assumptions; not_native_material_curve')
|
| 146 |
+
def _cool(self,dt,bearing_power=0.):
|
| 147 |
+
if not self.plant:return
|
| 148 |
+
C=self.plant['bearing_heat_capacity_j_k'];G=self.plant['bearing_conductance_w_k'];old=self.bearing_U;new=old*math.exp(-G*dt/C)+bearing_power*C/G*(-math.expm1(-G*dt/C));self.bearing_U=new;self.book['bearing_heat_export_j']+=old+bearing_power*dt-new
|
| 149 |
+
C=self._capacity();G=self.plant['sample_conductance_w_k'];old=self.sample_U;self.sample_U=old*math.exp(-G*dt/C);self.book['sample_heat_export_j']+=old-self.sample_U
|
| 150 |
+
def _new_segment(self):
|
| 151 |
+
if self.mechanical!='free':return
|
| 152 |
+
torque=self.plant['friction_torque_nm'];gravity=-GRAVITY_COEFFICIENT_NM*math.sin(self.theta)
|
| 153 |
+
if abs(self.omega)<1e-10 and abs(gravity)<=torque+1e-12:self.omega=0.;self.mechanical='held';self.catch_requested=False;self._segment=None;return
|
| 154 |
+
direction=math.copysign(1,self.omega if abs(self.omega)>1e-10 else gravity);C_b=self.plant['bearing_heat_capacity_j_k'];G_b=self.plant['bearing_conductance_w_k'];C_s=self._capacity();G_s=self.plant['sample_conductance_w_k']
|
| 155 |
+
def rhs(t,y):
|
| 156 |
+
P=torque*direction*y[1];return [y[1],(-GRAVITY_COEFFICIENT_NM*math.sin(y[0])-torque*direction)/INERTIA_KG_M2,P,P-G_b*y[3]/C_b,-G_s*y[4]/C_s,G_b*y[3]/C_b,G_s*y[4]/C_s]
|
| 157 |
+
event_kind='impact' if self._pending_impact else 'apex'
|
| 158 |
+
def event(t,y):return y[0] if event_kind=='impact' else y[1]
|
| 159 |
+
event.terminal=True;event.direction=-1 if event_kind=='impact' or direction>0 else 1
|
| 160 |
+
y0=np.array([self.theta,self.omega,0.,self.bearing_U,self.sample_U,0.,0.]);sol=solve_ivp(rhs,[0,10],y0,events=event,dense_output=True,method='DOP853',rtol=2e-12,atol=2e-14,max_step=.02)
|
| 161 |
+
if not sol.success or not len(sol.t_events[0]):raise RuntimeError('Pendulum event integration failed')
|
| 162 |
+
duration=float(sol.t_events[0][0]);end=self.time_ns+max(1,round(duration*1e9));self._segment=dict(start_ns=self.time_ns,end_ns=end,duration=duration,solution=sol.sol,last_y=y0,event=event_kind)
|
| 163 |
+
def _propagate_free(self,nxt):
|
| 164 |
+
s=self._segment;t=s['duration'] if nxt==s['end_ns'] else (nxt-s['start_ns'])/1e9;y=s['solution'](t);old=s['last_y'];self.theta=float(y[0]);self.omega=float(y[1]);self.book['friction_heat_j']+=float(y[2]-old[2]);self.bearing_U=float(y[3]);self.sample_U=float(y[4]);self.book['bearing_heat_export_j']+=float(y[5]-old[5]);self.book['sample_heat_export_j']+=float(y[6]-old[6]);s['last_y']=y
|
| 165 |
+
def _physical_impact(self):
|
| 166 |
+
self.theta=0.;self._pending_impact=False;self._first_apex=True
|
| 167 |
+
if self.phase=='running':
|
| 168 |
+
previous=[r for r in self.rows if r['kind']=='sample' and r['encoder_angle_rad'] is not None][-2:]
|
| 169 |
+
if len(previous)==2:self._observed_speed=abs((previous[-1]['encoder_angle_rad']-previous[-2]['encoder_angle_rad'])/(previous[-1]['time_s']-previous[-2]['time_s']))*STRIKE_RADIUS_M
|
| 170 |
+
self._record('impact')
|
| 171 |
+
if self.sample and not self.spent:
|
| 172 |
+
available=.5*INERTIA_KG_M2*self.omega**2;required=self.break_energy
|
| 173 |
+
if required is not None and available>=required:
|
| 174 |
+
lost=required;self.omega=-math.sqrt(max(0,2*(available-lost)/INERTIA_KG_M2));self.broken=True;self._outcome='break'
|
| 175 |
+
else:
|
| 176 |
+
retained=available*self.sample['no_break_restitution']**2;lost=available-retained;self.omega=math.sqrt(max(0,2*retained/INERTIA_KG_M2));self._outcome='no_break'
|
| 177 |
+
heat=lost*self.plant['sample_heat_fraction'];self.absorbed+=lost;self.book['sample_absorbed_j']+=lost;self.book['sample_heat_j']+=heat;self.sample_U+=heat;self.damage+=lost-heat;self.spent=True
|
| 178 |
+
else:
|
| 179 |
+
if self.phase=='running':self._outcome='empty'
|
| 180 |
+
if abs(self.omega)<1e-10:self.mechanical='held';self._physical_apex()
|
| 181 |
+
def _physical_apex(self):
|
| 182 |
+
self.omega=0.
|
| 183 |
+
if self._first_apex:
|
| 184 |
+
self._first_apex=False
|
| 185 |
+
if self.phase=='running':
|
| 186 |
+
self._rebound_observed=encoder(self.theta);self._record('apex')
|
| 187 |
+
if self.mode=='calibration':
|
| 188 |
+
alpha=abs(self._release_observed);beta=abs(self._rebound_observed);estimate=GRAVITY_COEFFICIENT_NM*(math.cos(beta)-math.cos(alpha))/(alpha+beta)
|
| 189 |
+
if estimate<0:self._finish('failed','INVALID_EMPTY_SWING')
|
| 190 |
+
else:self.calibration=estimate;self._validity='valid';self._analysis=analyze_impact(alpha,beta,estimate,None,'no_break');self._finish('succeeded','empty_swing_completed')
|
| 191 |
+
else:
|
| 192 |
+
self._analysis=analyze_impact(self._release_observed,self._rebound_observed,self.calibration,self.method['remaining_area_prior_m2'],self._outcome);self._validity=self._analysis['validity'];self.last_energy=self._analysis['corrected_energy_j']
|
| 193 |
+
if not self._temperature_valid():self._validity='temperature_invalid';self._analysis['impact_strength_j_m2']=None
|
| 194 |
+
elif self._observed_speed is None or not 2.9*.9<=self._observed_speed<=2.9*1.1:self._validity='invalid_speed';self._analysis['impact_strength_j_m2']=None
|
| 195 |
+
self._finish('succeeded' if self._validity in ('valid','no_break') else 'failed',self._validity)
|
| 196 |
+
if self.catch_requested:self.mechanical='held';self.catch_requested=False
|
| 197 |
+
self._segment=None
|
| 198 |
+
def invoke(self,capability_id,**arguments):
|
| 199 |
+
if capability_id not in CAPS:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 200 |
+
validate(CAPS[capability_id]['input_schema'],arguments);k=capability_id;a=copy.deepcopy(arguments)
|
| 201 |
+
if k in UNSUPPORTED:raise ActionRejected('UNSUPPORTED')
|
| 202 |
+
if k=='acquisition.result':return self._result()
|
| 203 |
+
if k=='ledger.read':return self.ledger()
|
| 204 |
+
if k=='provenance.read':return dict(current_sample=self.source,operation_source=self._operation_source)
|
| 205 |
+
if k=='analysis.impact':return analyze_impact(**a)
|
| 206 |
+
if k=='sim.step':self.step(a['dt_s']);return dict(time_s=self.time_s)
|
| 207 |
+
if self.phase=='running' and k not in ('acquisition.stop','power.set','pendulum.catch'):raise ActionRejected('BUSY')
|
| 208 |
+
if k=='plant.configure':
|
| 209 |
+
if self.plant or self.power or self.sample:raise ActionRejected('PLANT_ALREADY_CONFIGURED')
|
| 210 |
+
if not a['accept_engineering']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED')
|
| 211 |
+
if a['bearing_heat_capacity_j_k']/a['bearing_conductance_w_k']<.001 or a['local_sample_heat_capacity_j_k']/a['sample_conductance_w_k']<.001:raise ActionRejected('THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN')
|
| 212 |
+
self.plant=a;out=dict(configured=True)
|
| 213 |
+
elif k=='fixture.configure':
|
| 214 |
+
if self.sample or self.mechanical!='held':raise ActionRejected('SAMPLE_PRESENT_OR_MOVING')
|
| 215 |
+
if not a['accept_effective_inertia']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED')
|
| 216 |
+
self.fixture=a;self.calibration=None;out=dict(configured=True)
|
| 217 |
+
elif k=='method.configure':
|
| 218 |
+
nanos=a['sample_interval_s']*1e9
|
| 219 |
+
if abs(nanos-round(nanos))>1e-4:raise ActionRejected('SAMPLING_GRID_RESOLUTION')
|
| 220 |
+
self.method=a;out=dict(configured=True)
|
| 221 |
+
elif k=='sample.load':
|
| 222 |
+
if not self.plant or not self.fixture:raise ActionRejected('CONFIGURATION_REQUIRED')
|
| 223 |
+
if self.sample:raise ActionRejected('SAMPLE_PRESENT')
|
| 224 |
+
if not self._latch() or self.shield<1.1-1e-12 or self._shield_moving():raise ActionRejected('LOADING_GEOMETRY')
|
| 225 |
+
if not a['accept_reference_transfer_and_fracture_proxy']:raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED')
|
| 226 |
+
if a['notch_depth_m']>=a['width_m'] or a['notch']=='unnotched' and a['notch_depth_m']!=0 or a['notch']=='A' and a['notch_depth_m']<=0:raise ActionRejected('INVALID_NOTCH_GEOMETRY')
|
| 227 |
+
if a['volume_m3']>a['length_m']*a['width_m']*a['thickness_m']+1e-12:raise ActionRejected('INVALID_VOLUME')
|
| 228 |
+
ref=library().get(a['reference_id'])
|
| 229 |
+
if ref is None:raise ActionRejected('UNKNOWN_REFERENCE')
|
| 230 |
+
nominal=ref.get('reference_temperature_K');domain=ref.get('valid_temperature_range_K');T=a['initial_temperature_k'];tol=a['temperature_tolerance_k']
|
| 231 |
+
if nominal is not None and abs(T-nominal)>tol+1e-9 or domain and domain[1]-domain[0]>1e-9 and not domain[0]<=T<=domain[1]:raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 232 |
+
strength=a['host_charpy_strength_j_m2'];field='charpy_notched_impact_strength_J_m2' if a['notch']=='A' else 'charpy_unnotched_impact_strength_J_m2'
|
| 233 |
+
if strength is None:strength=ref.get(field)
|
| 234 |
+
if a['behavior']=='energy_threshold' and strength is None:raise ActionRejected('MISSING_CHARPY_REFERENCE_OR_PRIOR')
|
| 235 |
+
incoming=a['mass_kg']*a['specific_heat_capacity_j_kg_k']*(T-self.plant['ambient_k']);self.sample=a;self.reference=ref;self.source=json.dumps(dict(reference_id=a['reference_id'],source=ref.get('source'),evidence=ref.get('evidence')),sort_keys=True);self.break_energy=None if a['behavior']=='unbreakable_proxy' else strength*(a['width_m']-a['notch_depth_m'])*a['thickness_m'];self.broken=self.spent=False;self.absorbed=self.damage=0.;self.sample_U+=incoming;self.book['sensible_loaded_j']+=incoming;self.book['loaded_mass_kg']+=a['mass_kg'];self.book['loaded_volume_m3']+=a['volume_m3'];out=dict(present=True)
|
| 236 |
+
elif k=='sample.remove':
|
| 237 |
+
if not self.sample:raise ActionRejected('NO_SAMPLE')
|
| 238 |
+
if not self._latch() or self.shield<1.1-1e-12 or self._shield_moving():raise ActionRejected('LOADING_GEOMETRY')
|
| 239 |
+
mass=self._mass();volume=self.sample['volume_m3'];sensible=mass*self.sample['specific_heat_capacity_j_kg_k']*(self._temperature()-self.plant['ambient_k']);self.book['sensible_removed_j']+=sensible;self.book['internal_removed_j']+=self.damage;self.book['removed_mass_kg']+=mass;self.book['removed_volume_m3']+=volume;self.sample_U-=sensible;self.sample=self.reference=self.source=None;self.broken=self.spent=False;self.absorbed=self.damage=0.;out=dict(removed_mass_kg=mass,removed_volume_m3=volume)
|
| 240 |
+
elif k=='power.set':
|
| 241 |
+
if not self.plant:raise ActionRejected('PLANT_REQUIRED')
|
| 242 |
+
if not a['enabled'] and self.phase=='running':self._finish('cancelled','POWER_OFF')
|
| 243 |
+
self.power=a['enabled'];out=dict(enabled=self.power)
|
| 244 |
+
elif k=='shield.set_open':
|
| 245 |
+
if not self.plant:raise ActionRejected('PLANT_REQUIRED')
|
| 246 |
+
if self.mechanical!='held':raise ActionRejected('PENDULUM_MOVING')
|
| 247 |
+
target=1.1 if a['opened'] else 0.;self.shield_start=self.shield;self.shield_target=target;self.shield_start_ns=self.time_ns;self.shield_end_ns=self.time_ns+math.ceil(abs(target-self.shield)/self.plant['shield_speed_rad_s']*1e9);out=dict(target_angle_rad=target)
|
| 248 |
+
elif k=='pendulum.raise':
|
| 249 |
+
if not self.plant or not self.fixture:raise ActionRejected('CONFIGURATION_REQUIRED')
|
| 250 |
+
if self.mechanical!='held':raise ActionRejected('PENDULUM_MOVING')
|
| 251 |
+
if self.shield>1e-12 or self._shield_moving():raise ActionRejected('SHIELD_OPEN')
|
| 252 |
+
if self.sample and not self.spent and not self._latch():raise ActionRejected('FRESH_SAMPLE_IN_PATH')
|
| 253 |
+
self.raise_target=RELEASE_ANGLE_RAD;distance=RELEASE_ANGLE_RAD-self.theta;self._raise_start_ns=self.time_ns;self._raise_end_ns=self.time_ns+math.ceil(abs(distance)/self.plant['host_raise_speed_rad_s']*1e9);self._raise_angle0=self.theta;self._raise_started=False;self._raise_rate=distance/((self._raise_end_ns-self.time_ns)/1e9) if distance else 0.;self.mechanical='raising' if distance else 'held';out=dict(target_angle_rad=self.raise_target)
|
| 254 |
+
elif k=='pendulum.catch':
|
| 255 |
+
if self.mechanical!='free':raise ActionRejected('NOT_FREE_SWING')
|
| 256 |
+
self.catch_requested=True;out=dict(requested=True)
|
| 257 |
+
elif k=='calibration.clear':self.calibration=None;out=dict(valid=False)
|
| 258 |
+
elif k in ('calibration.start','acquisition.start'):
|
| 259 |
+
if not self.power:raise ActionRejected('POWER_OFF')
|
| 260 |
+
if not self.plant or not self.fixture or not self.method:raise ActionRejected('CONFIGURATION_REQUIRED')
|
| 261 |
+
if not self._latch():raise ActionRejected('NOT_ARMED')
|
| 262 |
+
if self.shield>1e-12 or self._shield_moving():raise ActionRejected('SHIELD_OPEN')
|
| 263 |
+
if k=='calibration.start' and self.sample:raise ActionRejected('EMPTY_REQUIRED')
|
| 264 |
+
if k=='acquisition.start':
|
| 265 |
+
if not self.sample:raise ActionRejected('NO_SAMPLE')
|
| 266 |
+
if self.spent:raise ActionRejected('SAMPLE_SPENT')
|
| 267 |
+
if self.calibration is None:raise ActionRejected('CALIBRATION_REQUIRED')
|
| 268 |
+
if not self._temperature_valid():raise ActionRejected('REFERENCE_TEMPERATURE_RANGE')
|
| 269 |
+
self._counter+=1;self.operation_id=f'{self.instance_id}:swing:{self._counter}';self.phase='running';self.mode='calibration' if k=='calibration.start' else 'impact';self.elapsed=0.;self.rows=[];self.terminal_reason=None;self._operation_source=self.source;self._release_observed=encoder(self.theta);self._rebound_observed=self._observed_speed=None;self._outcome='pending';self._validity='not_completed';self._analysis=None;self._start_ns=self.time_ns;self._end_ns=self.time_ns+round(self.method['timeout_s']*1e9);self._period_ns=round(self.method['sample_interval_s']*1e9);self._sample_ns=self.time_ns+self._period_ns;self.mechanical='free';self._pending_impact=True;self._first_apex=False;self.catch_requested=False;self._segment=None;self._record();out=dict(operation_id=self.operation_id)
|
| 270 |
+
elif k=='acquisition.stop':
|
| 271 |
+
if self.phase!='running':raise ActionRejected('NOT_RUNNING')
|
| 272 |
+
self._finish('cancelled','USER_CANCEL');out=dict(phase=self.phase,elapsed_s=self.elapsed)
|
| 273 |
+
else:raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 274 |
+
self.revision+=1;return copy.deepcopy(out)
|
| 275 |
+
def step(self,dt_s):
|
| 276 |
+
validate(number('s',0,86400),dt_s);raw=dt_s*1e9+self._clock_remainder_ns;ns=round(raw);self._clock_remainder_ns=raw-ns
|
| 277 |
+
if not ns:return
|
| 278 |
+
end=self.time_ns+ns
|
| 279 |
+
while self.time_ns<end:
|
| 280 |
+
if self.mechanical=='free' and self._segment is None:self._new_segment()
|
| 281 |
+
if self.mechanical=='raising' and not self._raise_started:
|
| 282 |
+
old=self._energy();self.omega=self._raise_rate;self.book['host_work_j']+=self._energy()-old;self._raise_started=True
|
| 283 |
+
nexts=[end]
|
| 284 |
+
if self._shield_moving():nexts.append(self.shield_end_ns)
|
| 285 |
+
if self.mechanical=='free':nexts.append(self._segment['end_ns'])
|
| 286 |
+
if self.mechanical=='raising':nexts.append(self._raise_end_ns)
|
| 287 |
+
if self.phase=='running':nexts.extend([self._sample_ns,self._end_ns])
|
| 288 |
+
nxt=min(t for t in nexts if t>self.time_ns);dt=(nxt-self.time_ns)/1e9
|
| 289 |
+
if self.mechanical=='free':self._propagate_free(nxt)
|
| 290 |
+
elif self.mechanical=='raising':
|
| 291 |
+
old=self._energy();self.theta=self._raise_angle0+self._raise_rate*(nxt-self._raise_start_ns)/1e9;heat=self.plant['friction_torque_nm']*abs(self._raise_rate)*dt;self.book['friction_heat_j']+=heat;self.book['host_work_j']+=self._energy()-old+heat;self._cool(dt,heat/dt)
|
| 292 |
+
else:self._cool(dt)
|
| 293 |
+
self.time_ns=nxt
|
| 294 |
+
self.shield=self.shield_target if self.time_ns>=self.shield_end_ns else self.shield_start+(self.shield_target-self.shield_start)*(self.time_ns-self.shield_start_ns)/(self.shield_end_ns-self.shield_start_ns)
|
| 295 |
+
if self.phase=='running':self.elapsed=(self.time_ns-self._start_ns)/1e9
|
| 296 |
+
if self.mechanical=='raising' and self.time_ns==self._raise_end_ns:
|
| 297 |
+
old=self._energy();self.theta=RELEASE_ANGLE_RAD;self.omega=0.;self.book['host_work_j']+=self._energy()-old;self.mechanical='held'
|
| 298 |
+
if self.mechanical=='free' and self._segment and self.time_ns==self._segment['end_ns']:
|
| 299 |
+
kind=self._segment['event'];self._segment=None
|
| 300 |
+
if kind=='impact':self._physical_impact()
|
| 301 |
+
else:self._physical_apex()
|
| 302 |
+
if self.phase=='running' and self.time_ns==self._sample_ns:self._record();self._sample_ns+=self._period_ns
|
| 303 |
+
if self.phase=='running' and self.time_ns>=self._end_ns:self._finish('failed','OBSERVATION_TIMEOUT')
|
| 304 |
+
self.revision+=1
|
| 305 |
+
|
| 306 |
+
class ZwickHit5pSession:
|
| 307 |
+
def __init__(self, host, principal_id): self._host = host; self._principal = principal_id
|
| 308 |
+
@property
|
| 309 |
+
def _role(self): return self._host._principals[self._principal]
|
| 310 |
+
def _target(self, instance_id):
|
| 311 |
+
if instance_id != self._host.instance_id: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 312 |
+
def describe(self, *, instance_id=None, asset_type_id=None):
|
| 313 |
+
if (instance_id is None) == (asset_type_id is None): raise ActionRejected('INVALID_ARGUMENT')
|
| 314 |
+
if instance_id is not None: self._target(instance_id)
|
| 315 |
+
if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID: raise ActionRejected('UNKNOWN_INSTANCE')
|
| 316 |
+
meta = export_zwick_hit5p_contract_metadata()
|
| 317 |
+
return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0', capabilities={k:v for k,v in meta['capabilities'].items() if v['visibility']=='agent' or self._role!='agent'}, state_slots={k:v for k,v in meta['state_slots'].items() if v['visibility']=='agent' or self._role!='agent'})
|
| 318 |
+
def read(self, *, instance_id, state_ids=None):
|
| 319 |
+
self._target(instance_id); h=self._host; values=h.read(self._role); ids=list(values) if state_ids is None else state_ids
|
| 320 |
+
if not isinstance(ids,list) or any(not isinstance(k,str) for k in ids): raise ActionRejected('INVALID_ARGUMENT')
|
| 321 |
+
if any(k not in values for k in ids): raise ActionRejected('ACCESS_DENIED')
|
| 322 |
+
return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain':'simulation','time_s':h.time_s}, observations={k:dict(value=copy.deepcopy(values[k]),unit=SLOTS[k]['unit'],quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor','derived') else 'valid',sample_time_s=h.time_s,sample_window_s=None) for k in ids})
|
| 323 |
+
def _filter_result(self, result):
|
| 324 |
+
result = copy.deepcopy(result)
|
| 325 |
+
# A bridge may dispatch agent-visible capabilities through a privileged
|
| 326 |
+
# session. Public acquisition payloads therefore use the SAME redaction
|
| 327 |
+
# for every role. Full provenance has its own evaluator-only capability.
|
| 328 |
+
if 'rows' in result and 'template_source' in result:
|
| 329 |
+
result['template_source'] = str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record provenance available only through evaluator provenance.read' if result['template_source'] is not None else None
|
| 330 |
+
result['evidence'] = 'synthetic_forward_model; quantized_encoder_angles_and_observed_empty_swing_correction; manufacturer_ISO179_scalar_reference_and_explicit_fracture_thermal_proxy; selected record restricted' if result['operation_id'] is not None else 'no_measurement'
|
| 331 |
+
return result
|
| 332 |
+
def invoke(self, *, instance_id, capability_id, arguments, request_id):
|
| 333 |
+
h=self._host
|
| 334 |
+
try:
|
| 335 |
+
self._target(instance_id)
|
| 336 |
+
if not isinstance(capability_id,str) or capability_id not in CAPS: raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 337 |
+
if self._role=='agent' and CAPS[capability_id]['visibility']!='agent': raise ActionRejected('ACCESS_DENIED')
|
| 338 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 339 |
+
validate(CAPS[capability_id]['input_schema'],arguments); key=(self._principal,request_id); digest=json.dumps([capability_id,arguments],sort_keys=True,allow_nan=False)
|
| 340 |
+
if key in h._requests:
|
| 341 |
+
old,response=h._requests[key]
|
| 342 |
+
if old!=digest: raise ActionRejected('REQUEST_CONFLICT')
|
| 343 |
+
return copy.deepcopy(response)
|
| 344 |
+
if capability_id in ('acquisition.stop','acquisition.result') and self._role=='agent' and h.operation_id and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 345 |
+
if capability_id=='power.set' and not arguments['enabled'] and h.phase=='running' and self._role=='agent' and h._owners.get(h.operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 346 |
+
result=self._filter_result(h.invoke(capability_id,**arguments)); operation=result.get('operation_id') if capability_id in ('acquisition.start','calibration.start') else None
|
| 347 |
+
if operation: h._owners[operation]=self._principal
|
| 348 |
+
response=dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=operation,status='accepted' if operation else 'succeeded',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result=result,observations={},error=None)
|
| 349 |
+
h._requests[key]=(digest,copy.deepcopy(response)); return response
|
| 350 |
+
except ActionRejected as exc:
|
| 351 |
+
return dict(protocol_version=PROTOCOL_VERSION,instance_id=instance_id,request_id=request_id,operation_id=None,status='unsupported' if str(exc)=='UNSUPPORTED' else 'rejected',state_revision=h.revision,clock={'domain':'simulation','time_s':h.time_s},result={},observations={},error=dict(code=str(exc),message=str(exc),retryable=False,side_effects='none'))
|
| 352 |
+
def write(self, *, instance_id, state_id, value, request_id):
|
| 353 |
+
self._target(instance_id); entry=SLOTS.get(state_id)
|
| 354 |
+
if not entry or not entry['write']: raise ActionRejected('ACCESS_DENIED')
|
| 355 |
+
capability,argument=entry['write']; return self.invoke(instance_id=instance_id,capability_id=capability,arguments={argument:value},request_id=request_id)
|
| 356 |
+
def poll(self, operation_id):
|
| 357 |
+
h=self._host
|
| 358 |
+
if h._owners.get(operation_id)!=self._principal: raise ActionRejected('ACCESS_DENIED')
|
| 359 |
+
result=h._result() if operation_id==h.operation_id and h.phase=='running' else h.records.get(operation_id)
|
| 360 |
+
if result is None: raise ActionRejected('UNKNOWN_OPERATION')
|
| 361 |
+
return dict(operation_id=operation_id,status=result['phase'],result=self._filter_result(result))
|
| 362 |
+
def cancel(self, operation_id, request_id):
|
| 363 |
+
self.poll(operation_id); h=self._host
|
| 364 |
+
if not isinstance(request_id,str) or not request_id: raise ActionRejected('INVALID_ARGUMENT')
|
| 365 |
+
key=(self._principal,request_id)
|
| 366 |
+
if key in h._cancel_operations:
|
| 367 |
+
if h._cancel_operations[key]!=operation_id: raise ActionRejected('REQUEST_CONFLICT')
|
| 368 |
+
return copy.deepcopy(h._requests[key][1])
|
| 369 |
+
if key in h._requests: raise ActionRejected('REQUEST_CONFLICT')
|
| 370 |
+
if operation_id!=h.operation_id or h.phase!='running': raise ActionRejected('NOT_RUNNING')
|
| 371 |
+
result=self.invoke(instance_id=h.instance_id,capability_id='acquisition.stop',arguments={},request_id=request_id)
|
| 372 |
+
if result['status']=='succeeded': h._cancel_operations[key]=operation_id
|
| 373 |
+
return result
|
| 374 |
+
|
| 375 |
+
EFFECTS={
|
| 376 |
+
'plant.configure':['plant.configured','truth.sample_temperature_k','truth.bearing_temperature_k'],
|
| 377 |
+
'fixture.configure':['fixture.configured','calibration.valid','calibration.friction_torque_nm'],
|
| 378 |
+
'method.configure':['method.configured'],
|
| 379 |
+
'sample.load':['sample.present','sample.broken','sample.spent','truth.sample_mass_kg','truth.sample_temperature_k','truth.sample_absorbed_j','fragments.offset_m'],
|
| 380 |
+
'sample.remove':['sample.present','sample.broken','sample.spent','truth.sample_mass_kg','truth.sample_temperature_k','truth.sample_absorbed_j','fragments.offset_m'],
|
| 381 |
+
'power.set':['power.enabled','power.angle_rad','encoder.angle_rad','measurement.energy_j','acquisition.phase'],
|
| 382 |
+
'shield.set_open':['shield.target_angle_rad'],
|
| 383 |
+
'pendulum.raise':['pendulum.target_angle_rad','pendulum.held','latch.engaged','latch.position_m'],
|
| 384 |
+
'pendulum.catch':['catch.requested'],
|
| 385 |
+
'calibration.clear':['calibration.valid','calibration.friction_torque_nm'],
|
| 386 |
+
'acquisition.start':['acquisition.phase','acquisition.elapsed_s','acquisition.points','measurement.validity','pendulum.held','latch.engaged','latch.position_m','catch.requested'],
|
| 387 |
+
'calibration.start':['acquisition.phase','acquisition.elapsed_s','acquisition.points','measurement.validity','pendulum.held','latch.engaged','latch.position_m','catch.requested'],
|
| 388 |
+
'acquisition.stop':['acquisition.phase'],
|
| 389 |
+
'sim.step':list(SLOTS)}
|
| 390 |
+
for k,v in EFFECTS.items():CAPS[k]['effects']=v
|
| 391 |
+
ERRORS=sorted(set(__import__('re').findall(r"ActionRejected\('([A-Z_0-9]+)'",Path(__file__).read_text()))|{'USER_CANCEL','POWER_OFF','OBSERVATION_TIMEOUT','INVALID_EMPTY_SWING'})
|
| 392 |
+
LIMITATIONS=[
|
| 393 |
+
'固定HIT5P / ISO179 Charpy .5J摆锤010930 / 62mm夹具010961,0.5J不是整机最大5J;释放135.72°、摆长250mm、名义2.9m/s±10%、encoder .018°。厂家工作范围10..80%,即.05.. .4J;范围外可报告估计J但不给有效标准化强度。',
|
| 394 |
+
'本HIT5P配置为机械释放,不配自动回摆和盘式制动。pendulum.raise为外部手动有限速代理,pendulum.catch请求宿主在下一转折点接住并保持;它们不是OEM电机/刹车,也未验证机器人抓取/人手安全。',
|
| 395 |
+
'当前几何摆轴−Y,0竖下、正角释放侧在+X,负角速度撞击向−X;刀口半径.25m不是所有质量的COM。重力矩K=.5/(1−cosα),有效惯量I=2*.5/(2.9/.25)²由名义规格约束推导,不是独立部件惯量实测。厂家.119kg仅名义总摆锤,70kg整机不当摆锤或热容。',
|
| 396 |
+
'自由摆I*θddot=−K*sinθ−τeff*sign(ω)。恒定Coulomb有效摩擦为明确空气/轴承合并近似,不解频率相关空气阻力或轴承温变;实际摩擦功τeff*|dθ|进入局部轴承工程热节点。',
|
| 397 |
+
'空摆首回升峰值提供τcal=K*(cosβ−cosα)/(α+β),完全来自量化encoder角度及名义K,不读取hidden friction。样品Eobs=K*(cosβ−cosα)−τcal*(α+β);角度分辨不等于OEM准确度,无经验noise分布。',
|
| 398 |
+
'真实厂家61牌号ISO179标量来自各明确温度/缺口工况;N不破、未知值与零吸能不同,绝不把Izod J/m换成Charpy J/m²。原始force/displacement/time曲线缺失,当前前向摆动曲线是synthetic_forward_model。',
|
| 399 |
+
'宿主接受的energy-threshold代理在实际θ=0时移除参考Charpy强度×剩余截面积的能量;不解接触力峰值、颈缩、裂纹扩展或支点应变。能量不足或unbreakable代理按显式restitution反弹,partial吸能可记录但不能当完整断裂强度。',
|
| 400 |
+
'瞬时冲击是集总离散事件,不声称全带宽碰撞/力传感;破断角速度由真实能量扣除得到。β比例进入样品热,其余进入损伤/新表面库存;所有碎片留在收集边界,取样才携出mass、显热与损伤能。',
|
| 401 |
+
'显式非线性/热耦合积分的工程计算域要求bearing C/G及未装样local C/G≥1ms;过快热节点原子拒绝,不把该数值稳定边界当OEM物理限制。',
|
| 402 |
+
'宿主抬摆轨迹有限速、理想速度约束;启动/停止的惯性能量计入有符号host work,可回收机械能,不假造有限峰值电机功率。被动换热参数为宿主工程输入,无主动温控附件。',
|
| 403 |
+
'采样按宿主定义时间网格,impact/apex额外事件独立标记;首峰值完成记录后摆锤继续自由摆,cancel/掉电亦不删机械能。没有宿主catch时继续至Coulomb静摩擦可支撑位置,自然停摆不强制回到0。',
|
| 404 |
+
'默认80×10×4mm、A缺口深2mm,剩余面积32mm²。载入其它过程尺寸不会自动重建固定3D示例;sample mass、volume、Cp为独立宿主先验。破后分离是受限视觉示意,不是碎片弹道或连续变形碰撞表面。',
|
| 405 |
+
'单温度参考仅在宿主显式容差内作常数近似,不进行不同温度/缺口/速率数据暗中插值。Coulomb校正、工程移植和代理结果不构成ISO179认证。',
|
| 406 |
+
'精确场景摆角/片段位置及过程能量受限evaluator,agent使用量化encoder;所有角色普通结果/poll都隐藏选中牌号/来源。完整来源仅provenance.read;共享磁盘/Python不构成OS隔离。']
|
| 407 |
+
def export_zwick_hit5p_contract_metadata():
|
| 408 |
+
slots={};caps={}
|
| 409 |
+
for k,v in SLOTS.items():slots[k]=dict(meaning_zh=v['meaning'],component_ids=[v['component']],value_schema=copy.deepcopy(v['schema']),unit=v['unit'],reference_conditions='SI; selected HIT5P ISO179 Charpy0.5J / .25m /135.72deg /62mm span; external manual raise/catch.',origin=v['origin'],visibility=v['visibility'],access='read_only',read_binding=dict(backend='host',artifact_id='runtime',accessor=f'ZwickHit5pSession.read(state_ids=[{k!r}])'),write_via=None,sampling=dict(mode='instant',time_domain='simulation',window_description='Pure read; encoder quantized0.018deg; rows on method time grid with separate impact/apex events.'),source_ids=['simulation_assumption'])
|
| 410 |
+
for k,v in CAPS.items():
|
| 411 |
+
un=k in UNSUPPORTED;async_=k in ('acquisition.start','calibration.start');caps[k]={key:copy.deepcopy(v[key]) for key in ['input_schema','output_schema','component_ids','function_zh','kind','visibility','example_arguments']}
|
| 412 |
+
caps[k].update(availability='unsupported' if un else 'implemented',implementation={layer:'absent' if un or layer in ('scene','robot','hardware') else 'implemented' for layer in ['process','scene','robot','hardware','host']},binding=None if un else dict(backend='host',artifact_id='runtime',entrypoint='asset_runtime.zwick_hit5p.ZwickHit5pSession.invoke',invocation=f'session.invoke(instance_id="hit_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),preconditions=[] if un or v['kind'] in ('query','analysis') else [dict(description_zh='入口原子核对ISO179 .5J选型、抬摆锁止、罩位置、空摆校准和实际样品前提。',state_ids=['power.enabled','sample.present','pendulum.held','latch.engaged','shield.angle_rad','acquisition.phase'],enforced_by='runtime',check='ZwickHit5pRuntime.invoke')],state_effects=[dict(state_id=s,timing='on_step' if k=='sim.step' else 'immediate',description_zh='设定或操作标志;真实机械/温度/角度读数仅step推进') for s in v['effects']],observes=[],model_effects=dict(mode='none',description_zh='运行层输出供scene独立绑定验证的状态,不直接写几何',binding_ids=[]),execution=dict(mode='asynchronous' if async_ else 'synchronous',time_domain='simulation',completion_criterion='释放、实际冲击和首回升角观测完成;记录结束不代表机械停摆' if async_ else '原子配置/外部动作请求,实际状态由step推进',completion_state_ids=['acquisition.phase'] if async_ else [],timeout_s=None,cancellation='supported' if async_ else 'unsupported',retry='same_request_id',resources=['host_clock','pendulum','ISO179_fixture','encoder'],partial_failure_zh='停止记录保留全部已点/机械能/破坏/热与库存;自由摆继续至外部catch或自然静止。'),errors=[dict(code=e,meaning_zh=e,side_effects='partial' if async_ and e in ('USER_CANCEL','POWER_OFF','OBSERVATION_TIMEOUT','INVALID_EMPTY_SWING') else 'none') for e in ERRORS],verification=[],limitations=LIMITATIONS,source_ids=['manufacturer_primary','simulation_assumption','template_library'])
|
| 413 |
+
if k in ('acquisition.start','calibration.start','pendulum.raise','pendulum.catch','shield.set_open'):
|
| 414 |
+
caps[k]['state_effects'] += [dict(state_id=s,timing='on_step',description_zh='由统一宿主时钟推进非线性摆动、摩擦/冲击/被动热及量化encoder') for s in SLOTS if s not in v['effects'] and SLOTS[s]['origin'] in ('sensor','derived','scene','process_truth')]
|
| 415 |
+
mechanism=dict(component_ids=['pendulum','striker','latch','fixture_base','sample_left','sample_right','controller'],state_ids=list(slots),meaning_zh='ISO179 .5J非线性摆动、实际空摆角度摩擦校正、能量阈值破坏/反弹和可守恒热库存',implementation='lumped',equations=['Kgrav=.5/(1-cos(alpha)); I=2*.5/(2.9/.25)^2; alpha=135.72deg.','Emechanical=0.5*I*omega²+Kgrav*(1-cos(theta)); I*domega/dt=-Kgrav*sin(theta)-tau*sign(omega).','Pfriction=tau*abs(omega); passive bearing/sample heat nodes retain and export energy.','At theta=0: break iff kinetic>=explicit threshold aCharpy*Aremaining; omega_after=-sqrt(2*(kinetic-threshold)/I).','No-break: omega_after=+restitution*abs(omega_before), absorbed=(1-restitution²)*kinetic; no complete-break strength inferred.','Qsample=heat_fraction*absorbed; remaining absorbed stored as damage/surface energy.','Calibration from observed empty alpha,beta: tau_est=Kgrav*(cos(beta)-cos(alpha))/(alpha+beta).','Observed absorbed energy=Kgrav*(cos(beta)-cos(alpha))-tau_est*(alpha+beta); aCharpy=Eobs/Aremaining_prior only for complete valid break and supplied independent area.','External host raising: dWhost=dEmechanical+dQfriction, including ideal velocity boundary kinetic change; at-turn catch imposes hold at omega0 without energy deletion.','Host sole clock; free-flight dense ODE segments anchored at physical events and integer-nanosecond sampling grid with fractional-nanosecond carry.'],parameters={},source_ids=['simulation_assumption','template_library'],limitations=LIMITATIONS)
|
| 416 |
+
spec=importlib.util.spec_from_file_location('_hit_local_annotations',ROOT/'scripts/asset_runtime/_annotations.py');ann=importlib.util.module_from_spec(spec);spec.loader.exec_module(ann);ann.KEY_ZH.update({k:v['meaning'] for k,v in SLOTS.items()});ann.annotate_export(SLUG,caps,slots,{'charpy_pendulum':mechanism},inputs={'plant.configure':(PLANT,PLANT_EXAMPLE),'fixture.configure':(FIXTURE,FIXTURE_EXAMPLE),'sample.load':(SAMPLE,SAMPLE_EXAMPLE),'method.configure':(METHOD,METHOD_EXAMPLE)})
|
| 417 |
+
for k,v in SLOTS.items():slots[k]['meaning_zh']=v['meaning']
|
| 418 |
+
return dict(asset_type_id=ASSET_TYPE_ID,catalog_id=CATALOG_ID,capabilities=caps,state_slots=slots,mechanisms={'charpy_pendulum':mechanism})
|
scripts/asset_runtime/zwick_mflow.py
ADDED
|
@@ -0,0 +1,1350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM-146 ZwickRoell Mflow 1128610 extrusion plastometer runtime (ISO 1133 methods A and B, SI units).
|
| 2 |
+
|
| 3 |
+
Physics owned by the host clock (``step`` is the only entry that advances time):
|
| 4 |
+
* barrel/furnace lumped heat node with a PI controller (heater limited by an explicit engineering power), ambient loss;
|
| 5 |
+
* polymer charge: enthalpy with sensible + latent (melting range) terms, pellet compaction (bulk -> melt density),
|
| 6 |
+
heat exchange with the barrel, thermal-history clock above the melting onset;
|
| 7 |
+
* die flow: reference MVR of the selected manufacturer record transferred to the actual condition with explicit
|
| 8 |
+
host priors (power-law index n, flow activation energy Ea, thermal-history rate) and the piston friction:
|
| 9 |
+
Q = MVR_ref * ((m g - F_f) / (m_ref g))^(1/n) * exp(-(Ea / (n R)) (1/T - 1/T_ref)) * exp(k_h t_hist) * phi^3 ;
|
| 10 |
+
* piston rides on the charge column (compaction + extrusion), weight potential energy -> friction heat (barrel) and
|
| 11 |
+
pressure work (charge); manual host withdraw / insert at finite speed;
|
| 12 |
+
* automatic cutter: alternate blade half turns, the strand is severed when the blade crosses pi/2;
|
| 13 |
+
* external RS-232 analytical balance proxy with settling time, resolution, gain/offset (no built-in balance);
|
| 14 |
+
* displacement encoder (0.003 mm), time base (0.002 s), temperature display (0.01 K) quantisation.
|
| 15 |
+
A single MVR/MFR scalar does not identify the rheology: n, Ea, melt density, cp, latent heat, compaction and history are
|
| 16 |
+
explicit host priors (evidence = assumption). The observed results are computed only from quantised observations.
|
| 17 |
+
"""
|
| 18 |
+
from __future__ import annotations
|
| 19 |
+
|
| 20 |
+
import copy
|
| 21 |
+
import json
|
| 22 |
+
import math
|
| 23 |
+
import re
|
| 24 |
+
from pathlib import Path
|
| 25 |
+
|
| 26 |
+
PROTOCOL_VERSION = '1.0.0'
|
| 27 |
+
SLUG = 'zwick_mflow'
|
| 28 |
+
ASSET_TYPE_ID = 'instrument.' + SLUG
|
| 29 |
+
CATALOG_ID = 'CHEM-146'
|
| 30 |
+
ROOT = Path(__file__).resolve().parents[2]
|
| 31 |
+
ASSET = ROOT / 'assets/expansion_batch04/t1_thermal' / SLUG
|
| 32 |
+
LIBRARY_PATH = ASSET / 'melt_flow_library.json'
|
| 33 |
+
|
| 34 |
+
# ---------------------------------------------------------------- documented / standard constants
|
| 35 |
+
GRAVITY = 9.80665
|
| 36 |
+
GAS_CONSTANT = 8.314462618
|
| 37 |
+
BARREL_DIAMETER_M = 0.00955 # 1128612 (documented)
|
| 38 |
+
PISTON_HEAD_DIAMETER_M = 0.009474 # ISO 1133-1 piston head
|
| 39 |
+
STANDARD_AREA_M2 = math.pi / 4 * ((BARREL_DIAMETER_M + PISTON_HEAD_DIAMETER_M) / 2) ** 2 # ISO mean area, 0.711 cm^2
|
| 40 |
+
DIE_DIAMETER_M = 0.002095 # 312342 (documented)
|
| 41 |
+
DIE_LENGTH_M = 0.008
|
| 42 |
+
DIE_AREA_M2 = math.pi * DIE_DIAMETER_M ** 2 / 4
|
| 43 |
+
BARREL_LENGTH_M = 0.180
|
| 44 |
+
PISTON_TRAVEL_M = BARREL_LENGTH_M
|
| 45 |
+
PISTON_LOAD_KG = 0.325 # the piston alone is the 0.325 kg load stage (documented)
|
| 46 |
+
LOAD_RANGE_KG = (0.325, 21.6) # documented total test load range
|
| 47 |
+
TEMPERATURE_RANGE_K = (323.15, 723.15) # documented 50 .. 450 degC
|
| 48 |
+
ENCODER_RESOLUTION_M = 3e-6 # documented 0.003 mm
|
| 49 |
+
TIME_RESOLUTION_S = 0.002 # documented 0.002 s
|
| 50 |
+
TEMPERATURE_DISPLAY_RESOLUTION_K = 0.01 # documented "< 0.1 K"; this model shows 0.01 K steps
|
| 51 |
+
CONNECTED_APPARENT_POWER_VA = 700.0 # documented 0.7 kVA full load (not the heater power)
|
| 52 |
+
MFR_RANGE_KG_S = (0.1e-3 / 600, 2000e-3 / 600) # product page approx. 0.1 .. 2000 g/10 min
|
| 53 |
+
# transducer arm (same geometry as outputs/.../interface_definition.py; checked by the tests)
|
| 54 |
+
SENSOR_ZERO_POSITION_M = 0.050
|
| 55 |
+
SENSOR_ARM_LENGTH_M = 0.140
|
| 56 |
+
SENSOR_ELEVATION_MAX_RAD = 0.42
|
| 57 |
+
SENSOR_REFERENCE_ELEVATION_RAD = math.asin(-SENSOR_ZERO_POSITION_M / SENSOR_ARM_LENGTH_M)
|
| 58 |
+
SENSOR_RANGE_M = (0.0, SENSOR_ZERO_POSITION_M + SENSOR_ARM_LENGTH_M * math.sin(SENSOR_ELEVATION_MAX_RAD))
|
| 59 |
+
CUTTER_TRAVEL_RAD = math.pi
|
| 60 |
+
POWER_SWITCH_ON_RAD = 0.28
|
| 61 |
+
MAX_SUBSTEP_S = 0.05
|
| 62 |
+
MIN_PISTON_M = 0.005 # the piston must stay above the die (end of usable charge)
|
| 63 |
+
LIVE_MVR_WINDOW_S = 4.0
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
class ActionRejected(ValueError):
|
| 67 |
+
pass
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
# ---------------------------------------------------------------- schema helpers
|
| 71 |
+
def number(unit='1', lo=None, hi=None):
|
| 72 |
+
s = {'type': 'number', 'x-unit': unit}
|
| 73 |
+
if lo is not None:
|
| 74 |
+
s['minimum'] = lo
|
| 75 |
+
if hi is not None:
|
| 76 |
+
s['maximum'] = hi
|
| 77 |
+
return s
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def obj(properties):
|
| 81 |
+
return dict(type='object', properties=properties, required=list(properties), additionalProperties=False)
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def nullable(s):
|
| 85 |
+
return {'anyOf': [s, {'type': 'null'}]}
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def array(s, minimum=0, maximum=200001):
|
| 89 |
+
return dict(type='array', items=s, minItems=minimum, maxItems=maximum)
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
def enum(items):
|
| 93 |
+
return {'type': 'string', 'enum': list(items)}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
BOOL = {'type': 'boolean'}
|
| 97 |
+
TEXT = {'type': 'string'}
|
| 98 |
+
INT = {'type': 'integer', 'x-unit': '1'}
|
| 99 |
+
PHASE = enum(['idle', 'running', 'succeeded', 'cancelled', 'failed'])
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def validate(s, v):
|
| 103 |
+
if 'anyOf' in s:
|
| 104 |
+
for o in s['anyOf']:
|
| 105 |
+
try:
|
| 106 |
+
validate(o, v)
|
| 107 |
+
return
|
| 108 |
+
except ActionRejected:
|
| 109 |
+
pass
|
| 110 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 111 |
+
k = s.get('type')
|
| 112 |
+
if k in ('number', 'integer'):
|
| 113 |
+
if isinstance(v, bool) or not isinstance(v, (int, float)) or not math.isfinite(v) or (k == 'integer' and type(v) is not int):
|
| 114 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 115 |
+
if not s.get('minimum', -math.inf) <= v <= s.get('maximum', math.inf):
|
| 116 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 117 |
+
elif k == 'object':
|
| 118 |
+
if not isinstance(v, dict) or set(v) != set(s['properties']):
|
| 119 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 120 |
+
for key, value in v.items():
|
| 121 |
+
validate(s['properties'][key], value)
|
| 122 |
+
elif k == 'array':
|
| 123 |
+
if not isinstance(v, list) or not s.get('minItems', 0) <= len(v) <= s.get('maxItems', math.inf):
|
| 124 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 125 |
+
for x in v:
|
| 126 |
+
validate(s['items'], x)
|
| 127 |
+
elif k == 'boolean' and type(v) is not bool:
|
| 128 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 129 |
+
elif k == 'string' and not isinstance(v, str):
|
| 130 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 131 |
+
elif k == 'null' and v is not None:
|
| 132 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 133 |
+
if 'enum' in s and v not in s['enum']:
|
| 134 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
_LIBRARY = None
|
| 138 |
+
|
| 139 |
+
|
| 140 |
+
def library():
|
| 141 |
+
global _LIBRARY
|
| 142 |
+
if _LIBRARY is None:
|
| 143 |
+
_LIBRARY = {r['id']: r for r in json.loads(LIBRARY_PATH.read_text())['templates']}
|
| 144 |
+
return _LIBRARY
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
def quantize(value, step):
|
| 148 |
+
return round(value / step) * step
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
def sensor_arm_angle(position_m):
|
| 152 |
+
"""Transducer-arm joint angle (0 = reference pose, piston on the die); upper stop beyond ~107 mm."""
|
| 153 |
+
s = (position_m - SENSOR_ZERO_POSITION_M) / SENSOR_ARM_LENGTH_M
|
| 154 |
+
if s >= math.sin(SENSOR_ELEVATION_MAX_RAD):
|
| 155 |
+
elevation = SENSOR_ELEVATION_MAX_RAD
|
| 156 |
+
else:
|
| 157 |
+
elevation = math.asin(max(s, math.sin(SENSOR_REFERENCE_ELEVATION_RAD)))
|
| 158 |
+
return elevation - SENSOR_REFERENCE_ELEVATION_RAD
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
# ---------------------------------------------------------------- inputs
|
| 162 |
+
PLANT_EXAMPLE = dict(ambient_k=296.15, barrel_heat_capacity_j_k=900.0, barrel_loss_w_k=0.55, heater_max_w=450.0, controller_gain_w_k=80.0,
|
| 163 |
+
controller_integral_s=120.0, sample_conductance_w_k=0.25, piston_friction_n=0.30, manual_piston_speed_m_s=0.02,
|
| 164 |
+
cutter_half_turn_s=0.25, accept_engineering=True)
|
| 165 |
+
PLANT = obj(dict(ambient_k=number('K', 273.15, 323.15), barrel_heat_capacity_j_k=number('J/K', 100.0, 5000.0), barrel_loss_w_k=number('W/K', 0.01, 10.0),
|
| 166 |
+
heater_max_w=number('W', 10.0, CONNECTED_APPARENT_POWER_VA), controller_gain_w_k=number('W/K', 1.0, 2000.0),
|
| 167 |
+
controller_integral_s=number('s', 5.0, 10000.0), sample_conductance_w_k=number('W/K', 0.001, 20.0),
|
| 168 |
+
piston_friction_n=number('N', 0.0, 3.0), manual_piston_speed_m_s=number('m/s', 0.001, 0.1), cutter_half_turn_s=number('s', 0.05, 5.0),
|
| 169 |
+
accept_engineering=BOOL))
|
| 170 |
+
SAMPLE_EXAMPLE = dict(reference_id='basf_ultradur_b4520', reference_temperature_k=523.15, reference_load_kg=2.16, mass_kg=0.0060,
|
| 171 |
+
bulk_density_kg_m3=800.0, melt_density_kg_m3=1110.0, specific_heat_j_kg_k=1900.0, initial_temperature_k=296.15,
|
| 172 |
+
melting_low_k=488.15, melting_high_k=498.15, latent_heat_j_kg=48000.0, power_law_index=0.75,
|
| 173 |
+
activation_energy_j_mol=50000.0, history_rate_per_s=5e-5, accept_rheology_thermal_density_and_packing_assumptions=True)
|
| 174 |
+
SAMPLE = obj(dict(reference_id=TEXT, reference_temperature_k=number('K', 323.15, 723.15), reference_load_kg=number('kg', 0.325, 21.6),
|
| 175 |
+
mass_kg=number('kg', 1e-4, 0.02), bulk_density_kg_m3=number('kg/m^3', 100.0, 3000.0), melt_density_kg_m3=number('kg/m^3', 300.0, 3000.0),
|
| 176 |
+
specific_heat_j_kg_k=number('J/(kg*K)', 300.0, 5000.0), initial_temperature_k=number('K', 273.15, 373.15),
|
| 177 |
+
melting_low_k=number('K', 273.15, 723.15), melting_high_k=number('K', 273.15, 723.15), latent_heat_j_kg=number('J/kg', 0.0, 3e5),
|
| 178 |
+
power_law_index=number('1', 0.2, 1.0), activation_energy_j_mol=number('J/mol', 0.0, 2e5), history_rate_per_s=number('1/s', -0.005, 0.005),
|
| 179 |
+
accept_rheology_thermal_density_and_packing_assumptions=BOOL))
|
| 180 |
+
METHOD_EXAMPLE = dict(test_load_kg=2.16, preheat_time_s=300.0, duration_s=240.0, sample_interval_s=0.2, cut_interval_s=10.0,
|
| 181 |
+
window_upper_m=0.050, window_lower_m=0.020, temperature_tolerance_k=0.5, automatic_weighing=True)
|
| 182 |
+
METHOD = obj(dict(test_load_kg=number('kg', 0.325, 21.6), preheat_time_s=number('s', 60.0, 3600.0), duration_s=number('s', 1.0, 3600.0),
|
| 183 |
+
sample_interval_s=number('s', TIME_RESOLUTION_S, 30.0), cut_interval_s=nullable(number('s', 0.5, 600.0)),
|
| 184 |
+
window_upper_m=number('m', 0.005, 0.075), window_lower_m=number('m', 0.005, 0.075), temperature_tolerance_k=number('K', 0.01, 5.0),
|
| 185 |
+
automatic_weighing=BOOL))
|
| 186 |
+
BALANCE_EXAMPLE = dict(resolution_kg=1e-7, gain=1.0, offset_kg=0.0, settling_s=4.0, accept_external_balance_proxy=True)
|
| 187 |
+
BALANCE = obj(dict(resolution_kg=number('kg', 1e-9, 1e-3), gain=number('1', 0.5, 1.5), offset_kg=number('kg', -1e-3, 1e-3), settling_s=number('s', 0.01, 120.0),
|
| 188 |
+
accept_external_balance_proxy=BOOL))
|
| 189 |
+
CAL_ENCODER = obj(dict(observed_low_m=number('m', -0.01, 0.2), observed_high_m=number('m', -0.01, 0.2), reference_low_m=number('m', 0.0, 0.2), reference_high_m=number('m', 0.0, 0.2)))
|
| 190 |
+
CAL_BALANCE = obj(dict(observed_low_kg=number('kg', -1e-3, 0.2), observed_high_kg=number('kg', -1e-3, 0.2), reference_low_kg=number('kg', 0.0, 0.2), reference_high_kg=number('kg', 0.0, 0.2)))
|
| 191 |
+
ROW = obj(dict(point_index=INT, time_s=number('s'), encoder_position_m=nullable(number('m')), temperature_k=nullable(number('K')),
|
| 192 |
+
quality=enum(['ok', 'encoder_out_of_range', 'power_off'])))
|
| 193 |
+
SEGMENT = obj(dict(segment_id=TEXT, start_time_s=nullable(number('s')), end_time_s=number('s'), duration_s=nullable(number('s')),
|
| 194 |
+
observed_mass_kg=nullable(number('kg')), status=enum(['unweighed', 'weighing', 'weighed']), measurement_segment=BOOL))
|
| 195 |
+
FLOW = obj(dict(mvr_m3_s=nullable(number('m^3/s')), mvr_cm3_10min=nullable(number('cm^3/(10min)')), mfr_kg_s=nullable(number('kg/s')),
|
| 196 |
+
mfr_g_10min=nullable(number('g/(10min)')), density_at_test_temperature_kg_m3=nullable(number('kg/m^3')),
|
| 197 |
+
window_positions_m=nullable(array(number('m'), 2, 2)), window_times_s=nullable(array(number('s'), 2, 2)), weighed_segments=INT, evidence=TEXT))
|
| 198 |
+
VALIDITY = enum(['not_completed', 'valid', 'window_not_traversed', 'temperature_out_of_tolerance', 'preheat_below_iso_minimum', 'sample_exhausted', 'cancelled'])
|
| 199 |
+
RESULT = obj(dict(operation_id=nullable(TEXT), phase=PHASE, elapsed_s=number('s'), test_temperature_k=nullable(number('K')), test_load_kg=nullable(number('kg')),
|
| 200 |
+
rows=array(ROW), segments=array(SEGMENT, 0, 10000), flow=nullable(FLOW), validity=VALIDITY, terminal_reason=nullable(TEXT),
|
| 201 |
+
template_source=nullable(TEXT), evidence=TEXT))
|
| 202 |
+
ANALYSIS = obj(dict(start_position_m=number('m', 0.0, 0.2), end_position_m=number('m', 0.0, 0.2), start_time_s=number('s', 0.0, 1e9), end_time_s=number('s', 0.0, 1e9),
|
| 203 |
+
area_prior_m2=number('m^2', 1e-6, 1e-3), weighed_segments=array(obj(dict(mass_kg=number('kg', 0.0, 1.0), duration_s=number('s', TIME_RESOLUTION_S, 1e6))), 0, 10000),
|
| 204 |
+
melt_density_prior_kg_m3=nullable(number('kg/m^3', 100.0, 5000.0))))
|
| 205 |
+
ANALYSIS_OUTPUT = obj(dict(mvr_m3_s=number('m^3/s'), mvr_cm3_10min=number('cm^3/(10min)'), mfr_kg_s=nullable(number('kg/s')), mfr_g_10min=nullable(number('g/(10min)')),
|
| 206 |
+
density_derived_mfr_kg_s=nullable(number('kg/s')), density_at_test_temperature_kg_m3=nullable(number('kg/m^3')), evidence=TEXT))
|
| 207 |
+
LEDGER_KEYS = ['loaded_mass_kg', 'sample_mass_kg', 'strand_mass_kg', 'segments_mass_kg', 'collected_mass_kg', 'removed_mass_kg', 'extruded_mass_kg', 'mass_residual_kg',
|
| 208 |
+
'heater_input_j', 'host_work_j', 'loaded_enthalpy_j', 'barrel_thermal_j', 'sample_enthalpy_j', 'load_potential_j', 'ambient_export_j',
|
| 209 |
+
'extruded_enthalpy_j', 'removed_enthalpy_j', 'friction_heat_j', 'pressure_work_j', 'energy_residual_j']
|
| 210 |
+
LEDGER = obj({k: number('kg' if k.endswith('_kg') else 'J') for k in LEDGER_KEYS})
|
| 211 |
+
|
| 212 |
+
# ---------------------------------------------------------------- capabilities
|
| 213 |
+
CAPS = {}
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
def cap(k, s, o, e, c, meaning, visibility='agent', kind='device_command'):
|
| 217 |
+
CAPS[k] = dict(input_schema=s, output_schema=o, example_arguments=e, component_ids=[c], function_zh=meaning, visibility=visibility, kind=kind, effects=[])
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
CONFIGURED = obj(dict(configured=BOOL))
|
| 221 |
+
cap('plant.configure', PLANT, CONFIGURED, PLANT_EXAMPLE, 'heater', '宿主声明炉体热容/散热、加热器上限与PI控温参数、活塞摩擦、手动速度和切刀半圈时间(工程参数,须显式接受)', 'evaluator', 'configuration')
|
| 222 |
+
cap('balance.configure', BALANCE, CONFIGURED, BALANCE_EXAMPLE, 'balance_rs232', '配置外接分析天平代理(分辨率、增益/偏置、稳定时间);Mflow本身没有内置天平', 'evaluator', 'configuration')
|
| 223 |
+
cap('method.configure', METHOD, CONFIGURED, METHOD_EXAMPLE, 'controller', '设定方法:试验载荷、预热时间、最长采集时间、采样与切断间隔、活塞位移窗口、温度容差、自动称量', 'agent', 'configuration')
|
| 224 |
+
cap('power.set', obj(dict(enabled=BOOL)), obj(dict(enabled=BOOL)), dict(enabled=True), 'power_switch', '开关整机电源;断电停止加热与切刀、取消进行中的采集,已发生的挤出/热量/切段保留')
|
| 225 |
+
cap('thermal.set_temperature', obj(dict(target_k=number('K', *TEMPERATURE_RANGE_K))), obj(dict(target_k=number('K'))), dict(target_k=523.15), 'heater',
|
| 226 |
+
'只写入料筒目标温度(50–450°C);实际温度由PI控温随宿主step演化')
|
| 227 |
+
cap('weight.configure', obj(dict(total_load_kg=number('kg', *LOAD_RANGE_KG))), obj(dict(total_load_kg=number('kg'))), dict(total_load_kg=2.16), 'test_weight',
|
| 228 |
+
'宿主��动在活塞上放/换砝码,设定总试验载荷(含0.325kg活塞,不重复加算);砝码势能变化计入宿主功', 'evaluator')
|
| 229 |
+
cap('sample.load', SAMPLE, obj(dict(present=BOOL, column_height_m=number('m'))), SAMPLE_EXAMPLE, 'barrel',
|
| 230 |
+
'宿主经漏斗把颗粒/粉末装入料筒(活塞须已抽出);绑定厂家MVR参考记录与显式熔体密度/比热/潜热/幂律/活化能/热历史先验', 'evaluator')
|
| 231 |
+
cap('sample.remove', obj({}), obj(dict(removed_mass_kg=number('kg'))), {}, 'barrel', '宿主清筒带走剩余料及其焓;已挤出的挤出丝/切段不受影响', 'evaluator')
|
| 232 |
+
cap('piston.withdraw', obj({}), obj(dict(target_m=number('m'))), {}, 'piston', '宿主以有限速度把活塞(连同砝码)提到料筒口上方;不是气动提升选件', 'evaluator')
|
| 233 |
+
cap('piston.insert', obj({}), obj(dict(target_m=number('m'))), {}, 'piston', '宿主以有限速度放下活塞,直到压在料柱上(或落到口模上);之后砝码载荷作用于料柱', 'evaluator')
|
| 234 |
+
cap('cutter.cut', obj({}), obj(dict(requested=BOOL)), {}, 'cutter', '切刀转半圈;刀片经过口模下方(π/2)时切断当前挤出丝,形成一个切段(面板“循环”键同此能力)')
|
| 235 |
+
CAPS['cutter.cut']['component_ids'] = ['cutter', 'button_cycle']
|
| 236 |
+
cap('collection.clear', obj({}), obj(dict(collected_mass_kg=number('kg'))), {}, 'collection_tray', '宿主清走收集区全部切段与挂在口模下的挤出丝(称量记录保留)', 'evaluator')
|
| 237 |
+
cap('balance.weigh', obj(dict(segment_id=TEXT)), obj(dict(requested=BOOL)), dict(segment_id='mflow_01:acq:1:segment:2'), 'balance_rs232',
|
| 238 |
+
'请求外接分析天平称量一个切段;经过稳定时间后按分辨率/标定给出观测质量')
|
| 239 |
+
cap('calibration.encoder', CAL_ENCODER, obj(dict(scale=number('1'), offset_m=number('m'))), dict(observed_low_m=0.010, observed_high_m=0.060, reference_low_m=0.010, reference_high_m=0.060),
|
| 240 |
+
'displacement_sensor', '用独立长度标准的两点观测修正位移读数(只用宿主给的观测/参考值,不读过程真值)', 'evaluator')
|
| 241 |
+
cap('calibration.balance', CAL_BALANCE, obj(dict(scale=number('1'), offset_kg=number('kg'))), dict(observed_low_kg=0.0, observed_high_kg=0.001, reference_low_kg=0.0, reference_high_kg=0.001),
|
| 242 |
+
'balance_rs232', '用标准砝码两点观测修正外接天平读数', 'evaluator')
|
| 243 |
+
cap('acquisition.start', obj({}), obj(dict(operation_id=TEXT)), {}, 'button_start',
|
| 244 |
+
'开始采集:核对通电、方法、试样已装且活塞压在料柱上、载荷与方法一致、预热已满、炉温在容差内;先切一次清除预热期挤出物,再按间隔切段并记录位移/时间/温度')
|
| 245 |
+
cap('acquisition.stop', obj({}), obj(dict(phase=PHASE, elapsed_s=number('s'))), {}, 'button_stop', '只终止记录与后续自动切断;已挤出物、切段和热状态保留,活塞继续在载荷下下降')
|
| 246 |
+
cap('acquisition.result', obj({}), RESULT, {}, 'controller', '返回按观测(量化位移/时间、外部称量)计算的MVR/MFR、切段表与有效性;所有角色都隐去所选材料身份', 'agent', 'query')
|
| 247 |
+
cap('analysis.flow', ANALYSIS, ANALYSIS_OUTPUT, dict(start_position_m=0.050, end_position_m=0.020, start_time_s=0.0, end_time_s=60.0, area_prior_m2=STANDARD_AREA_M2,
|
| 248 |
+
weighed_segments=[dict(mass_kg=0.0002, duration_s=10.0)], melt_density_prior_kg_m3=None),
|
| 249 |
+
'controller', 'ISO 1133纯函数分析:MVR=A·Δx/Δt(A为独立面积先验),MFR=Σm/Σt,按需给出密度换算;不读取过程真值', 'agent', 'analysis')
|
| 250 |
+
cap('ledger.read', obj({}), LEDGER, {}, 'controller', '受限质量/能量账本(装料、挤出、清筒、热输入、散热、摩擦、压力功、势能)', 'evaluator', 'query')
|
| 251 |
+
cap('provenance.read', obj({}), obj(dict(current_sample=nullable(TEXT), operation_source=nullable(TEXT))), {}, 'controller', '受限:当前试样与最近采集所用参考记录的来源', 'evaluator', 'query')
|
| 252 |
+
cap('sim.step', obj(dict(dt_s=number('s', 0.0, 86400.0))), obj(dict(time_s=number('s'))), dict(dt_s=0.2), 'controller', '唯一宿主时间推进(纳秒整数时钟,余数累计)', 'evaluator', 'simulation')
|
| 253 |
+
UNSUPPORTED = {
|
| 254 |
+
'hardware.connect': '无真实Ethernet/RS-232/USB通信或testXpert连接',
|
| 255 |
+
'robot.load': '无机器人装料、压实与清筒验证',
|
| 256 |
+
'pneumatic.lift': '未选气动砝码提升单元1128621',
|
| 257 |
+
'pneumatic.load_selector': '未选带选重器的气动提升单元1128624',
|
| 258 |
+
'die.plug': '未选口模塞1128618(高MFR防预流)',
|
| 259 |
+
'die.change': '未建模更换口模;固定标准口模312342(手腕一转解锁口模的动作不在本资产能力内)',
|
| 260 |
+
'method.astm_c_half_die': '未选半口模325554(ASTM D1238方法C)',
|
| 261 |
+
'material.fluorinated_or_pvc': '所选料筒1128612与活塞1128614为非含氟材料用;含氟材料需耐酸料筒1128613/活塞1128615,PVC需口模092326(ASTM D3364),均未选。口模312342本身为烧结耐磨耐酸件、厂家列为含氟与非含氟材料通用',
|
| 262 |
+
'cleaning.pneumatic_function': '未选清洗功能1128622',
|
| 263 |
+
'preload.function': '未选预热期附加预载1128623',
|
| 264 |
+
'piston.preheat_hold': '未选预热位活塞保持装置1128627(可在预热期完全卸载熔体、避免提前流出);本资产预热期由宿主只放活塞0.325kg',
|
| 265 |
+
'collection.separating_pane': '未选收集单个挤出物的分隔板1128619',
|
| 266 |
+
'thermal.recool': '未选压缩空气回冷单元090173(厂家:平均缩短约50%冷却时间);本资产只有自然冷却',
|
| 267 |
+
'accuracy.certification': '没有ISO 1133-2温度准确度认证、天平计量证书或厂家准确度实验',
|
| 268 |
+
}
|
| 269 |
+
for k, v in UNSUPPORTED.items():
|
| 270 |
+
cap(k, obj({}), obj({}), {}, 'controller', v)
|
| 271 |
+
|
| 272 |
+
# ---------------------------------------------------------------- state slots
|
| 273 |
+
SLOTS = {}
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
def slot(k, schema, unit, origin, component, meaning, visibility='agent', reference=None):
|
| 277 |
+
SLOTS[k] = dict(schema=schema, unit=unit, origin=origin, component=component, meaning=meaning, visibility=visibility, reference=reference)
|
| 278 |
+
|
| 279 |
+
|
| 280 |
+
slot('clock.time_s', number('s'), 's', 'derived', 'controller', '宿主时钟;read不推进')
|
| 281 |
+
for k, c, m in [('plant.configured', 'heater', '工程过程参数已声明'), ('method.configured', 'controller', '方法已设定'), ('balance.configured', 'balance_rs232', '外接天平代理已配置'),
|
| 282 |
+
('sample.present', 'barrel', '料筒内有试样'), ('power.enabled', 'power_switch', '整机通电'), ('piston.contact', 'piston', '活塞压在料柱上(载荷作用于试样)'),
|
| 283 |
+
('piston.moving', 'piston', '宿主手动升降进行中'), ('cutter.running', 'cutter', '切刀正在转半圈'), ('balance.busy', 'balance_rs232', '外接天平正在稳定/称量'),
|
| 284 |
+
('encoder.in_range', 'displacement_sensor', '活塞在位移传感器量程内(约0–107mm)且通电')]:
|
| 285 |
+
slot(k, BOOL, '1', 'derived', c, m)
|
| 286 |
+
slot('thermal.target_k', number('K'), 'K', 'setpoint', 'heater', '料筒目标温度,只是目标')
|
| 287 |
+
slot('thermal.indicated_k', nullable(number('K')), 'K', 'sensor', 'heater', '料筒温度显示(0.01K量化);断电为null;未按ISO 1133-2认证')
|
| 288 |
+
slot('heater.output_fraction', number('1', 0.0, 1.0), '1', 'derived', 'heater', 'PI控温输出占加热器上限的比例', 'evaluator')
|
| 289 |
+
slot('weight.total_load_kg', nullable(number('kg')), 'kg', 'setpoint', 'test_weight', '当前放在活塞上的总载荷(含0.325kg活塞);未配置为null')
|
| 290 |
+
slot('method.test_load_kg', nullable(number('kg')), 'kg', 'setpoint', 'controller', '方法声明的试验载荷,采集开始时须与实际载荷一致')
|
| 291 |
+
slot('preheat.elapsed_s', nullable(number('s')), 's', 'derived', 'barrel', '装料后经过的时间(预热计时);无试样为null')
|
| 292 |
+
slot('piston.position_m', number('m', 0.0, PISTON_TRAVEL_M), 'm', 'scene', 'piston', '活塞底面到口模上表面的精确距离(场景关节);agent须通过位移传感器读数观测', 'evaluator',
|
| 293 |
+
'资产坐标+Z;0=活塞底落在口模上表面,0.180m=抽出到料筒口。')
|
| 294 |
+
slot('piston.target_m', number('m', 0.0, PISTON_TRAVEL_M), 'm', 'setpoint', 'piston', '宿主最近一次手动升降命令的目标位置(抽出=0.180m,插入=当时料柱高度);不随挤出更新', 'evaluator')
|
| 295 |
+
slot('sensor_arm.angle_rad', number('rad'), 'rad', 'scene', 'sensor_arm', '位移传感器转臂关节角(0=活塞落在口模上时;滚轮顶住活塞凸环下表面)', 'evaluator',
|
| 296 |
+
'关节绕水平轴(-√½,-√½,0);仰角=asin((位置-0.050)/0.140),超过约0.107m停在上限位。')
|
| 297 |
+
slot('cutter.angle_rad', number('rad', 0.0, CUTTER_TRAVEL_RAD), 'rad', 'scene', 'cutter', '切刀刀片转角;0与π为两侧停位,经过π/2时切断挤出丝', 'evaluator',
|
| 298 |
+
'绕竖直+Z轴;交替半圈0→π→0。')
|
| 299 |
+
slot('power.angle_rad', number('rad'), 'rad', 'scene', 'power_switch', '后置电源摇臂开关姿态:0关、0.28rad开', 'evaluator')
|
| 300 |
+
slot('extrudate.length_m', number('m'), 'm', 'scene', 'extrudate_strand', '挂在口模下尚未切断的挤出丝长度(体积/口模截面,忽略离模膨胀,仅供可视)', 'evaluator',
|
| 301 |
+
'沿−Z自口模出口(z=0.228m)向下;可视上限0.150m。')
|
| 302 |
+
slot('extrudate.last_cut_length_m', number('m'), 'm', 'scene', 'extrudate_segment', '最近一个切段的长度(仅供可视,清走收集区后为0)', 'evaluator')
|
| 303 |
+
slot('encoder.position_m', nullable(number('m')), 'm', 'sensor', 'displacement_sensor', '位移传感器读数:活塞位置按0.003mm量化并经两点标定;超量程或断电为null')
|
| 304 |
+
slot('measurement.live_mvr_m3_s', nullable(number('m^3/s')), 'm^3/s', 'sensor', 'controller', '采集中按最近约4s的量化位移×ISO平均截面0.711cm²估算的实时MVR(屏幕Live MVR);非采集为null',
|
| 305 |
+
reference='熔体在料筒测试温度下的体积流率(不是23°C固体体积)。')
|
| 306 |
+
slot('measurement.mvr_m3_s', nullable(number('m^3/s')), 'm^3/s', 'sensor', 'controller', '最近一次完成采集的方法B MVR(位移窗口内的��化观测)',
|
| 307 |
+
reference='熔体在料筒测试温度下的体积流率;×6e8=cm³/10min。')
|
| 308 |
+
slot('measurement.mfr_kg_s', nullable(number('kg/s')), 'kg/s', 'sensor', 'controller', '最近一次采集的方法A MFR(已称量测量切段Σm/Σt);未称量为null',
|
| 309 |
+
reference='质量流率;×6e5=g/10min。')
|
| 310 |
+
slot('measurement.validity', VALIDITY, '1', 'derived', 'controller', '最近一次采集的有效性')
|
| 311 |
+
slot('acquisition.phase', PHASE, '1', 'derived', 'controller', '采集状态;停止记录不等于停止挤出')
|
| 312 |
+
slot('acquisition.elapsed_s', number('s'), 's', 'derived', 'controller', '当前/最近一次采集的经过时间')
|
| 313 |
+
slot('acquisition.points', INT, '1', 'derived', 'controller', '当前/最近一次采集的记录点数')
|
| 314 |
+
slot('segments.count', INT, '1', 'derived', 'collection_tray', '收集区内切段数(含清除预热挤出物的首段)')
|
| 315 |
+
slot('segments.unweighed', INT, '1', 'derived', 'collection_tray', '尚未称量的测量切段数')
|
| 316 |
+
for k, u, c, m, ref in [('truth.barrel_temperature_k', 'K', 'heater', '料筒/炉体集中热节点真温', None),
|
| 317 |
+
('truth.sample_temperature_k', 'K', 'barrel', '由焓反演的试样平均温度', None),
|
| 318 |
+
('truth.melt_fraction', '1', 'barrel', '熔融分数(熔程内线性)', None),
|
| 319 |
+
('truth.pellet_fraction', '1', 'barrel', '尚未熔实的颗粒质量份额(只减不增;按堆积密度占体积)', None),
|
| 320 |
+
('truth.sample_mass_kg', 'kg', 'barrel', '料筒内剩余试样质量', None),
|
| 321 |
+
('truth.flow_m3_s', 'm^3/s', 'die', '口模真实体积流率(显式流动代理,不作独立测量)', '熔体在试样温度下的体积流率。'),
|
| 322 |
+
('truth.thermal_history_s', 's', 'barrel', '试样高于熔融起点的累计时间', None),
|
| 323 |
+
('truth.strand_mass_kg', 'kg', 'extrudate_strand', '挂在口模下的挤出丝质量', None),
|
| 324 |
+
('truth.heater_power_w', 'W', 'heater', '加热器瞬时功率', None)]:
|
| 325 |
+
slot(k, number(u), u, 'process_truth', c, m, 'evaluator', ref)
|
| 326 |
+
|
| 327 |
+
|
| 328 |
+
def analyze_flow(start_position_m, end_position_m, start_time_s, end_time_s, area_prior_m2, weighed_segments, melt_density_prior_kg_m3):
|
| 329 |
+
"""ISO 1133 arithmetic on external observations only (pure function)."""
|
| 330 |
+
if end_time_s <= start_time_s or start_position_m <= end_position_m:
|
| 331 |
+
raise ActionRejected('OBSERVATION_DOMAIN')
|
| 332 |
+
q = (start_position_m - end_position_m) * area_prior_m2 / (end_time_s - start_time_s)
|
| 333 |
+
total_t = sum(r['duration_s'] for r in weighed_segments)
|
| 334 |
+
mf = sum(r['mass_kg'] for r in weighed_segments) / total_t if weighed_segments else None
|
| 335 |
+
return dict(mvr_m3_s=q, mvr_cm3_10min=q * 6e8, mfr_kg_s=mf, mfr_g_10min=None if mf is None else mf * 6e5,
|
| 336 |
+
density_derived_mfr_kg_s=None if melt_density_prior_kg_m3 is None else q * melt_density_prior_kg_m3,
|
| 337 |
+
density_at_test_temperature_kg_m3=None if mf is None else mf / q,
|
| 338 |
+
evidence='ISO1133 method B: area_prior*dx/dt from supplied quantised positions/times; method A: sum(m)/sum(t) of supplied weighings; '
|
| 339 |
+
'density conversion only with a supplied melt density at test temperature')
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
HISTORY_LN_LIMIT = math.log(1e3) # thermal-history multiplier bounded to 1e-3 .. 1e3 (numerical domain)
|
| 343 |
+
MAX_ROWS = 200000 # rows per acquisition (duration / sample interval + 1 must stay below)
|
| 344 |
+
MAX_SEGMENTS = 10000 # segments per acquisition (RESULT schema maxItems); manual cuts share the budget
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
class ZwickMflowRuntime:
|
| 348 |
+
"""One Mflow instance; the host clock is the only time source (``step``)."""
|
| 349 |
+
|
| 350 |
+
def __init__(self, instance_id='mflow_01'):
|
| 351 |
+
self.instance_id = instance_id
|
| 352 |
+
self.time_ns = 0
|
| 353 |
+
self._clock_remainder_ns = 0.0
|
| 354 |
+
self.revision = 0
|
| 355 |
+
self.plant = None
|
| 356 |
+
self.method = None
|
| 357 |
+
self.balance = None
|
| 358 |
+
self.power = False
|
| 359 |
+
self.target_k = 296.15
|
| 360 |
+
self.T_b = 296.15
|
| 361 |
+
self.integral_w = 0.0
|
| 362 |
+
self.heater_w = 0.0
|
| 363 |
+
self.load_kg = None
|
| 364 |
+
# piston: position = height of the piston bottom above the die top
|
| 365 |
+
self.x = PISTON_TRAVEL_M
|
| 366 |
+
self.x_target = PISTON_TRAVEL_M
|
| 367 |
+
self.contact = False
|
| 368 |
+
self._move = None # dict(start_ns, x0, direction, speed, insert)
|
| 369 |
+
# charge
|
| 370 |
+
self.sample = None
|
| 371 |
+
self.reference = None
|
| 372 |
+
self.reference_cell = None
|
| 373 |
+
self.source = None
|
| 374 |
+
self.m_s = 0.0
|
| 375 |
+
self.H_s = 0.0
|
| 376 |
+
self.m_loaded = 0.0
|
| 377 |
+
self.pellet = 0.0
|
| 378 |
+
self.t_hist = 0.0
|
| 379 |
+
self.load_ns = None
|
| 380 |
+
self.q_true = 0.0
|
| 381 |
+
# extrudate / cutter / balance
|
| 382 |
+
self.strand_kg = 0.0
|
| 383 |
+
self.strand_m3 = 0.0
|
| 384 |
+
self.segments = [] # segments currently lying in the collection area
|
| 385 |
+
self._segment_counter = 0
|
| 386 |
+
self.last_cut_length = 0.0
|
| 387 |
+
self.cutter_angle = 0.0
|
| 388 |
+
self._cut = None # dict(start_ns, mid_ns, end_ns, a0, a1, severed, auto)
|
| 389 |
+
self._weigh_queue = []
|
| 390 |
+
self._weighing = None # dict(segment_id, end_ns)
|
| 391 |
+
self.encoder_cal = (1.0, 0.0)
|
| 392 |
+
self.balance_cal = (1.0, 0.0)
|
| 393 |
+
# acquisitions: each keeps its own method snapshot, rows and segments, so later clears / method changes /
|
| 394 |
+
# weighings of other segments never rewrite a finished record
|
| 395 |
+
self.phase = 'idle'
|
| 396 |
+
self.operation_id = None
|
| 397 |
+
self.elapsed = 0.0
|
| 398 |
+
self.rows = []
|
| 399 |
+
self._counter = 0
|
| 400 |
+
self.terminal_reason = None
|
| 401 |
+
self._operation_source = None
|
| 402 |
+
self._acq = None
|
| 403 |
+
self._acqs = {}
|
| 404 |
+
self.validity = 'not_completed'
|
| 405 |
+
self.flow_result = None
|
| 406 |
+
self.last_mvr = None
|
| 407 |
+
self.last_mfr = None
|
| 408 |
+
self.records = {}
|
| 409 |
+
self._principals = {}
|
| 410 |
+
self._requests = {}
|
| 411 |
+
self._owners = {}
|
| 412 |
+
self._cancel_operations = {}
|
| 413 |
+
self.book = {k: 0.0 for k in ['loaded_mass_kg', 'collected_mass_kg', 'removed_mass_kg', 'heater_input_j', 'host_work_j', 'loaded_enthalpy_j',
|
| 414 |
+
'ambient_export_j', 'extruded_enthalpy_j', 'removed_enthalpy_j', 'friction_heat_j', 'pressure_work_j']}
|
| 415 |
+
|
| 416 |
+
# ------------------------------------------------------------ helpers
|
| 417 |
+
@property
|
| 418 |
+
def time_s(self):
|
| 419 |
+
return self.time_ns / 1e9
|
| 420 |
+
|
| 421 |
+
def register_principal(self, name, visibility):
|
| 422 |
+
if not isinstance(name, str) or not name or visibility not in ('agent', 'evaluator', 'debug') or name in self._principals:
|
| 423 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 424 |
+
self._principals[name] = visibility
|
| 425 |
+
|
| 426 |
+
def session(self, name):
|
| 427 |
+
if not isinstance(name, str) or name not in self._principals:
|
| 428 |
+
raise ActionRejected('ACCESS_DENIED')
|
| 429 |
+
return ZwickMflowSession(self, name)
|
| 430 |
+
|
| 431 |
+
def _ambient(self):
|
| 432 |
+
return self.plant['ambient_k'] if self.plant else 296.15
|
| 433 |
+
|
| 434 |
+
def _phi_of_T(self, T):
|
| 435 |
+
"""Latent fraction used by the equilibrium enthalpy h(T) (a zero-width range melts completely at T >= T_lo)."""
|
| 436 |
+
s = self.sample
|
| 437 |
+
lo, hi = s['melting_low_k'], s['melting_high_k']
|
| 438 |
+
if hi <= lo:
|
| 439 |
+
return 1.0 if T >= lo else 0.0
|
| 440 |
+
return min(1.0, max(0.0, (T - lo) / (hi - lo)))
|
| 441 |
+
|
| 442 |
+
def _h_of_T(self, T):
|
| 443 |
+
s = self.sample
|
| 444 |
+
return s['specific_heat_j_kg_k'] * (T - self._ambient()) + s['latent_heat_j_kg'] * self._phi_of_T(T)
|
| 445 |
+
|
| 446 |
+
def _phase_of_h(self, h):
|
| 447 |
+
"""Exact inverse of the piecewise-linear specific enthalpy -> (temperature, melt fraction).
|
| 448 |
+
|
| 449 |
+
The melt fraction comes from the enthalpy, so a zero-width melting range still needs the whole latent heat."""
|
| 450 |
+
s = self.sample
|
| 451 |
+
cp, L, lo, hi, Ta = s['specific_heat_j_kg_k'], s['latent_heat_j_kg'], s['melting_low_k'], s['melting_high_k'], self._ambient()
|
| 452 |
+
h_lo = cp * (lo - Ta)
|
| 453 |
+
h_hi = cp * (hi - Ta) + L
|
| 454 |
+
if h <= h_lo:
|
| 455 |
+
return Ta + h / cp, 0.0
|
| 456 |
+
if h >= h_hi:
|
| 457 |
+
return Ta + (h - L) / cp, 1.0
|
| 458 |
+
frac = (h - h_lo) / (h_hi - h_lo)
|
| 459 |
+
return lo + frac * (hi - lo), frac
|
| 460 |
+
|
| 461 |
+
def _sample_state(self):
|
| 462 |
+
if not self.sample or self.m_s <= 0:
|
| 463 |
+
return self._ambient(), 0.0
|
| 464 |
+
return self._phase_of_h(self.H_s / self.m_s)
|
| 465 |
+
|
| 466 |
+
def _sample_T(self):
|
| 467 |
+
return self._sample_state()[0]
|
| 468 |
+
|
| 469 |
+
def _phi(self):
|
| 470 |
+
return self._sample_state()[1]
|
| 471 |
+
|
| 472 |
+
def _column_height(self):
|
| 473 |
+
if not self.sample or self.m_s <= 0:
|
| 474 |
+
return 0.0
|
| 475 |
+
s = self.sample
|
| 476 |
+
return self.m_s * (self.pellet / s['bulk_density_kg_m3'] + (1.0 - self.pellet) / s['melt_density_kg_m3']) / STANDARD_AREA_M2
|
| 477 |
+
|
| 478 |
+
def _load_mass(self):
|
| 479 |
+
return PISTON_LOAD_KG if self.load_kg is None else self.load_kg
|
| 480 |
+
|
| 481 |
+
def _flow(self, T, phi):
|
| 482 |
+
"""True melt volume flow through the die (m^3/s) for the loaded, contacting piston."""
|
| 483 |
+
if not (self.sample and self.contact and self.m_s > 0):
|
| 484 |
+
return 0.0
|
| 485 |
+
s, ref = self.sample, self.reference_cell
|
| 486 |
+
force = self._load_mass() * GRAVITY - self.plant['piston_friction_n']
|
| 487 |
+
if force <= 0:
|
| 488 |
+
return 0.0
|
| 489 |
+
n = s['power_law_index']
|
| 490 |
+
history = max(-HISTORY_LN_LIMIT, min(HISTORY_LN_LIMIT, s['history_rate_per_s'] * self.t_hist))
|
| 491 |
+
return (ref['mvr_m3_s'] * (force / (s['reference_load_kg'] * GRAVITY)) ** (1.0 / n)
|
| 492 |
+
* math.exp(-(s['activation_energy_j_mol'] / (n * GAS_CONSTANT)) * (1.0 / T - 1.0 / s['reference_temperature_k']))
|
| 493 |
+
* math.exp(history) * phi ** 3)
|
| 494 |
+
|
| 495 |
+
def _encoder(self):
|
| 496 |
+
if not self.power or not (SENSOR_RANGE_M[0] <= self.x <= SENSOR_RANGE_M[1]):
|
| 497 |
+
return None
|
| 498 |
+
scale, offset = self.encoder_cal
|
| 499 |
+
return quantize(scale * self.x + offset, ENCODER_RESOLUTION_M)
|
| 500 |
+
|
| 501 |
+
def _indicated_T(self):
|
| 502 |
+
return quantize(self.T_b, TEMPERATURE_DISPLAY_RESOLUTION_K) if self.power else None
|
| 503 |
+
|
| 504 |
+
def _live_mvr(self):
|
| 505 |
+
if self.phase != 'running' or not self.power:
|
| 506 |
+
return None
|
| 507 |
+
pts = [r for r in self.rows if r['encoder_position_m'] is not None]
|
| 508 |
+
if len(pts) < 2:
|
| 509 |
+
return None
|
| 510 |
+
last = pts[-1]
|
| 511 |
+
first = next((r for r in pts if last['time_s'] - r['time_s'] <= LIVE_MVR_WINDOW_S + 1e-9), None)
|
| 512 |
+
if first is None or last['time_s'] <= first['time_s']:
|
| 513 |
+
return None
|
| 514 |
+
return max(0.0, (first['encoder_position_m'] - last['encoder_position_m']) * STANDARD_AREA_M2 / (last['time_s'] - first['time_s']))
|
| 515 |
+
|
| 516 |
+
def _obs_time(self, t_ns, acq=None):
|
| 517 |
+
return quantize((t_ns - acq['start_ns']) / 1e9, TIME_RESOLUTION_S) if acq else quantize(t_ns / 1e9, TIME_RESOLUTION_S)
|
| 518 |
+
|
| 519 |
+
def read(self, visibility='agent'):
|
| 520 |
+
T_s, phi = self._sample_state()
|
| 521 |
+
d = {'clock.time_s': self.time_s, 'plant.configured': self.plant is not None, 'method.configured': self.method is not None,
|
| 522 |
+
'balance.configured': self.balance is not None, 'sample.present': self.sample is not None, 'power.enabled': self.power,
|
| 523 |
+
'piston.contact': self.contact, 'piston.moving': self._move is not None, 'cutter.running': self._cut is not None,
|
| 524 |
+
'balance.busy': self._weighing is not None, 'encoder.in_range': self._encoder() is not None,
|
| 525 |
+
'thermal.target_k': self.target_k, 'thermal.indicated_k': self._indicated_T(),
|
| 526 |
+
'heater.output_fraction': self.heater_w / self.plant['heater_max_w'] if self.plant else 0.0,
|
| 527 |
+
'weight.total_load_kg': self.load_kg, 'method.test_load_kg': self.method['test_load_kg'] if self.method else None,
|
| 528 |
+
'preheat.elapsed_s': None if self.load_ns is None else (self.time_ns - self.load_ns) / 1e9,
|
| 529 |
+
'piston.position_m': self.x, 'piston.target_m': self.x_target, 'sensor_arm.angle_rad': sensor_arm_angle(self.x),
|
| 530 |
+
'cutter.angle_rad': self.cutter_angle, 'power.angle_rad': POWER_SWITCH_ON_RAD if self.power else 0.0,
|
| 531 |
+
'extrudate.length_m': self.strand_m3 / DIE_AREA_M2, 'extrudate.last_cut_length_m': self.last_cut_length,
|
| 532 |
+
'encoder.position_m': self._encoder(), 'measurement.live_mvr_m3_s': self._live_mvr(),
|
| 533 |
+
'measurement.mvr_m3_s': self.last_mvr, 'measurement.mfr_kg_s': self.last_mfr, 'measurement.validity': self.validity,
|
| 534 |
+
'acquisition.phase': self.phase, 'acquisition.elapsed_s': self.elapsed, 'acquisition.points': len(self.rows),
|
| 535 |
+
'segments.count': len(self.segments), 'segments.unweighed': sum(1 for g in self.segments if g['measurement_segment'] and g['status'] != 'weighed'),
|
| 536 |
+
'truth.barrel_temperature_k': self.T_b, 'truth.sample_temperature_k': T_s, 'truth.melt_fraction': phi,
|
| 537 |
+
'truth.pellet_fraction': self.pellet, 'truth.sample_mass_kg': self.m_s, 'truth.flow_m3_s': self.q_true,
|
| 538 |
+
'truth.thermal_history_s': self.t_hist, 'truth.strand_mass_kg': self.strand_kg, 'truth.heater_power_w': self.heater_w}
|
| 539 |
+
return {k: copy.deepcopy(v) for k, v in d.items() if visibility != 'agent' or SLOTS[k]['visibility'] == 'agent'}
|
| 540 |
+
|
| 541 |
+
def ledger(self):
|
| 542 |
+
b = copy.deepcopy(self.book)
|
| 543 |
+
seg_mass = sum(g['true_mass_kg'] for g in self.segments)
|
| 544 |
+
b.update(sample_mass_kg=self.m_s, strand_mass_kg=self.strand_kg, segments_mass_kg=seg_mass,
|
| 545 |
+
extruded_mass_kg=self.strand_kg + seg_mass + self.book['collected_mass_kg'],
|
| 546 |
+
barrel_thermal_j=(self.plant['barrel_heat_capacity_j_k'] * (self.T_b - self._ambient())) if self.plant else 0.0,
|
| 547 |
+
sample_enthalpy_j=self.H_s, load_potential_j=self._load_mass() * GRAVITY * self.x)
|
| 548 |
+
b['mass_residual_kg'] = b['loaded_mass_kg'] - self.m_s - self.strand_kg - seg_mass - b['collected_mass_kg'] - b['removed_mass_kg']
|
| 549 |
+
b['energy_residual_j'] = (b['heater_input_j'] + b['host_work_j'] + b['loaded_enthalpy_j'] - b['barrel_thermal_j'] - b['sample_enthalpy_j']
|
| 550 |
+
- (b['load_potential_j'] - self._potential0) - b['ambient_export_j'] - b['extruded_enthalpy_j'] - b['removed_enthalpy_j'])
|
| 551 |
+
return b
|
| 552 |
+
|
| 553 |
+
_potential0 = PISTON_LOAD_KG * GRAVITY * PISTON_TRAVEL_M
|
| 554 |
+
|
| 555 |
+
# ------------------------------------------------------------ acquisition bookkeeping
|
| 556 |
+
def _record(self, t_ns):
|
| 557 |
+
enc = self._encoder()
|
| 558 |
+
quality = 'power_off' if not self.power else 'ok' if enc is not None else 'encoder_out_of_range'
|
| 559 |
+
self.rows.append(dict(point_index=len(self.rows), time_s=self._obs_time(t_ns, self._acq), encoder_position_m=enc, temperature_k=self._indicated_T(), quality=quality))
|
| 560 |
+
|
| 561 |
+
@staticmethod
|
| 562 |
+
def _public_segments(segments):
|
| 563 |
+
return [dict(segment_id=g['segment_id'], start_time_s=g['start_obs_s'], end_time_s=g['end_obs_s'],
|
| 564 |
+
duration_s=None if g['start_obs_s'] is None else quantize(g['end_obs_s'] - g['start_obs_s'], TIME_RESOLUTION_S),
|
| 565 |
+
observed_mass_kg=g['observed_mass_kg'], status=g['status'], measurement_segment=g['measurement_segment']) for g in segments]
|
| 566 |
+
|
| 567 |
+
@staticmethod
|
| 568 |
+
def _compute_flow(acq):
|
| 569 |
+
"""Method B from the acquisition's own rows and window; method A from its own weighed measurement segments."""
|
| 570 |
+
m = acq['method']
|
| 571 |
+
pts = [r for r in acq['rows'] if r['encoder_position_m'] is not None and r['quality'] == 'ok']
|
| 572 |
+
inside = [r for r in pts if m['window_lower_m'] - 1e-12 <= r['encoder_position_m'] <= m['window_upper_m'] + 1e-12]
|
| 573 |
+
mvr = None
|
| 574 |
+
window = None
|
| 575 |
+
if len(inside) >= 2 and inside[0]['encoder_position_m'] > inside[-1]['encoder_position_m'] and inside[-1]['time_s'] > inside[0]['time_s']:
|
| 576 |
+
a, b = inside[0], inside[-1]
|
| 577 |
+
mvr = (a['encoder_position_m'] - b['encoder_position_m']) * STANDARD_AREA_M2 / (b['time_s'] - a['time_s'])
|
| 578 |
+
window = ([a['encoder_position_m'], b['encoder_position_m']], [a['time_s'], b['time_s']])
|
| 579 |
+
weighed = [g for g in acq['segments'] if g['measurement_segment'] and g['status'] == 'weighed']
|
| 580 |
+
mfr = None
|
| 581 |
+
if weighed:
|
| 582 |
+
mfr = sum(g['observed_mass_kg'] for g in weighed) / sum(quantize(g['end_obs_s'] - g['start_obs_s'], TIME_RESOLUTION_S) for g in weighed)
|
| 583 |
+
if mvr is None and mfr is None:
|
| 584 |
+
return None
|
| 585 |
+
return dict(mvr_m3_s=mvr, mvr_cm3_10min=None if mvr is None else mvr * 6e8, mfr_kg_s=mfr, mfr_g_10min=None if mfr is None else mfr * 6e5,
|
| 586 |
+
density_at_test_temperature_kg_m3=None if (mvr is None or mfr is None or mvr <= 0) else mfr / mvr,
|
| 587 |
+
window_positions_m=None if window is None else window[0], window_times_s=None if window is None else window[1], weighed_segments=len(weighed),
|
| 588 |
+
evidence='method B: ISO mean area 0.711 cm^2 x quantised encoder displacement / quantised time inside the window of the method used for this run; '
|
| 589 |
+
'method A: externally weighed measurement segments of this run / their quantised cut interval')
|
| 590 |
+
|
| 591 |
+
def _result_of(self, acq):
|
| 592 |
+
return dict(operation_id=acq['op'], phase=acq['phase'], elapsed_s=acq['elapsed'], test_temperature_k=acq['target_k'], test_load_kg=acq['load_kg'],
|
| 593 |
+
rows=copy.deepcopy(acq['rows']), segments=self._public_segments(acq['segments']),
|
| 594 |
+
flow=copy.deepcopy(acq['flow']) if acq['phase'] != 'running' else None, validity=acq['validity'], terminal_reason=acq['terminal_reason'],
|
| 595 |
+
template_source=acq['source'],
|
| 596 |
+
evidence='synthetic_forward_model; quantised encoder/time/temperature observations and external weighings; manufacturer MVR scalar '
|
| 597 |
+
'transferred with explicit rheology/thermal/density priors; not native Mflow data')
|
| 598 |
+
|
| 599 |
+
def _result(self):
|
| 600 |
+
if self._acq is None:
|
| 601 |
+
return dict(operation_id=None, phase='idle', elapsed_s=0.0, test_temperature_k=None, test_load_kg=None, rows=[], segments=[], flow=None,
|
| 602 |
+
validity='not_completed', terminal_reason=None, template_source=None, evidence='no_measurement')
|
| 603 |
+
if self._acq['phase'] == 'running':
|
| 604 |
+
return self._result_of(self._acq)
|
| 605 |
+
return copy.deepcopy(self.records[self._acq['op']])
|
| 606 |
+
|
| 607 |
+
def _finish(self, phase, reason):
|
| 608 |
+
acq = self._acq
|
| 609 |
+
method = acq['method']
|
| 610 |
+
if phase == 'cancelled':
|
| 611 |
+
validity = 'cancelled'
|
| 612 |
+
elif reason == 'SAMPLE_EXHAUSTED':
|
| 613 |
+
validity = 'sample_exhausted'
|
| 614 |
+
elif not acq['window_traversed']:
|
| 615 |
+
validity = 'window_not_traversed'
|
| 616 |
+
elif acq['temperature_excursion']:
|
| 617 |
+
validity = 'temperature_out_of_tolerance'
|
| 618 |
+
elif method['preheat_time_s'] < 300.0:
|
| 619 |
+
validity = 'preheat_below_iso_minimum'
|
| 620 |
+
else:
|
| 621 |
+
validity = 'valid'
|
| 622 |
+
acq.update(phase=phase, terminal_reason=reason, validity=validity, end_ns=self.time_ns, elapsed=self.elapsed)
|
| 623 |
+
acq['flow'] = self._compute_flow(acq)
|
| 624 |
+
self.phase, self.terminal_reason, self.validity, self.flow_result = phase, reason, validity, acq['flow']
|
| 625 |
+
ok = acq['flow'] is not None and validity == 'valid'
|
| 626 |
+
self.last_mvr = acq['flow']['mvr_m3_s'] if ok else None
|
| 627 |
+
self.last_mfr = acq['flow']['mfr_kg_s'] if ok else None
|
| 628 |
+
self.records[acq['op']] = self._result_of(acq)
|
| 629 |
+
|
| 630 |
+
def _refresh_record(self, op):
|
| 631 |
+
"""A weighing that finishes after its run updates only that run's record (masses only, same method snapshot)."""
|
| 632 |
+
acq = self._acqs.get(op)
|
| 633 |
+
if acq is None or acq['phase'] == 'running':
|
| 634 |
+
return
|
| 635 |
+
acq['flow'] = self._compute_flow(acq)
|
| 636 |
+
self.records[op] = self._result_of(acq)
|
| 637 |
+
if op == self.operation_id:
|
| 638 |
+
self.flow_result = acq['flow']
|
| 639 |
+
if acq['validity'] == 'valid' and acq['flow'] is not None:
|
| 640 |
+
self.last_mfr = acq['flow']['mfr_kg_s']
|
| 641 |
+
|
| 642 |
+
# ------------------------------------------------------------ cutter and balance
|
| 643 |
+
def _start_cut(self, auto):
|
| 644 |
+
"""Blade moves from where it stands to the far rest (0 or pi); the strand is severed where the path crosses pi/2."""
|
| 645 |
+
a0 = self.cutter_angle
|
| 646 |
+
a1 = CUTTER_TRAVEL_RAD if a0 < CUTTER_TRAVEL_RAD / 2 else 0.0
|
| 647 |
+
duration = max(1, round(self.plant['cutter_half_turn_s'] * 1e9 * abs(a1 - a0) / CUTTER_TRAVEL_RAD))
|
| 648 |
+
frac = (CUTTER_TRAVEL_RAD / 2 - a0) / (a1 - a0)
|
| 649 |
+
self._cut = dict(start_ns=self.time_ns, mid_ns=self.time_ns + round(frac * duration), end_ns=self.time_ns + duration, a0=a0, a1=a1, severed=False, auto=auto)
|
| 650 |
+
|
| 651 |
+
def _sever(self, t_ns):
|
| 652 |
+
"""Blade crosses pi/2: the hanging strand becomes a segment."""
|
| 653 |
+
acq = self._acq if self.phase == 'running' else None
|
| 654 |
+
if acq is not None:
|
| 655 |
+
acq['cuts'] += 1
|
| 656 |
+
op = acq['op'] if acq is not None else 'manual'
|
| 657 |
+
start_obs = acq['last_cut_obs'] if acq is not None else None
|
| 658 |
+
end_obs = self._obs_time(t_ns, acq)
|
| 659 |
+
measurement = acq is not None and acq['cuts'] >= 2
|
| 660 |
+
if self.strand_kg > 0 or acq is not None:
|
| 661 |
+
self._segment_counter += 1
|
| 662 |
+
seg = dict(segment_id=f'{op}:segment:{self._segment_counter}', operation_id=op, true_mass_kg=self.strand_kg, true_volume_m3=self.strand_m3,
|
| 663 |
+
start_obs_s=start_obs if measurement else None, end_obs_s=end_obs, observed_mass_kg=None, status='unweighed',
|
| 664 |
+
measurement_segment=measurement)
|
| 665 |
+
self.segments.append(seg)
|
| 666 |
+
if acq is not None:
|
| 667 |
+
acq['segments'].append(seg)
|
| 668 |
+
self.last_cut_length = self.strand_m3 / DIE_AREA_M2
|
| 669 |
+
if measurement and acq['method']['automatic_weighing'] and self.balance is not None:
|
| 670 |
+
self._weigh_queue.append(seg['segment_id'])
|
| 671 |
+
self._start_next_weighing()
|
| 672 |
+
self.strand_kg = 0.0
|
| 673 |
+
self.strand_m3 = 0.0
|
| 674 |
+
if acq is not None:
|
| 675 |
+
acq['last_cut_obs'] = end_obs
|
| 676 |
+
|
| 677 |
+
def _start_next_weighing(self):
|
| 678 |
+
if self._weighing is None and self._weigh_queue and self.balance is not None:
|
| 679 |
+
sid = self._weigh_queue.pop(0)
|
| 680 |
+
seg = next(g for g in self.segments if g['segment_id'] == sid)
|
| 681 |
+
seg['status'] = 'weighing'
|
| 682 |
+
self._weighing = dict(segment_id=sid, end_ns=self.time_ns + max(1, round(self.balance['settling_s'] * 1e9)))
|
| 683 |
+
|
| 684 |
+
def _complete_weighing(self):
|
| 685 |
+
w = self._weighing
|
| 686 |
+
self._weighing = None
|
| 687 |
+
seg = next((g for g in self.segments if g['segment_id'] == w['segment_id']), None)
|
| 688 |
+
if seg is not None:
|
| 689 |
+
b = self.balance
|
| 690 |
+
scale, offset = self.balance_cal
|
| 691 |
+
raw = quantize(b['gain'] * seg['true_mass_kg'] + b['offset_kg'], b['resolution_kg'])
|
| 692 |
+
seg['observed_mass_kg'] = scale * raw + offset
|
| 693 |
+
seg['status'] = 'weighed'
|
| 694 |
+
self._refresh_record(seg['operation_id'])
|
| 695 |
+
self._start_next_weighing()
|
| 696 |
+
|
| 697 |
+
# ------------------------------------------------------------ commands
|
| 698 |
+
def invoke(self, capability_id, **arguments):
|
| 699 |
+
if capability_id not in CAPS:
|
| 700 |
+
raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 701 |
+
validate(CAPS[capability_id]['input_schema'], arguments)
|
| 702 |
+
k = capability_id
|
| 703 |
+
a = copy.deepcopy(arguments)
|
| 704 |
+
if k in UNSUPPORTED:
|
| 705 |
+
raise ActionRejected('UNSUPPORTED')
|
| 706 |
+
if k == 'acquisition.result':
|
| 707 |
+
return self._result()
|
| 708 |
+
if k == 'ledger.read':
|
| 709 |
+
return self.ledger()
|
| 710 |
+
if k == 'provenance.read':
|
| 711 |
+
return dict(current_sample=self.source, operation_source=self._operation_source)
|
| 712 |
+
if k == 'analysis.flow':
|
| 713 |
+
return analyze_flow(**a)
|
| 714 |
+
if k == 'sim.step':
|
| 715 |
+
self.step(a['dt_s'])
|
| 716 |
+
return dict(time_s=self.time_s)
|
| 717 |
+
if self.phase == 'running' and k not in ('acquisition.stop', 'power.set', 'balance.weigh', 'thermal.set_temperature', 'cutter.cut'):
|
| 718 |
+
raise ActionRejected('BUSY')
|
| 719 |
+
if k == 'plant.configure':
|
| 720 |
+
if self.plant is not None:
|
| 721 |
+
raise ActionRejected('PLANT_ALREADY_CONFIGURED')
|
| 722 |
+
if not a['accept_engineering']:
|
| 723 |
+
raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED')
|
| 724 |
+
if a['barrel_heat_capacity_j_k'] / (a['controller_gain_w_k'] + a['barrel_loss_w_k']) < 5 * MAX_SUBSTEP_S:
|
| 725 |
+
raise ActionRejected('THERMAL_TIME_CONSTANT_OUTSIDE_NUMERICAL_DOMAIN')
|
| 726 |
+
self.plant = a
|
| 727 |
+
self.T_b = a['ambient_k']
|
| 728 |
+
self.target_k = max(TEMPERATURE_RANGE_K[0], a['ambient_k'])
|
| 729 |
+
out = dict(configured=True)
|
| 730 |
+
elif k == 'balance.configure':
|
| 731 |
+
if not a['accept_external_balance_proxy']:
|
| 732 |
+
raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED')
|
| 733 |
+
if self._weighing is not None:
|
| 734 |
+
raise ActionRejected('BALANCE_BUSY')
|
| 735 |
+
self.balance = a
|
| 736 |
+
out = dict(configured=True)
|
| 737 |
+
elif k == 'method.configure':
|
| 738 |
+
if a['window_upper_m'] <= a['window_lower_m']:
|
| 739 |
+
raise ActionRejected('INVALID_WINDOW')
|
| 740 |
+
nanos = a['sample_interval_s'] / TIME_RESOLUTION_S
|
| 741 |
+
if abs(nanos - round(nanos)) > 1e-6:
|
| 742 |
+
raise ActionRejected('SAMPLING_NOT_ON_TIME_BASE')
|
| 743 |
+
if a['duration_s'] / a['sample_interval_s'] + 2 > MAX_ROWS:
|
| 744 |
+
raise ActionRejected('TOO_MANY_SAMPLES')
|
| 745 |
+
self.method = a
|
| 746 |
+
out = dict(configured=True)
|
| 747 |
+
elif k == 'power.set':
|
| 748 |
+
if self.plant is None:
|
| 749 |
+
raise ActionRejected('PLANT_REQUIRED')
|
| 750 |
+
if not a['enabled']:
|
| 751 |
+
if self.phase == 'running':
|
| 752 |
+
self._finish('cancelled', 'POWER_OFF')
|
| 753 |
+
if self._cut is not None:
|
| 754 |
+
self._cut = None # blade stops where it is; an uncrossed turn does not cut
|
| 755 |
+
self.heater_w = 0.0
|
| 756 |
+
self.integral_w = 0.0
|
| 757 |
+
self.power = a['enabled']
|
| 758 |
+
out = dict(enabled=self.power)
|
| 759 |
+
elif k == 'thermal.set_temperature':
|
| 760 |
+
if self.plant is None:
|
| 761 |
+
raise ActionRejected('PLANT_REQUIRED')
|
| 762 |
+
self.target_k = a['target_k']
|
| 763 |
+
out = dict(target_k=self.target_k)
|
| 764 |
+
elif k == 'weight.configure':
|
| 765 |
+
if self.plant is None:
|
| 766 |
+
raise ActionRejected('PLANT_REQUIRED')
|
| 767 |
+
if self._move is not None:
|
| 768 |
+
raise ActionRejected('PISTON_MOVING')
|
| 769 |
+
old = self._load_mass()
|
| 770 |
+
self.load_kg = a['total_load_kg']
|
| 771 |
+
self.book['host_work_j'] += (self._load_mass() - old) * GRAVITY * self.x
|
| 772 |
+
out = dict(total_load_kg=self.load_kg)
|
| 773 |
+
elif k == 'sample.load':
|
| 774 |
+
if self.plant is None:
|
| 775 |
+
raise ActionRejected('PLANT_REQUIRED')
|
| 776 |
+
if self.sample is not None:
|
| 777 |
+
raise ActionRejected('SAMPLE_PRESENT')
|
| 778 |
+
if self._move is not None or self.x < PISTON_TRAVEL_M - 1e-12:
|
| 779 |
+
raise ActionRejected('PISTON_NOT_WITHDRAWN')
|
| 780 |
+
if not a['accept_rheology_thermal_density_and_packing_assumptions']:
|
| 781 |
+
raise ActionRejected('ENGINEERING_ACCEPTANCE_REQUIRED')
|
| 782 |
+
if a['melting_high_k'] < a['melting_low_k']:
|
| 783 |
+
raise ActionRejected('INVALID_MELTING_RANGE')
|
| 784 |
+
if a['bulk_density_kg_m3'] > a['melt_density_kg_m3']:
|
| 785 |
+
raise ActionRejected('BULK_DENSITY_EXCEEDS_MELT_DENSITY')
|
| 786 |
+
ref = library().get(a['reference_id'])
|
| 787 |
+
if ref is None:
|
| 788 |
+
raise ActionRejected('UNKNOWN_REFERENCE')
|
| 789 |
+
cell = next((m for m in ref['measurements'] if m.get('mvr_m3_s') is not None
|
| 790 |
+
and abs(m['reference_temperature_K'] - a['reference_temperature_k']) < 1e-6 and abs(m['reference_load_kg'] - a['reference_load_kg']) < 1e-9), None)
|
| 791 |
+
if cell is None:
|
| 792 |
+
raise ActionRejected('NO_NUMERIC_REFERENCE_AT_CONDITION')
|
| 793 |
+
height = a['mass_kg'] / (a['bulk_density_kg_m3'] * STANDARD_AREA_M2)
|
| 794 |
+
if height > BARREL_LENGTH_M:
|
| 795 |
+
raise ActionRejected('CHARGE_EXCEEDS_BARREL')
|
| 796 |
+
self.sample = a
|
| 797 |
+
self.reference = ref
|
| 798 |
+
self.reference_cell = cell
|
| 799 |
+
self.source = json.dumps(dict(reference_id=a['reference_id'], grade=ref.get('grade'), condition=[cell['reference_temperature_K'], cell['reference_load_kg']],
|
| 800 |
+
mvr_m3_s=cell['mvr_m3_s'], source=cell.get('source', {}).get('publication')), sort_keys=True, ensure_ascii=False)
|
| 801 |
+
self.m_s = a['mass_kg']
|
| 802 |
+
self.m_loaded = a['mass_kg']
|
| 803 |
+
self.pellet = 1.0
|
| 804 |
+
self.t_hist = 0.0
|
| 805 |
+
self.H_s = a['mass_kg'] * self._h_of_T(a['initial_temperature_k'])
|
| 806 |
+
self.book['loaded_mass_kg'] += a['mass_kg']
|
| 807 |
+
self.book['loaded_enthalpy_j'] += self.H_s
|
| 808 |
+
self.load_ns = self.time_ns
|
| 809 |
+
out = dict(present=True, column_height_m=height)
|
| 810 |
+
elif k == 'sample.remove':
|
| 811 |
+
if self.sample is None:
|
| 812 |
+
raise ActionRejected('NO_SAMPLE')
|
| 813 |
+
if self._move is not None or self.x < PISTON_TRAVEL_M - 1e-12:
|
| 814 |
+
raise ActionRejected('PISTON_NOT_WITHDRAWN')
|
| 815 |
+
removed = self.m_s
|
| 816 |
+
self.book['removed_mass_kg'] += removed
|
| 817 |
+
self.book['removed_enthalpy_j'] += self.H_s
|
| 818 |
+
self.m_s = 0.0
|
| 819 |
+
self.H_s = 0.0
|
| 820 |
+
self.sample = self.reference = self.reference_cell = self.source = None
|
| 821 |
+
self.pellet = 0.0
|
| 822 |
+
self.t_hist = 0.0
|
| 823 |
+
self.load_ns = None
|
| 824 |
+
out = dict(removed_mass_kg=removed)
|
| 825 |
+
elif k in ('piston.withdraw', 'piston.insert'):
|
| 826 |
+
if self.plant is None:
|
| 827 |
+
raise ActionRejected('PLANT_REQUIRED')
|
| 828 |
+
if self._move is not None:
|
| 829 |
+
raise ActionRejected('PISTON_MOVING')
|
| 830 |
+
if k == 'piston.withdraw':
|
| 831 |
+
target = PISTON_TRAVEL_M
|
| 832 |
+
self.contact = False
|
| 833 |
+
else:
|
| 834 |
+
if self.contact:
|
| 835 |
+
raise ActionRejected('ALREADY_IN_CONTACT')
|
| 836 |
+
target = max(self._column_height(), 0.0)
|
| 837 |
+
self.x_target = target
|
| 838 |
+
if abs(target - self.x) > 1e-12:
|
| 839 |
+
self._move = dict(start_ns=self.time_ns, x0=self.x, direction=1.0 if target > self.x else -1.0, speed=self.plant['manual_piston_speed_m_s'], insert=k == 'piston.insert')
|
| 840 |
+
elif k == 'piston.insert':
|
| 841 |
+
self.contact = True
|
| 842 |
+
out = dict(target_m=target)
|
| 843 |
+
elif k == 'cutter.cut':
|
| 844 |
+
if not self.power:
|
| 845 |
+
raise ActionRejected('POWER_OFF')
|
| 846 |
+
if self._cut is not None:
|
| 847 |
+
raise ActionRejected('CUTTER_BUSY')
|
| 848 |
+
if self.phase == 'running':
|
| 849 |
+
if self._acq['manual_cuts'] >= self._acq['manual_cut_budget']:
|
| 850 |
+
raise ActionRejected('TOO_MANY_SEGMENTS')
|
| 851 |
+
self._acq['manual_cuts'] += 1
|
| 852 |
+
self._start_cut(auto=False)
|
| 853 |
+
out = dict(requested=True)
|
| 854 |
+
elif k == 'collection.clear':
|
| 855 |
+
if self._weighing is not None:
|
| 856 |
+
raise ActionRejected('BALANCE_BUSY')
|
| 857 |
+
collected = self.strand_kg + sum(g['true_mass_kg'] for g in self.segments)
|
| 858 |
+
self.book['collected_mass_kg'] += collected
|
| 859 |
+
self.strand_kg = self.strand_m3 = 0.0
|
| 860 |
+
self.segments = []
|
| 861 |
+
self._weigh_queue = []
|
| 862 |
+
self.last_cut_length = 0.0
|
| 863 |
+
out = dict(collected_mass_kg=collected)
|
| 864 |
+
elif k == 'balance.weigh':
|
| 865 |
+
if self.balance is None:
|
| 866 |
+
raise ActionRejected('BALANCE_REQUIRED')
|
| 867 |
+
seg = next((g for g in self.segments if g['segment_id'] == a['segment_id']), None)
|
| 868 |
+
if seg is None:
|
| 869 |
+
raise ActionRejected('UNKNOWN_SEGMENT')
|
| 870 |
+
if seg['status'] != 'unweighed' or a['segment_id'] in self._weigh_queue:
|
| 871 |
+
raise ActionRejected('SEGMENT_ALREADY_WEIGHED_OR_QUEUED')
|
| 872 |
+
self._weigh_queue.append(a['segment_id'])
|
| 873 |
+
self._start_next_weighing()
|
| 874 |
+
out = dict(requested=True)
|
| 875 |
+
elif k == 'calibration.encoder':
|
| 876 |
+
if a['observed_high_m'] - a['observed_low_m'] <= 1e-6 or a['reference_high_m'] - a['reference_low_m'] <= 1e-6:
|
| 877 |
+
raise ActionRejected('DEGENERATE_CALIBRATION')
|
| 878 |
+
# observed readings were taken with the current correction: compose the new correction on top
|
| 879 |
+
s_old, o_old = self.encoder_cal
|
| 880 |
+
gain = (a['reference_high_m'] - a['reference_low_m']) / (a['observed_high_m'] - a['observed_low_m'])
|
| 881 |
+
off = a['reference_low_m'] - gain * a['observed_low_m']
|
| 882 |
+
self.encoder_cal = (gain * s_old, gain * o_old + off)
|
| 883 |
+
out = dict(scale=self.encoder_cal[0], offset_m=self.encoder_cal[1])
|
| 884 |
+
elif k == 'calibration.balance':
|
| 885 |
+
if a['observed_high_kg'] - a['observed_low_kg'] <= 1e-9 or a['reference_high_kg'] - a['reference_low_kg'] <= 1e-9:
|
| 886 |
+
raise ActionRejected('DEGENERATE_CALIBRATION')
|
| 887 |
+
s_old, o_old = self.balance_cal
|
| 888 |
+
gain = (a['reference_high_kg'] - a['reference_low_kg']) / (a['observed_high_kg'] - a['observed_low_kg'])
|
| 889 |
+
off = a['reference_low_kg'] - gain * a['observed_low_kg']
|
| 890 |
+
self.balance_cal = (gain * s_old, gain * o_old + off)
|
| 891 |
+
out = dict(scale=self.balance_cal[0], offset_kg=self.balance_cal[1])
|
| 892 |
+
elif k == 'acquisition.start':
|
| 893 |
+
if not self.power:
|
| 894 |
+
raise ActionRejected('POWER_OFF')
|
| 895 |
+
if self.plant is None or self.method is None:
|
| 896 |
+
raise ActionRejected('CONFIGURATION_REQUIRED')
|
| 897 |
+
if self.sample is None:
|
| 898 |
+
raise ActionRejected('NO_SAMPLE')
|
| 899 |
+
if not self.contact or self._move is not None:
|
| 900 |
+
raise ActionRejected('PISTON_NOT_ON_CHARGE')
|
| 901 |
+
if self.load_kg is None or abs(self.load_kg - self.method['test_load_kg']) > 1e-9:
|
| 902 |
+
raise ActionRejected('LOAD_MISMATCH')
|
| 903 |
+
if (self.time_ns - self.load_ns) / 1e9 < self.method['preheat_time_s'] - 1e-9:
|
| 904 |
+
raise ActionRejected('PREHEAT_NOT_COMPLETE')
|
| 905 |
+
if abs(self._indicated_T() - self.target_k) > self.method['temperature_tolerance_k'] + 1e-9:
|
| 906 |
+
raise ActionRejected('TEMPERATURE_NOT_STABLE')
|
| 907 |
+
if self._cut is not None:
|
| 908 |
+
raise ActionRejected('CUTTER_BUSY')
|
| 909 |
+
ci = self.method['cut_interval_s']
|
| 910 |
+
if ci is not None and ci < 1.5 * self.plant['cutter_half_turn_s']:
|
| 911 |
+
raise ActionRejected('CUT_INTERVAL_TOO_SHORT')
|
| 912 |
+
self._counter += 1
|
| 913 |
+
self.operation_id = f'{self.instance_id}:acq:{self._counter}'
|
| 914 |
+
self.phase = 'running'
|
| 915 |
+
self.elapsed = 0.0
|
| 916 |
+
self.terminal_reason = None
|
| 917 |
+
self.validity = 'not_completed'
|
| 918 |
+
self.flow_result = None
|
| 919 |
+
self._operation_source = self.source
|
| 920 |
+
period = round(self.method['sample_interval_s'] * 1e9)
|
| 921 |
+
self._acq = dict(op=self.operation_id, method=copy.deepcopy(self.method), rows=[], segments=[], phase='running', validity='not_completed',
|
| 922 |
+
terminal_reason=None, flow=None, elapsed=0.0, source=self.source, start_ns=self.time_ns,
|
| 923 |
+
end_limit_ns=self.time_ns + round(self.method['duration_s'] * 1e9), period_ns=period,
|
| 924 |
+
next_sample_ns=self.time_ns + period, next_cut_ns=None if ci is None else self.time_ns + round(ci * 1e9),
|
| 925 |
+
cuts=0, last_cut_obs=None, window_traversed=False, temperature_excursion=False, target_k=self.target_k, load_kg=self.load_kg, end_ns=None)
|
| 926 |
+
auto_cuts = 0 if ci is None else int(self.method['duration_s'] // ci) + 2
|
| 927 |
+
self._acq.update(manual_cut_budget=MAX_SEGMENTS - auto_cuts, manual_cuts=0)
|
| 928 |
+
self._acqs[self.operation_id] = self._acq
|
| 929 |
+
self.rows = self._acq['rows']
|
| 930 |
+
self._record(self.time_ns)
|
| 931 |
+
if ci is not None:
|
| 932 |
+
self._start_cut(auto=True) # trim cut: removes what flowed during the preheat
|
| 933 |
+
out = dict(operation_id=self.operation_id)
|
| 934 |
+
elif k == 'acquisition.stop':
|
| 935 |
+
if self.phase != 'running':
|
| 936 |
+
raise ActionRejected('NOT_RUNNING')
|
| 937 |
+
self._finish('cancelled', 'USER_CANCEL')
|
| 938 |
+
out = dict(phase=self.phase, elapsed_s=self.elapsed)
|
| 939 |
+
else:
|
| 940 |
+
raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 941 |
+
self.revision += 1
|
| 942 |
+
return copy.deepcopy(out)
|
| 943 |
+
|
| 944 |
+
# ------------------------------------------------------------ time integration
|
| 945 |
+
def _next_events(self, end):
|
| 946 |
+
ev = [end, self.time_ns + round(MAX_SUBSTEP_S * 1e9)]
|
| 947 |
+
if self._move is not None:
|
| 948 |
+
m = self._move
|
| 949 |
+
dist = abs(self.x_target - m['x0'])
|
| 950 |
+
ev.append(m['start_ns'] + max(1, math.ceil(dist / m['speed'] * 1e9)))
|
| 951 |
+
if self._cut is not None:
|
| 952 |
+
ev += [self._cut['mid_ns'], self._cut['end_ns']] if not self._cut['severed'] else [self._cut['end_ns']]
|
| 953 |
+
if self._weighing is not None:
|
| 954 |
+
ev.append(self._weighing['end_ns'])
|
| 955 |
+
if self.phase == 'running':
|
| 956 |
+
ev += [self._acq['next_sample_ns'], self._acq['end_limit_ns']]
|
| 957 |
+
if self._acq['next_cut_ns'] is not None:
|
| 958 |
+
ev.append(self._acq['next_cut_ns'])
|
| 959 |
+
return min(t for t in ev if t > self.time_ns)
|
| 960 |
+
|
| 961 |
+
def _integrate(self, dt):
|
| 962 |
+
"""Explicit conservative update over one sub-step (all energy terms booked with the same values)."""
|
| 963 |
+
p = self.plant
|
| 964 |
+
Ta = p['ambient_k']
|
| 965 |
+
# heater: PI with conditional integration (anti-windup)
|
| 966 |
+
if self.power:
|
| 967 |
+
e = self.target_k - self.T_b
|
| 968 |
+
u = p['controller_gain_w_k'] * e + self.integral_w
|
| 969 |
+
P = min(max(u, 0.0), p['heater_max_w'])
|
| 970 |
+
if 0.0 < u < p['heater_max_w'] or (u >= p['heater_max_w'] and e < 0) or (u <= 0 and e > 0):
|
| 971 |
+
self.integral_w = min(max(self.integral_w + p['controller_gain_w_k'] / p['controller_integral_s'] * e * dt, 0.0), p['heater_max_w'])
|
| 972 |
+
else:
|
| 973 |
+
P = 0.0
|
| 974 |
+
self.heater_w = P
|
| 975 |
+
loss = p['barrel_loss_w_k'] * (self.T_b - Ta)
|
| 976 |
+
friction = 0.0
|
| 977 |
+
pressure_work = 0.0
|
| 978 |
+
self.q_true = 0.0
|
| 979 |
+
exchange = 0.0
|
| 980 |
+
if self.sample is not None and self.m_s > 0:
|
| 981 |
+
T_s, phi = self._sample_state()
|
| 982 |
+
# barrel -> charge heat over dt: exponential relaxation towards the barrel temperature with the secant heat
|
| 983 |
+
# capacity (sensible + latent) of the charge; unconditionally stable for any charge size / conductance
|
| 984 |
+
G = p['sample_conductance_w_k'] * (self.m_s / self.m_loaded)
|
| 985 |
+
dT = self.T_b - T_s
|
| 986 |
+
if abs(dT) > 1e-12 and G > 0:
|
| 987 |
+
dH_eq = self.m_s * self._h_of_T(self.T_b) - self.H_s
|
| 988 |
+
exchange = dH_eq * -math.expm1(-G * dt * dT / dH_eq)
|
| 989 |
+
if T_s > self.sample['melting_low_k']:
|
| 990 |
+
self.t_hist += dt
|
| 991 |
+
# die flow for the contacting piston (melt fraction from the enthalpy)
|
| 992 |
+
extruded_volume = 0.0
|
| 993 |
+
if self.contact:
|
| 994 |
+
q = self._flow(T_s, phi)
|
| 995 |
+
dm = min(self.sample['melt_density_kg_m3'] * q * dt, phi * self.m_s)
|
| 996 |
+
if dm > 0:
|
| 997 |
+
h = self.H_s / self.m_s
|
| 998 |
+
self.m_s -= dm
|
| 999 |
+
self.H_s -= dm * h
|
| 1000 |
+
self.book['extruded_enthalpy_j'] += dm * h
|
| 1001 |
+
self.strand_kg += dm
|
| 1002 |
+
self.strand_m3 += dm / self.sample['melt_density_kg_m3']
|
| 1003 |
+
extruded_volume = dm / self.sample['melt_density_kg_m3']
|
| 1004 |
+
self.q_true = extruded_volume / dt
|
| 1005 |
+
self.H_s += exchange
|
| 1006 |
+
# compaction bookkeeping: unmelted pellets only turn into melt (never back to bulk pellets)
|
| 1007 |
+
self.pellet = min(self.pellet, 1.0 - self._phi())
|
| 1008 |
+
if self.contact:
|
| 1009 |
+
x_new = min(self._column_height(), self.x)
|
| 1010 |
+
dx = self.x - x_new
|
| 1011 |
+
if dx > 0:
|
| 1012 |
+
friction = p['piston_friction_n'] * dx
|
| 1013 |
+
force = self._load_mass() * GRAVITY - p['piston_friction_n']
|
| 1014 |
+
pressure_work = force * dx
|
| 1015 |
+
# the share that pushed melt through the die is dissipated there and leaves with the extrudate
|
| 1016 |
+
# (delta_p * V_extruded); only the compaction share heats the charge left in the barrel
|
| 1017 |
+
die_work = min(pressure_work, force / STANDARD_AREA_M2 * extruded_volume)
|
| 1018 |
+
self.book['extruded_enthalpy_j'] += die_work
|
| 1019 |
+
self.H_s += pressure_work - die_work
|
| 1020 |
+
self.x = x_new
|
| 1021 |
+
self.book['heater_input_j'] += P * dt
|
| 1022 |
+
self.book['ambient_export_j'] += loss * dt
|
| 1023 |
+
self.book['friction_heat_j'] += friction
|
| 1024 |
+
self.book['pressure_work_j'] += pressure_work
|
| 1025 |
+
self.T_b += (P * dt - loss * dt - exchange + friction) / p['barrel_heat_capacity_j_k']
|
| 1026 |
+
|
| 1027 |
+
def _advance_move(self, nxt):
|
| 1028 |
+
m = self._move
|
| 1029 |
+
dist = abs(self.x_target - m['x0'])
|
| 1030 |
+
t = (nxt - m['start_ns']) / 1e9
|
| 1031 |
+
done = t * m['speed'] >= dist - 1e-15
|
| 1032 |
+
new_x = self.x_target if done else m['x0'] + m['direction'] * m['speed'] * t
|
| 1033 |
+
dx = new_x - self.x
|
| 1034 |
+
heat = self.plant['piston_friction_n'] * abs(dx)
|
| 1035 |
+
self.book['host_work_j'] += self._load_mass() * GRAVITY * dx + heat
|
| 1036 |
+
self.book['friction_heat_j'] += heat
|
| 1037 |
+
self.T_b += heat / self.plant['barrel_heat_capacity_j_k']
|
| 1038 |
+
self.x = new_x
|
| 1039 |
+
if done:
|
| 1040 |
+
self._move = None
|
| 1041 |
+
if m['insert']:
|
| 1042 |
+
self.contact = True
|
| 1043 |
+
|
| 1044 |
+
def step(self, dt_s):
|
| 1045 |
+
validate(number('s', 0.0, 86400.0), dt_s)
|
| 1046 |
+
raw = dt_s * 1e9 + self._clock_remainder_ns
|
| 1047 |
+
ns = round(raw)
|
| 1048 |
+
self._clock_remainder_ns = raw - ns
|
| 1049 |
+
if ns <= 0 or self.plant is None:
|
| 1050 |
+
self.time_ns += max(ns, 0)
|
| 1051 |
+
self.revision += 1
|
| 1052 |
+
return
|
| 1053 |
+
end = self.time_ns + ns
|
| 1054 |
+
while self.time_ns < end:
|
| 1055 |
+
nxt = self._next_events(end)
|
| 1056 |
+
dt = (nxt - self.time_ns) / 1e9
|
| 1057 |
+
if self._move is not None:
|
| 1058 |
+
self._advance_move(nxt)
|
| 1059 |
+
self._integrate(dt)
|
| 1060 |
+
# a descending insert can meet the (shrinking) charge column
|
| 1061 |
+
if self._move is not None and self._move['insert'] and self.x <= self._column_height() + 1e-12:
|
| 1062 |
+
self.x = max(self._column_height(), 0.0)
|
| 1063 |
+
self.x_target = self.x
|
| 1064 |
+
self._move = None
|
| 1065 |
+
self.contact = True
|
| 1066 |
+
if self._cut is not None:
|
| 1067 |
+
c = self._cut
|
| 1068 |
+
frac = min(1.0, (nxt - c['start_ns']) / max(1, c['end_ns'] - c['start_ns']))
|
| 1069 |
+
self.cutter_angle = c['a0'] + (c['a1'] - c['a0']) * frac
|
| 1070 |
+
self.time_ns = nxt
|
| 1071 |
+
if self._cut is not None:
|
| 1072 |
+
c = self._cut
|
| 1073 |
+
if not c['severed'] and self.time_ns >= c['mid_ns']:
|
| 1074 |
+
c['severed'] = True
|
| 1075 |
+
self._sever(self.time_ns)
|
| 1076 |
+
if self.time_ns >= c['end_ns']:
|
| 1077 |
+
self.cutter_angle = c['a1']
|
| 1078 |
+
self._cut = None
|
| 1079 |
+
if self._weighing is not None and self.time_ns >= self._weighing['end_ns']:
|
| 1080 |
+
self._complete_weighing()
|
| 1081 |
+
if self.phase == 'running':
|
| 1082 |
+
acq = self._acq
|
| 1083 |
+
self.elapsed = (self.time_ns - acq['start_ns']) / 1e9
|
| 1084 |
+
acq['elapsed'] = self.elapsed
|
| 1085 |
+
am = acq['method']
|
| 1086 |
+
if acq['next_cut_ns'] is not None and self.time_ns >= acq['next_cut_ns']:
|
| 1087 |
+
acq['next_cut_ns'] += round(am['cut_interval_s'] * 1e9)
|
| 1088 |
+
if self._cut is None and self.power:
|
| 1089 |
+
self._start_cut(auto=True)
|
| 1090 |
+
if self.time_ns >= acq['next_sample_ns']:
|
| 1091 |
+
acq['next_sample_ns'] += acq['period_ns']
|
| 1092 |
+
self._record(self.time_ns)
|
| 1093 |
+
row = self.rows[-1]
|
| 1094 |
+
if row['temperature_k'] is not None and abs(row['temperature_k'] - acq['target_k']) > am['temperature_tolerance_k'] + 1e-9:
|
| 1095 |
+
enc = row['encoder_position_m']
|
| 1096 |
+
if enc is not None and am['window_lower_m'] <= enc <= am['window_upper_m']:
|
| 1097 |
+
acq['temperature_excursion'] = True
|
| 1098 |
+
enc = row['encoder_position_m']
|
| 1099 |
+
if enc is not None and enc <= am['window_lower_m']:
|
| 1100 |
+
acq['window_traversed'] = any(r['encoder_position_m'] is not None and r['encoder_position_m'] >= am['window_upper_m'] for r in self.rows)
|
| 1101 |
+
self._finish('succeeded' if acq['window_traversed'] else 'failed', 'WINDOW_TRAVERSED' if acq['window_traversed'] else 'STARTED_BELOW_WINDOW')
|
| 1102 |
+
if self.phase == 'running' and (self.m_s <= 1e-12 or self.x <= MIN_PISTON_M):
|
| 1103 |
+
self._finish('failed', 'SAMPLE_EXHAUSTED')
|
| 1104 |
+
if self.phase == 'running' and self.time_ns >= acq['end_limit_ns']:
|
| 1105 |
+
self._finish('failed', 'DURATION_ELAPSED')
|
| 1106 |
+
self.revision += 1
|
| 1107 |
+
|
| 1108 |
+
|
| 1109 |
+
class ZwickMflowSession:
|
| 1110 |
+
def __init__(self, host, principal_id):
|
| 1111 |
+
self._host = host
|
| 1112 |
+
self._principal = principal_id
|
| 1113 |
+
|
| 1114 |
+
@property
|
| 1115 |
+
def _role(self):
|
| 1116 |
+
return self._host._principals[self._principal]
|
| 1117 |
+
|
| 1118 |
+
def _target(self, instance_id):
|
| 1119 |
+
if not isinstance(instance_id, str) or instance_id != self._host.instance_id:
|
| 1120 |
+
raise ActionRejected('UNKNOWN_INSTANCE')
|
| 1121 |
+
|
| 1122 |
+
def describe(self, *, instance_id=None, asset_type_id=None):
|
| 1123 |
+
if (instance_id is None) == (asset_type_id is None):
|
| 1124 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 1125 |
+
if instance_id is not None:
|
| 1126 |
+
self._target(instance_id)
|
| 1127 |
+
if asset_type_id is not None and asset_type_id != ASSET_TYPE_ID:
|
| 1128 |
+
raise ActionRejected('UNKNOWN_INSTANCE')
|
| 1129 |
+
meta = export_zwick_mflow_contract_metadata()
|
| 1130 |
+
return dict(protocol_version=PROTOCOL_VERSION, asset_type_id=ASSET_TYPE_ID, asset_version='1.0.0',
|
| 1131 |
+
capabilities={k: v for k, v in meta['capabilities'].items() if v['visibility'] == 'agent' or self._role != 'agent'},
|
| 1132 |
+
state_slots={k: v for k, v in meta['state_slots'].items() if v['visibility'] == 'agent' or self._role != 'agent'})
|
| 1133 |
+
|
| 1134 |
+
def read(self, *, instance_id, state_ids=None):
|
| 1135 |
+
self._target(instance_id)
|
| 1136 |
+
h = self._host
|
| 1137 |
+
values = h.read(self._role)
|
| 1138 |
+
ids = list(values) if state_ids is None else state_ids
|
| 1139 |
+
if not isinstance(ids, list) or any(not isinstance(k, str) for k in ids):
|
| 1140 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 1141 |
+
if any(k not in values for k in ids):
|
| 1142 |
+
raise ActionRejected('ACCESS_DENIED')
|
| 1143 |
+
return dict(instance_id=instance_id, status='succeeded', state_revision=h.revision, clock={'domain': 'simulation', 'time_s': h.time_s},
|
| 1144 |
+
observations={k: dict(value=copy.deepcopy(values[k]), unit=SLOTS[k]['unit'],
|
| 1145 |
+
quality='unavailable' if values[k] is None else 'estimated' if SLOTS[k]['origin'] in ('sensor', 'derived') else 'valid',
|
| 1146 |
+
sample_time_s=h.time_s, sample_window_s=None) for k in ids})
|
| 1147 |
+
|
| 1148 |
+
def _filter_result(self, result):
|
| 1149 |
+
result = copy.deepcopy(result)
|
| 1150 |
+
# Public acquisition payloads use the same redaction for every role; provenance.read is the evaluator channel.
|
| 1151 |
+
if 'rows' in result and 'template_source' in result:
|
| 1152 |
+
result['template_source'] = (str(LIBRARY_PATH.relative_to(ROOT)) + '; selected record available only through evaluator provenance.read') if result['template_source'] is not None else None
|
| 1153 |
+
result['evidence'] = ('synthetic_forward_model; quantised encoder/time/temperature observations and external weighings; manufacturer MVR scalar with explicit priors; selected record restricted'
|
| 1154 |
+
if result['operation_id'] is not None else 'no_measurement')
|
| 1155 |
+
return result
|
| 1156 |
+
|
| 1157 |
+
def invoke(self, *, instance_id, capability_id, arguments, request_id):
|
| 1158 |
+
h = self._host
|
| 1159 |
+
try:
|
| 1160 |
+
self._target(instance_id)
|
| 1161 |
+
if not isinstance(capability_id, str) or capability_id not in CAPS:
|
| 1162 |
+
raise ActionRejected('UNKNOWN_CAPABILITY')
|
| 1163 |
+
if self._role == 'agent' and CAPS[capability_id]['visibility'] != 'agent':
|
| 1164 |
+
raise ActionRejected('ACCESS_DENIED')
|
| 1165 |
+
if not isinstance(request_id, str) or not request_id:
|
| 1166 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 1167 |
+
validate(CAPS[capability_id]['input_schema'], arguments)
|
| 1168 |
+
key = (self._principal, request_id)
|
| 1169 |
+
digest = json.dumps([capability_id, arguments], sort_keys=True, allow_nan=False)
|
| 1170 |
+
if key in h._requests:
|
| 1171 |
+
old, response = h._requests[key]
|
| 1172 |
+
if old != digest:
|
| 1173 |
+
raise ActionRejected('REQUEST_CONFLICT')
|
| 1174 |
+
return copy.deepcopy(response)
|
| 1175 |
+
# Operations started by another *agent* are private to it; ones started from the physical panel or by the host
|
| 1176 |
+
# (evaluator/debug principals, e.g. a Matterix key press) are visible to every operator at the instrument.
|
| 1177 |
+
owner = h._owners.get(h.operation_id) if h.operation_id else None
|
| 1178 |
+
foreign = owner is not None and owner != self._principal and h._principals.get(owner) == 'agent'
|
| 1179 |
+
if capability_id in ('acquisition.stop', 'acquisition.result') and self._role == 'agent' and foreign:
|
| 1180 |
+
raise ActionRejected('ACCESS_DENIED')
|
| 1181 |
+
if capability_id in ('cutter.cut', 'thermal.set_temperature') and h.phase == 'running' and self._role == 'agent' and foreign:
|
| 1182 |
+
raise ActionRejected('ACCESS_DENIED')
|
| 1183 |
+
if capability_id == 'power.set' and not arguments['enabled'] and h.phase == 'running' and self._role == 'agent' and foreign:
|
| 1184 |
+
raise ActionRejected('ACCESS_DENIED')
|
| 1185 |
+
result = self._filter_result(h.invoke(capability_id, **arguments))
|
| 1186 |
+
operation = result.get('operation_id') if capability_id == 'acquisition.start' else None
|
| 1187 |
+
if operation:
|
| 1188 |
+
h._owners[operation] = self._principal
|
| 1189 |
+
response = dict(protocol_version=PROTOCOL_VERSION, instance_id=instance_id, request_id=request_id, operation_id=operation,
|
| 1190 |
+
status='accepted' if operation else 'succeeded', state_revision=h.revision, clock={'domain': 'simulation', 'time_s': h.time_s},
|
| 1191 |
+
result=result, observations={}, error=None)
|
| 1192 |
+
h._requests[key] = (digest, copy.deepcopy(response))
|
| 1193 |
+
return response
|
| 1194 |
+
except ActionRejected as exc:
|
| 1195 |
+
return dict(protocol_version=PROTOCOL_VERSION, instance_id=instance_id, request_id=request_id, operation_id=None,
|
| 1196 |
+
status='unsupported' if str(exc) == 'UNSUPPORTED' else 'rejected', state_revision=h.revision,
|
| 1197 |
+
clock={'domain': 'simulation', 'time_s': h.time_s}, result={}, observations={},
|
| 1198 |
+
error=dict(code=str(exc), message=str(exc), retryable=False, side_effects='none'))
|
| 1199 |
+
|
| 1200 |
+
def write(self, *, instance_id, state_id, value, request_id):
|
| 1201 |
+
self._target(instance_id)
|
| 1202 |
+
if not isinstance(state_id, str):
|
| 1203 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 1204 |
+
entry = SLOTS.get(state_id)
|
| 1205 |
+
if not entry or state_id not in WRITE_VIA:
|
| 1206 |
+
raise ActionRejected('ACCESS_DENIED')
|
| 1207 |
+
capability, argument = WRITE_VIA[state_id]
|
| 1208 |
+
return self.invoke(instance_id=instance_id, capability_id=capability, arguments={argument: value}, request_id=request_id)
|
| 1209 |
+
|
| 1210 |
+
def poll(self, operation_id):
|
| 1211 |
+
h = self._host
|
| 1212 |
+
if not isinstance(operation_id, str):
|
| 1213 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 1214 |
+
if h._owners.get(operation_id) != self._principal:
|
| 1215 |
+
raise ActionRejected('ACCESS_DENIED')
|
| 1216 |
+
result = h._result() if operation_id == h.operation_id and h.phase == 'running' else h.records.get(operation_id)
|
| 1217 |
+
if result is None:
|
| 1218 |
+
raise ActionRejected('UNKNOWN_OPERATION')
|
| 1219 |
+
return dict(operation_id=operation_id, status=result['phase'], result=self._filter_result(result))
|
| 1220 |
+
|
| 1221 |
+
def cancel(self, operation_id, request_id):
|
| 1222 |
+
self.poll(operation_id)
|
| 1223 |
+
h = self._host
|
| 1224 |
+
if not isinstance(request_id, str) or not request_id:
|
| 1225 |
+
raise ActionRejected('INVALID_ARGUMENT')
|
| 1226 |
+
key = (self._principal, request_id)
|
| 1227 |
+
if key in h._cancel_operations:
|
| 1228 |
+
if h._cancel_operations[key] != operation_id:
|
| 1229 |
+
raise ActionRejected('REQUEST_CONFLICT')
|
| 1230 |
+
return copy.deepcopy(h._requests[key][1])
|
| 1231 |
+
if key in h._requests:
|
| 1232 |
+
raise ActionRejected('REQUEST_CONFLICT')
|
| 1233 |
+
if operation_id != h.operation_id or h.phase != 'running':
|
| 1234 |
+
raise ActionRejected('NOT_RUNNING')
|
| 1235 |
+
result = self.invoke(instance_id=h.instance_id, capability_id='acquisition.stop', arguments={}, request_id=request_id)
|
| 1236 |
+
if result['status'] == 'succeeded':
|
| 1237 |
+
h._cancel_operations[key] = operation_id
|
| 1238 |
+
return result
|
| 1239 |
+
|
| 1240 |
+
|
| 1241 |
+
WRITE_VIA = {'thermal.target_k': ('thermal.set_temperature', 'target_k')} # the load is placed by the host (evaluator weight.configure)
|
| 1242 |
+
EFFECTS = {
|
| 1243 |
+
'plant.configure': ['plant.configured', 'thermal.target_k', 'truth.barrel_temperature_k', 'truth.sample_temperature_k', 'heater.output_fraction'],
|
| 1244 |
+
'balance.configure': ['balance.configured'],
|
| 1245 |
+
'method.configure': ['method.configured', 'method.test_load_kg'],
|
| 1246 |
+
'power.set': ['power.enabled', 'power.angle_rad', 'thermal.indicated_k', 'encoder.position_m', 'encoder.in_range', 'acquisition.phase', 'measurement.validity',
|
| 1247 |
+
'measurement.live_mvr_m3_s', 'truth.heater_power_w', 'heater.output_fraction', 'cutter.running', 'measurement.mvr_m3_s', 'measurement.mfr_kg_s'],
|
| 1248 |
+
'thermal.set_temperature': ['thermal.target_k'],
|
| 1249 |
+
'weight.configure': ['weight.total_load_kg'],
|
| 1250 |
+
'sample.load': ['sample.present', 'preheat.elapsed_s', 'truth.sample_mass_kg', 'truth.sample_temperature_k', 'truth.melt_fraction', 'truth.pellet_fraction', 'truth.thermal_history_s'],
|
| 1251 |
+
'sample.remove': ['sample.present', 'preheat.elapsed_s', 'truth.sample_mass_kg', 'truth.sample_temperature_k', 'truth.melt_fraction', 'truth.pellet_fraction', 'truth.thermal_history_s'],
|
| 1252 |
+
'piston.withdraw': ['piston.target_m', 'piston.moving', 'piston.contact'],
|
| 1253 |
+
'piston.insert': ['piston.target_m', 'piston.moving', 'piston.contact'],
|
| 1254 |
+
'cutter.cut': ['cutter.running'],
|
| 1255 |
+
'collection.clear': ['segments.count', 'segments.unweighed', 'extrudate.length_m', 'extrudate.last_cut_length_m', 'truth.strand_mass_kg'],
|
| 1256 |
+
'balance.weigh': ['balance.busy', 'segments.unweighed'],
|
| 1257 |
+
'calibration.encoder': ['encoder.position_m'],
|
| 1258 |
+
'calibration.balance': [],
|
| 1259 |
+
'acquisition.start': ['acquisition.phase', 'acquisition.elapsed_s', 'acquisition.points', 'measurement.validity', 'cutter.running', 'measurement.live_mvr_m3_s'],
|
| 1260 |
+
'acquisition.stop': ['acquisition.phase', 'measurement.validity', 'measurement.live_mvr_m3_s', 'measurement.mvr_m3_s', 'measurement.mfr_kg_s'],
|
| 1261 |
+
'sim.step': list(SLOTS),
|
| 1262 |
+
}
|
| 1263 |
+
for _k, _v in EFFECTS.items():
|
| 1264 |
+
CAPS[_k]['effects'] = _v
|
| 1265 |
+
ERRORS = sorted(set(re.findall(r"ActionRejected\('([A-Z_0-9]+)'", Path(__file__).read_text())) |
|
| 1266 |
+
{'USER_CANCEL', 'POWER_OFF', 'WINDOW_TRAVERSED', 'STARTED_BELOW_WINDOW', 'SAMPLE_EXHAUSTED', 'DURATION_ELAPSED'})
|
| 1267 |
+
ASYNC = {'acquisition.start'}
|
| 1268 |
+
LIMITATIONS = [
|
| 1269 |
+
'选定Mflow 1128610(230V)基础版:料筒1128612内径9.55mm、活塞1128614(即0.325kg载荷档)、口模312342 2.095mm×8mm(烧结耐磨耐酸);未选气动提升/选重器1128621/1128624、清洗1128622、预载1128623、预热位活塞保持1128627、口模塞1128618、分隔板1128619、回冷090173、半口模325554、耐酸料筒/活塞1128613/1128615与PVC口模092326;不建模换口模。',
|
| 1270 |
+
'厂家规格:50–450°C、总载荷0.325–21.6kg、位移分辨率0.003mm(方法B误差限±0.02mm)、时间分辨率0.002s(误差限±0.01s)、温度显示分辨率<0.1K、口模以上0–75mm温度准确度<0.3K(ISO 1133-2);这些是分辨率/误差限,不是本模型的噪声模型。',
|
| 1271 |
+
'炉体为集中热节点,PI控温;热容、散热、加热器上限(≤0.7kVA连接视在功率)、控温参数与试样换热导率都是宿主显式输入的工程参数,不是厂家数据;温度准确度未经ISO 1133-2认证。',
|
| 1272 |
+
'试样为装料焓节点:比热、潜热(熔程线性)、颗粒堆积密度、熔体密度均为宿主先验;厂家库只给23°C固体密度与DSC熔点,固体密度不得当作测试温度下熔体密度。',
|
| 1273 |
+
'口模流动由所选厂家MVR标量在其温度/载荷下锚定,经宿主给定的幂律指数n、流动活化能Ea和热历史速率外推到实际条件,并扣除活塞摩擦;单个MVR/MFR不能唯一决定完整流变曲线、入口压力损失、壁滑或温敏性。',
|
| 1274 |
+
'未熔颗粒按φ³抑制流动(显式假设);颗粒压实只随熔化单向发生,重新凝固不会恢复颗粒堆积。',
|
| 1275 |
+
'活塞位置=料柱高度(ISO平均截面0.711cm²);方法B的MVR由窗口内首末量化位移与量化时间计算;方法A的MFR只用外接天平称得的测量切段质量与其切断间隔;密度只在两者都有时给出。',
|
| 1276 |
+
'砝码下落势能分为摩擦功(进入炉体)与压力功:推动熔体通过口模的部分Δp·V在口模内耗散并随挤出物离开,压实部分进入留在料筒内的试样;手动升降活塞的宿主功含势能变化与摩擦热;挤出物带走其焓(在空气中冷却,视为离开系统边界),质量仍在库存中直到收集或清走。',
|
| 1277 |
+
'切刀为交替半圈,经过π/2瞬间切断;首次切断清除预热期挤出物,之后相邻两次自动切断之间为测量切段;切刀电机功率/速度未公开,半圈时间为工程参数。',
|
| 1278 |
+
'外接分析天平(厂家可选043851/014720,0.1mg读数)只作RS-232代理:稳定时间、增益/偏置和分辨率由宿主给定;称量不在Mflow主机内完成。',
|
| 1279 |
+
'位移传感器按照片所见转臂结构建模,量程约0–107mm(工程假设);超量程或断电时读数为null;两点标定只使用宿主提供的独立观测值。',
|
| 1280 |
+
'agent只能看到量化位移、显示温度、切段观测和结果;精确活塞位置、熔融分数、真实流率和所选材料身份只对evaluator可见;acquisition.result对所有角色隐去材料身份,完整来源只能经provenance.read获得。',
|
| 1281 |
+
'时间推进为事件对齐的守恒子步(≤50ms;炉体PI为显式、料筒—试样换热为指数松弛):所有能量/质量项用同一数值记账因而账本精确闭合,但不同step切分会造成约1e-8–1e-7m、1e-4K量级的真值差,恰在量化边界附近的个别记录行(约1%)会相差一个量化步(0.003mm),MVR不受影响。',
|
| 1282 |
+
'正向模型的位移—体积换算与方法B分析使用同一ISO平均截面0.711cm²,因此方法B的回收只检验量化与算术,不独立检验截面假设(环隙回流未建模)。',
|
| 1283 |
+
'默认n/Ea先验跨条件外推有明显误差:例如B4330G6 HR从250°C/2.16kg外推到260°C/5kg得约16.5cm³/10min,厂家表为19(−13%);换条件时宿主应改用该条件的厂家数值格或给出更合适的先验。',
|
| 1284 |
+
'热历史倍率exp(k·t)限制在1e-3–1e3的数值域;堆积密度不得大于熔体密度(被拒);每次采集的记录行不超过200000行(方法设定时检查)。',
|
| 1285 |
+
'每次采集保存自己的方法快照、记录行与切段:清走收集区、改方法或称量其它切段都不会改写已完成的结果;晚完成的称量只回填其所属采集。每次采集的切段不超过10000个(手动切刀与自动切段共用预算);由某个agent启动的采集中,其他agent不能改��度设定、切刀、停止或读取其结果;面板/宿主启动的采集对所有操作者共享。',
|
| 1286 |
+
'没有真实硬件、testXpert连接、机器人装料/压实/清筒、挤出丝接触或卷曲、离模膨胀实测与ISO认证。',
|
| 1287 |
+
]
|
| 1288 |
+
|
| 1289 |
+
|
| 1290 |
+
def export_zwick_mflow_contract_metadata():
|
| 1291 |
+
slots = {}
|
| 1292 |
+
caps = {}
|
| 1293 |
+
for k, v in SLOTS.items():
|
| 1294 |
+
slots[k] = dict(meaning_zh=v['meaning'], component_ids=[v['component']], value_schema=copy.deepcopy(v['schema']), unit=v['unit'],
|
| 1295 |
+
reference_conditions=v['reference'], origin=v['origin'], visibility=v['visibility'],
|
| 1296 |
+
access='read_write' if k in WRITE_VIA else 'read_only',
|
| 1297 |
+
read_binding=dict(backend='host', artifact_id='runtime', accessor=f'ZwickMflowSession.read(state_ids=[{k!r}])'),
|
| 1298 |
+
write_via=None if k not in WRITE_VIA else dict(capability_id=WRITE_VIA[k][0], argument=WRITE_VIA[k][1], fixed_arguments={}),
|
| 1299 |
+
sampling=dict(mode='instant', time_domain='simulation', window_description='Pure read; encoder 0.003 mm, time 0.002 s, display 0.01 K quantisation; rows on the method time grid.'),
|
| 1300 |
+
source_ids=['simulation_assumption'])
|
| 1301 |
+
for k, v in CAPS.items():
|
| 1302 |
+
un = k in UNSUPPORTED
|
| 1303 |
+
async_ = k in ASYNC
|
| 1304 |
+
c = {key: copy.deepcopy(v[key]) for key in ['input_schema', 'output_schema', 'component_ids', 'function_zh', 'kind', 'visibility', 'example_arguments']}
|
| 1305 |
+
c.update(availability='unsupported' if un else 'implemented',
|
| 1306 |
+
implementation={layer: 'absent' if un or layer in ('scene', 'robot', 'hardware') else 'implemented' for layer in ['process', 'scene', 'robot', 'hardware', 'host']},
|
| 1307 |
+
binding=None if un else dict(backend='host', artifact_id='runtime', entrypoint='asset_runtime.zwick_mflow.ZwickMflowSession.invoke',
|
| 1308 |
+
invocation=f'session.invoke(instance_id="mflow_01",capability_id={k!r},arguments={v["example_arguments"]!r},request_id="unique")'),
|
| 1309 |
+
preconditions=[] if un or v['kind'] in ('query', 'analysis', 'simulation') else [dict(
|
| 1310 |
+
description_zh='入口原子核对通电、配置、试样/活塞/载荷/预热/温度、切刀与天平忙闲等前提;被拒时状态不变。',
|
| 1311 |
+
state_ids=['power.enabled', 'plant.configured', 'sample.present', 'piston.contact', 'acquisition.phase'], enforced_by='runtime', check='ZwickMflowRuntime.invoke')],
|
| 1312 |
+
state_effects=[dict(state_id=s, timing='on_step' if k == 'sim.step' else 'immediate', description_zh='设定或操作标志;温度、位移、挤出与切段只随step推进') for s in v['effects']],
|
| 1313 |
+
observes=[], model_effects=dict(mode='none', description_zh='运行层只输出状态,由场景层绑定关节与读数', binding_ids=[]),
|
| 1314 |
+
execution=dict(mode='asynchronous' if async_ else 'synchronous', time_domain='simulation',
|
| 1315 |
+
completion_criterion='活塞读数越过窗口下限(或超时/料尽/取消)' if async_ else '原子配置或外部动作请求,实际状态由step推进',
|
| 1316 |
+
completion_state_ids=['acquisition.phase'] if async_ else [], timeout_s=None, cancellation='supported' if async_ else 'unsupported',
|
| 1317 |
+
retry='same_request_id', resources=['host_clock', 'barrel', 'piston', 'cutter', 'encoder'],
|
| 1318 |
+
partial_failure_zh='停止/断电/超时只终止记录与自动切断;已挤出物、切段、称量记录与热状态全部保留。'),
|
| 1319 |
+
errors=[dict(code=e, meaning_zh=e, side_effects='partial' if async_ and e in ('USER_CANCEL', 'POWER_OFF', 'SAMPLE_EXHAUSTED', 'DURATION_ELAPSED', 'STARTED_BELOW_WINDOW') else 'none') for e in ERRORS],
|
| 1320 |
+
verification=[], limitations=LIMITATIONS, source_ids=['manufacturer_primary', 'simulation_assumption', 'template_library'])
|
| 1321 |
+
if k in ('acquisition.start', 'piston.insert', 'piston.withdraw', 'cutter.cut', 'thermal.set_temperature', 'power.set', 'balance.weigh', 'weight.configure', 'sample.load'):
|
| 1322 |
+
c['state_effects'] += [dict(state_id=s, timing='on_step', description_zh='由统一宿主时钟推进热、熔化、挤出、切刀、称量与量化观测')
|
| 1323 |
+
for s in SLOTS if s not in v['effects'] and SLOTS[s]['origin'] in ('sensor', 'derived', 'scene', 'process_truth')]
|
| 1324 |
+
caps[k] = c
|
| 1325 |
+
mechanism = dict(
|
| 1326 |
+
component_ids=['heater', 'barrel', 'piston', 'test_weight', 'die', 'cutter', 'displacement_sensor', 'sensor_arm', 'controller', 'balance_rs232'],
|
| 1327 |
+
state_ids=list(slots), meaning_zh='料筒PI控温、装料熔化与压实、幂律口模流动(载荷/摩擦/温度/热历史)、活塞位移观测、切刀切段与外部称量',
|
| 1328 |
+
implementation='lumped',
|
| 1329 |
+
equations=['C_b dT_b/dt = P_heater - G_b (T_b - T_amb) - Q_bs + F_f |dx|/dt ; P_heater = clamp(Kp e + I, 0, P_max), dI/dt = (Kp/Ti) e (conditional integration)',
|
| 1330 |
+
'h(T) = cp (T - T_amb) + L phi(T), phi = clamp((T - T_lo)/(T_hi - T_lo), 0, 1) ; dH_s/dt = G_s (m_s/m_0)(T_b - T_s) + (m g - F_f) dx/dt - h_s dm_ext/dt',
|
| 1331 |
+
'Q = MVR_ref ((m g - F_f)/(m_ref g))^(1/n) exp(-(Ea/(n R))(1/T_s - 1/T_ref)) exp(k_h t_hist) phi^3 ; dm_ext = rho_melt Q dt',
|
| 1332 |
+
'x_piston = m_s (p/rho_bulk + (1-p)/rho_melt) / A_ISO, A_ISO = pi/4 ((D_barrel + D_piston)/2)^2 = 0.711 cm^2 ; p = min(p, 1 - phi)',
|
| 1333 |
+
'W_host = m g dx + F_f |dx| (manual moves) ; potential released under load -> F_f dx (barrel) + (m g - F_f) dx (charge)',
|
| 1334 |
+
'MVR_B = A_ISO (x_first - x_last)/(t_last - t_first) inside [window_lower, window_upper] from quantised encoder (3 um) and time (2 ms)',
|
| 1335 |
+
'MFR_A = sum(m_obs)/sum(dt_cut) over externally weighed measurement segments; density_T = MFR/MVR',
|
| 1336 |
+
'arm elevation = asin((x - 0.050)/0.140), upper stop 0.42 rad; encoder range ~0 .. 0.107 m'],
|
| 1337 |
+
parameters={}, source_ids=['simulation_assumption', 'template_library'], limitations=LIMITATIONS)
|
| 1338 |
+
import importlib.util
|
| 1339 |
+
spec = importlib.util.spec_from_file_location('_mflow_local_annotations', ROOT / 'scripts/asset_runtime/_annotations.py')
|
| 1340 |
+
ann = importlib.util.module_from_spec(spec)
|
| 1341 |
+
spec.loader.exec_module(ann)
|
| 1342 |
+
ann.KEY_ZH.update({k: v['meaning'] for k, v in SLOTS.items()})
|
| 1343 |
+
ann.annotate_export(SLUG, caps, slots, {'melt_flow_rate': mechanism},
|
| 1344 |
+
inputs={'plant.configure': (PLANT, PLANT_EXAMPLE), 'sample.load': (SAMPLE, SAMPLE_EXAMPLE), 'method.configure': (METHOD, METHOD_EXAMPLE),
|
| 1345 |
+
'balance.configure': (BALANCE, BALANCE_EXAMPLE)})
|
| 1346 |
+
for k, v in SLOTS.items():
|
| 1347 |
+
slots[k]['meaning_zh'] = v['meaning']
|
| 1348 |
+
if v['reference']:
|
| 1349 |
+
slots[k]['reference_conditions'] = v['reference']
|
| 1350 |
+
return dict(asset_type_id=ASSET_TYPE_ID, catalog_id=CATALOG_ID, capabilities=caps, state_slots=slots, mechanisms={'melt_flow_rate': mechanism})
|
tests/conftest.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Test configuration for the public ChemLab-Assets release.
|
| 2 |
+
|
| 3 |
+
The release does not redistribute cached third-party source documents (outputs/**/sources, source_cache, raw/
|
| 4 |
+
folders, references/). Some tests re-hash those caches to prove provenance; when a cache is absent, the test is
|
| 5 |
+
reported as skipped with the missing path instead of failing.
|
| 6 |
+
"""
|
| 7 |
+
import pytest
|
| 8 |
+
|
| 9 |
+
UNPUBLISHED = ("/outputs/", "/references/", "/raw/", "source_cache", "/sources/", "/vendor/")
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def _unpublished(exc):
|
| 13 |
+
name = getattr(exc, "filename", None)
|
| 14 |
+
return isinstance(exc, FileNotFoundError) and name and any(k in str(name) for k in UNPUBLISHED)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
@pytest.hookimpl(hookwrapper=True)
|
| 18 |
+
def pytest_runtest_makereport(item, call):
|
| 19 |
+
outcome = yield
|
| 20 |
+
rep = outcome.get_result()
|
| 21 |
+
if call.excinfo is not None and call.when in ("setup", "call") and _unpublished(call.excinfo.value):
|
| 22 |
+
rep.outcome = "skipped"
|
| 23 |
+
rep.longrepr = (str(item.path), item.location[1] or 0,
|
| 24 |
+
f"Skipped: needs an unpublished source cache ({call.excinfo.value.filename})")
|
tests/test_asset_ametek_oxtran.py
ADDED
|
@@ -0,0 +1,916 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM-147 AMETEK MOCON OX-TRAN 2/22 L runtime tests: python3 -m unittest tests/test_asset_ametek_oxtran.py
|
| 2 |
+
|
| 3 |
+
Themes (pipeline.md): setpoints only write targets; read/describe/poll are pure; rejected preconditions leave the state
|
| 4 |
+
unchanged; two instances are isolated; agent/evaluator truth isolation and result redaction; O2 mass and heat conservation;
|
| 5 |
+
real return values validate against the contract schemas; async completion / cancellation residue.
|
| 6 |
+
Physics: Faraday coulometry (1 cc/day = 0.000199 A), Fickian time lag and steady state against the analytical solution,
|
| 7 |
+
Arrhenius and humidity transfer, barometric and permeant normalisation, ReZero baseline, individual zero, masks,
|
| 8 |
+
over-range protection, drawer/clamp interlocks, thermoelectric heat-up against the manufacturer order of magnitude.
|
| 9 |
+
No native scene, robot or hardware claims.
|
| 10 |
+
"""
|
| 11 |
+
import copy
|
| 12 |
+
import importlib.util
|
| 13 |
+
import json
|
| 14 |
+
import math
|
| 15 |
+
import sys
|
| 16 |
+
import unittest
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 20 |
+
sys.path.insert(0, str(ROOT))
|
| 21 |
+
from scripts.asset_runtime.ametek_oxtran import * # noqa: E402,F401,F403
|
| 22 |
+
from scripts.asset_runtime import ametek_oxtran as rt # noqa: E402
|
| 23 |
+
|
| 24 |
+
PROCESS_EVIDENCE = {}
|
| 25 |
+
CHECKS = []
|
| 26 |
+
_spec = importlib.util.spec_from_file_location('oxtran_asset_tool', ROOT / 'skills/chemistry-lab-assets/scripts/asset_tool.py')
|
| 27 |
+
asset_tool = importlib.util.module_from_spec(_spec)
|
| 28 |
+
_spec.loader.exec_module(asset_tool)
|
| 29 |
+
_ispec = importlib.util.spec_from_file_location('oxtran_interface', ROOT / 'outputs/expansion_batch04/t1_thermal/ametek_oxtran/interface_definition.py')
|
| 30 |
+
interface = importlib.util.module_from_spec(_ispec)
|
| 31 |
+
_ispec.loader.exec_module(interface)
|
| 32 |
+
PET = 'poly_ethylene_terephthalate'
|
| 33 |
+
T23 = 296.15
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def call(h, k, **a):
|
| 37 |
+
"""Invoke through the runtime, validate the returned value and check that only declared slots changed immediately."""
|
| 38 |
+
before = h.read('debug')
|
| 39 |
+
r = h.invoke(k, **a)
|
| 40 |
+
validate(CAPS[k]['output_schema'], r)
|
| 41 |
+
problems = asset_tool.validate_value(r, CAPS[k]['output_schema'])
|
| 42 |
+
if problems:
|
| 43 |
+
raise AssertionError(f'{k}: {problems}')
|
| 44 |
+
after = h.read('debug')
|
| 45 |
+
delta = {x for x in after if before[x] != after[x]}
|
| 46 |
+
if k != 'sim.step' and not delta <= set(CAPS[k]['effects']):
|
| 47 |
+
raise AssertionError(f'{k}: undeclared state changes {sorted(delta - set(CAPS[k]["effects"]))}')
|
| 48 |
+
PROCESS_EVIDENCE.setdefault(k, []).append(dict(time_s=h.time_s, result_keys=sorted(r), actual_call=True))
|
| 49 |
+
return r
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def configured(plant=None, gas=None, inst=None, cfg=None, cells=('A',)):
|
| 53 |
+
h = AmetekOxtranRuntime()
|
| 54 |
+
call(h, 'plant.configure', **dict(PLANT_EXAMPLE, **(plant or {})))
|
| 55 |
+
call(h, 'gas.configure', **dict(GAS_EXAMPLE, **(gas or {})))
|
| 56 |
+
call(h, 'instrument.configure', **dict(INSTRUMENT_EXAMPLE, **(inst or {})))
|
| 57 |
+
for c in cells:
|
| 58 |
+
call(h, 'test.configure', **dict(TEST_CFG_EXAMPLE, cell=c, **(cfg or {})))
|
| 59 |
+
call(h, 'power.set', enabled=True)
|
| 60 |
+
return h
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def loaded(template=PET, thickness=100e-6, cell='A', h=None, mount=None, clamp=True, settle=3600.0, **kw):
|
| 64 |
+
h = h or configured(**kw)
|
| 65 |
+
call(h, 'drawer.move', cell=cell, open=True)
|
| 66 |
+
h.step(3.0)
|
| 67 |
+
call(h, 'sample.mount', **dict(MOUNT_EXAMPLE, cell=cell, template_id=template, thickness_m=thickness, **(mount or {})))
|
| 68 |
+
call(h, 'drawer.move', cell=cell, open=False)
|
| 69 |
+
h.step(3.0)
|
| 70 |
+
if clamp:
|
| 71 |
+
call(h, 'cell.load_unload', cell=cell)
|
| 72 |
+
h.step(settle)
|
| 73 |
+
return h
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def run_test(h, cell='A', limit_h=200.0, dt=1800.0):
|
| 77 |
+
call(h, 'test.start', cell=cell)
|
| 78 |
+
t = 0.0
|
| 79 |
+
while h.cells[cell]['test']['phase'] == 'running' and t < limit_h * 3600:
|
| 80 |
+
call(h, 'sim.step', dt_s=dt)
|
| 81 |
+
t += dt
|
| 82 |
+
return call(h, 'test.result', cell=cell)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def steady_otr(template, thickness, T=T23 - PLANT_EXAMPLE['temperature_sensor_bias_k'], rh=0.0, o2=0.999, baro=101325.0, E=45000.0, beta=0.0):
|
| 86 |
+
rec = library()[template]
|
| 87 |
+
f = math.exp(-E / GAS_CONSTANT * (1 / T - 1 / rec['reference_temperature_K']) + beta * rh)
|
| 88 |
+
pw = rh * saturation_pressure_pa(T)
|
| 89 |
+
return rec['oxygen_permeability_mol_m_per_m2_s_Pa'] * f * o2 * (baro - pw) / thickness
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
class ConstantsAndLibrary(unittest.TestCase):
|
| 93 |
+
def test01_identity_and_documented_constants(self):
|
| 94 |
+
self.assertEqual(ASSET_TYPE_ID, 'instrument.ametek_oxtran')
|
| 95 |
+
self.assertEqual(CATALOG_ID, 'CHEM-147')
|
| 96 |
+
self.assertAlmostEqual(AMP_PER_CC_DAY, 0.000199, delta=0.0000005) # manual appendix D
|
| 97 |
+
self.assertEqual(TEMPERATURE_RANGE_K, (283.15, 313.15))
|
| 98 |
+
self.assertAlmostEqual(TEST_AREA_M2, 50e-4)
|
| 99 |
+
self.assertAlmostEqual(MAX_FILM_THICKNESS_M, 3.048e-3)
|
| 100 |
+
self.assertEqual(OTR_RANGE_CC_M2_DAY, (0.005, 200.0))
|
| 101 |
+
self.assertAlmostEqual(SENSOR_RANGE_MOL_S * CC_DAY_PER_MOL_S, 1.0) # 200 cc/(m2 day) x 50 cm2 = 1 cc/day
|
| 102 |
+
|
| 103 |
+
def test02_interface_geometry_agrees_with_runtime(self):
|
| 104 |
+
self.assertAlmostEqual(interface.DRAWER_TRAVEL_M, DRAWER_TRAVEL_M)
|
| 105 |
+
self.assertAlmostEqual(interface.CLAMP_TRAVEL_M, CLAMP_TRAVEL_M)
|
| 106 |
+
self.assertAlmostEqual(interface.POWER_SWITCH_ON_RAD, POWER_SWITCH_ON_RAD)
|
| 107 |
+
self.assertAlmostEqual(interface.TEST_AREA_M2, TEST_AREA_M2)
|
| 108 |
+
for part, sid, capid, *_ in interface.MOTION:
|
| 109 |
+
self.assertIn(sid, SLOTS)
|
| 110 |
+
self.assertIn(capid, CAPS)
|
| 111 |
+
for r in interface.READOUTS:
|
| 112 |
+
self.assertIn(r['source']['bridge'][0], SLOTS)
|
| 113 |
+
self.assertEqual(SLOTS[r['source']['bridge'][0]]['visibility'], 'agent')
|
| 114 |
+
for lamp in interface.LAMPS:
|
| 115 |
+
self.assertIn(lamp['source']['lamp']['bridge'], SLOTS)
|
| 116 |
+
for key, (capid, args) in interface.KEY_COMMANDS.items():
|
| 117 |
+
validate(CAPS[capid]['input_schema'], args)
|
| 118 |
+
self.assertAlmostEqual(interface.OTR_DISPLAY_SCALE, CC_DAY_PER_MOL_S)
|
| 119 |
+
|
| 120 |
+
def test03_template_library_real_and_complete(self):
|
| 121 |
+
lib = json.loads(LIBRARY_PATH.read_text())
|
| 122 |
+
self.assertGreaterEqual(lib['coverage']['template_count'], 50)
|
| 123 |
+
self.assertGreaterEqual(lib['coverage']['with_measured_diffusivity'], 50)
|
| 124 |
+
self.assertEqual(lib['coverage']['synthetic_records'], 0)
|
| 125 |
+
for t in lib['templates']:
|
| 126 |
+
self.assertEqual(t['evidence'], 'measured_literature')
|
| 127 |
+
self.assertTrue(t['source']['sha256'] and t['measurements'])
|
| 128 |
+
self.assertGreater(t['oxygen_permeability_mol_m_per_m2_s_Pa'], 0)
|
| 129 |
+
pet = library()[PET]
|
| 130 |
+
self.assertAlmostEqual(pet['oxygen_permeability_barrer'], 0.11, places=6)
|
| 131 |
+
report = json.loads((ROOT / 'outputs/expansion_batch04/t1_thermal/ametek_oxtran/independent_permeation_source_validation.json').read_text())
|
| 132 |
+
self.assertEqual(report['status'], 'passed')
|
| 133 |
+
|
| 134 |
+
def test04_film_step_is_exactly_conservative_and_converges_to_linear_profile(self):
|
| 135 |
+
c = [5.0] * 20
|
| 136 |
+
dx = 1e-6
|
| 137 |
+
total0 = sum(c) * dx
|
| 138 |
+
jt_sum = jb_sum = 0.0
|
| 139 |
+
for _ in range(4000):
|
| 140 |
+
c, jt, jb = rt.film_step(c, dx, 1e-12, 10.0, 0.0, 0.5)
|
| 141 |
+
jt_sum += jt * 0.5
|
| 142 |
+
jb_sum += jb * 0.5
|
| 143 |
+
self.assertAlmostEqual(sum(c) * dx - total0, jt_sum - jb_sum, delta=1e-12 * total0)
|
| 144 |
+
L = 20 * dx
|
| 145 |
+
self.assertAlmostEqual(jb, 1e-12 * 10.0 / L, delta=1e-9 * 1e-12 * 10.0 / L)
|
| 146 |
+
|
| 147 |
+
def test05_is_stable_requires_step_and_window_drift(self):
|
| 148 |
+
self.assertTrue(rt.is_stable([1.0, 1.0, 1.001, 1.0], 3, 1.0, 0.0))
|
| 149 |
+
self.assertFalse(rt.is_stable([1.0, 1.006, 1.012, 1.018], 3, 1.0, 0.0)) # every step < 1 % but drift 1.8 %
|
| 150 |
+
self.assertFalse(rt.is_stable([1.0, 1.0], 3, 1.0, 0.0))
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
class RuntimeContract(unittest.TestCase):
|
| 154 |
+
def test10_setpoints_only_write_targets(self):
|
| 155 |
+
h = configured()
|
| 156 |
+
T0 = h.T
|
| 157 |
+
call(h, 'thermal.set_temperature', target_k=313.15)
|
| 158 |
+
call(h, 'humidity.set', rh_fraction=0.5)
|
| 159 |
+
self.assertEqual(h.T, T0)
|
| 160 |
+
self.assertEqual(h.rh_model, 0.0)
|
| 161 |
+
self.assertEqual(h.read('agent')['thermal.target_k'], 313.15)
|
| 162 |
+
call(h, 'sim.step', dt_s=600.0)
|
| 163 |
+
self.assertGreater(h.T, T0 + 3.0)
|
| 164 |
+
self.assertGreater(h.rh_model, 0.3)
|
| 165 |
+
|
| 166 |
+
def test11_read_describe_poll_do_not_advance_time(self):
|
| 167 |
+
h = loaded()
|
| 168 |
+
h.register_principal('agent', 'agent')
|
| 169 |
+
s = h.session('agent')
|
| 170 |
+
r = s.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='x1')
|
| 171 |
+
t0, rev = h.time_ns, h.revision
|
| 172 |
+
before = copy.deepcopy(h.read('debug'))
|
| 173 |
+
for _ in range(3):
|
| 174 |
+
s.read(instance_id='oxtran_01')
|
| 175 |
+
s.describe(instance_id='oxtran_01')
|
| 176 |
+
s.poll(r['operation_id'])
|
| 177 |
+
call(h, 'test.result', cell='A')
|
| 178 |
+
call(h, 'analysis.otr', **CAPS['analysis.otr']['example_arguments'])
|
| 179 |
+
self.assertEqual((h.time_ns, h.revision), (t0, rev))
|
| 180 |
+
self.assertEqual(before, h.read('debug'))
|
| 181 |
+
|
| 182 |
+
def test12_rejections_leave_state_unchanged(self):
|
| 183 |
+
h = configured()
|
| 184 |
+
cases = [('test.start', dict(cell='A'), 'CELL_NOT_CLAMPED'), ('sample.mount', dict(MOUNT_EXAMPLE), 'DRAWER_NOT_OPEN'),
|
| 185 |
+
('sample.unmount', dict(cell='A'), 'NO_FILM'), ('humidity.set', dict(rh_fraction=0.02), 'RH_OUTSIDE_CONTROLLED_RANGE'),
|
| 186 |
+
('test.stop', dict(cell='A'), 'NOT_RUNNING'),
|
| 187 |
+
('instrument.configure', dict(INSTRUMENT_EXAMPLE, barometer_mode='manual', manual_barometer_pa=None), 'MANUAL_BAROMETER_REQUIRED'),
|
| 188 |
+
('plant.configure', dict(PLANT_EXAMPLE), 'PLANT_ALREADY_CONFIGURED'), ('package.test', {}, 'UNSUPPORTED')]
|
| 189 |
+
for k, a, code in cases:
|
| 190 |
+
before = copy.deepcopy(h.read('debug'))
|
| 191 |
+
with self.assertRaises(ActionRejected) as e:
|
| 192 |
+
h.invoke(k, **a)
|
| 193 |
+
self.assertEqual(str(e.exception), code, k)
|
| 194 |
+
self.assertEqual(before, h.read('debug'), k)
|
| 195 |
+
with self.assertRaises(ActionRejected):
|
| 196 |
+
h.invoke('thermal.set_temperature', target_k=320.0)
|
| 197 |
+
with self.assertRaises(ActionRejected):
|
| 198 |
+
h.invoke('test.configure', **dict(TEST_CFG_EXAMPLE, cycles=True))
|
| 199 |
+
|
| 200 |
+
def test13_two_instances_isolated(self):
|
| 201 |
+
a = loaded()
|
| 202 |
+
b = configured()
|
| 203 |
+
call(a, 'thermal.set_temperature', target_k=303.15)
|
| 204 |
+
a.step(3600.0)
|
| 205 |
+
self.assertAlmostEqual(b.T, PLANT_EXAMPLE['ambient_k'])
|
| 206 |
+
self.assertIsNone(b.cells['A']['film'])
|
| 207 |
+
self.assertIsNotNone(a.cells['A']['film'])
|
| 208 |
+
|
| 209 |
+
def test14_agent_truth_isolation_and_redaction(self):
|
| 210 |
+
h = loaded()
|
| 211 |
+
h.register_principal('agent', 'agent'); h.register_principal('eval', 'evaluator')
|
| 212 |
+
ag, ev = h.session('agent'), h.session('eval')
|
| 213 |
+
obs = ag.read(instance_id='oxtran_01')['observations']
|
| 214 |
+
self.assertTrue(all(SLOTS[k]['visibility'] == 'agent' for k in obs))
|
| 215 |
+
self.assertFalse(any(k.startswith('truth.') for k in obs))
|
| 216 |
+
with self.assertRaises(ActionRejected):
|
| 217 |
+
ag.read(instance_id='oxtran_01', state_ids=['truth.cell_a.flux_mol_s'])
|
| 218 |
+
for k in ('ledger.read', 'provenance.read', 'sample.mount', 'drawer.move', 'sim.step', 'plant.configure'):
|
| 219 |
+
self.assertEqual(ag.invoke(instance_id='oxtran_01', capability_id=k, arguments=CAPS[k]['example_arguments'], request_id='r' + k)['error']['code'], 'ACCESS_DENIED')
|
| 220 |
+
r = ag.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='s1')
|
| 221 |
+
h.step(8 * 3600.0)
|
| 222 |
+
res = ag.invoke(instance_id='oxtran_01', capability_id='test.result', arguments={'cell': 'A'}, request_id='q1')['result']
|
| 223 |
+
self.assertNotIn(PET, json.dumps(res))
|
| 224 |
+
self.assertIn('evaluator provenance.read', res['template_source'])
|
| 225 |
+
prov = ev.invoke(instance_id='oxtran_01', capability_id='provenance.read', arguments={}, request_id='p1')['result']
|
| 226 |
+
self.assertIn(PET, prov['cell_a'])
|
| 227 |
+
self.assertEqual(prov['operations'][0]['operation_id'], r['operation_id'])
|
| 228 |
+
desc = ag.describe(instance_id='oxtran_01')
|
| 229 |
+
self.assertFalse(any(v['visibility'] != 'agent' for v in desc['capabilities'].values()))
|
| 230 |
+
|
| 231 |
+
def test15_foreign_agent_guard_and_shared_panel_tests(self):
|
| 232 |
+
h = loaded()
|
| 233 |
+
for p in ('a1', 'a2'):
|
| 234 |
+
h.register_principal(p, 'agent')
|
| 235 |
+
h.register_principal('panel', 'evaluator')
|
| 236 |
+
s1, s2, panel = h.session('a1'), h.session('a2'), h.session('panel')
|
| 237 |
+
s1.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='x')
|
| 238 |
+
h.step(3600.0)
|
| 239 |
+
for k, a in [('test.stop', {'cell': 'A'}), ('test.result', {'cell': 'A'}), ('cell.load_unload', {'cell': 'A'}), ('thermal.set_temperature', {'target_k': 300.0}),
|
| 240 |
+
('humidity.set', {'rh_fraction': 0.0}), ('power.set', {'enabled': False}), ('instrument.configure', dict(INSTRUMENT_EXAMPLE))]:
|
| 241 |
+
self.assertEqual(s2.invoke(instance_id='oxtran_01', capability_id=k, arguments=a, request_id='y' + k)['error']['code'], 'ACCESS_DENIED', k)
|
| 242 |
+
self.assertEqual(s1.invoke(instance_id='oxtran_01', capability_id='test.stop', arguments={'cell': 'A'}, request_id='z')['status'], 'succeeded')
|
| 243 |
+
# a panel/host-started test is visible to every operator
|
| 244 |
+
call(h, 'test.start', cell='A')
|
| 245 |
+
h._owners[h.cells['A']['test']['op']] = 'panel'
|
| 246 |
+
self.assertEqual(s2.invoke(instance_id='oxtran_01', capability_id='test.result', arguments={'cell': 'A'}, request_id='w')['status'], 'succeeded')
|
| 247 |
+
|
| 248 |
+
def test16_request_dedupe_conflict_and_write_via(self):
|
| 249 |
+
h = configured()
|
| 250 |
+
h.register_principal('agent', 'agent')
|
| 251 |
+
s = h.session('agent')
|
| 252 |
+
r1 = s.invoke(instance_id='oxtran_01', capability_id='thermal.set_temperature', arguments={'target_k': 300.0}, request_id='same')
|
| 253 |
+
r2 = s.invoke(instance_id='oxtran_01', capability_id='thermal.set_temperature', arguments={'target_k': 300.0}, request_id='same')
|
| 254 |
+
self.assertEqual(r1, r2)
|
| 255 |
+
self.assertEqual(s.invoke(instance_id='oxtran_01', capability_id='thermal.set_temperature', arguments={'target_k': 301.0}, request_id='same')['error']['code'], 'REQUEST_CONFLICT')
|
| 256 |
+
w = s.write(instance_id='oxtran_01', state_id='humidity.target_fraction', value=0.5, request_id='w1')
|
| 257 |
+
self.assertEqual(w['status'], 'succeeded')
|
| 258 |
+
self.assertEqual(h.rh_target, 0.5)
|
| 259 |
+
with self.assertRaises(ActionRejected):
|
| 260 |
+
s.write(instance_id='oxtran_01', state_id='cell_a.phase', value='idle', request_id='w2')
|
| 261 |
+
|
| 262 |
+
def test17_poll_and_cancel_keep_partial_readings(self):
|
| 263 |
+
h = loaded()
|
| 264 |
+
h.register_principal('agent', 'agent')
|
| 265 |
+
s = h.session('agent')
|
| 266 |
+
op = s.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='s')['operation_id']
|
| 267 |
+
h.step(4 * 3600.0)
|
| 268 |
+
self.assertEqual(s.poll(op)['status'], 'running')
|
| 269 |
+
n = len(h.cells['A']['test']['readings'])
|
| 270 |
+
self.assertGreater(n, 0)
|
| 271 |
+
c = s.cancel(op, 'c1')
|
| 272 |
+
self.assertEqual(c['status'], 'succeeded')
|
| 273 |
+
self.assertEqual(s.cancel(op, 'c1'), c)
|
| 274 |
+
res = s.poll(op)
|
| 275 |
+
self.assertEqual(res['status'], 'cancelled')
|
| 276 |
+
self.assertEqual(len(res['result']['readings']), n)
|
| 277 |
+
self.assertEqual(res['result']['validity'], 'cancelled')
|
| 278 |
+
h.step(3600.0)
|
| 279 |
+
self.assertEqual(h.cells['A']['p_up'] < 1.0, True) # test gas switched back to carrier flushing
|
| 280 |
+
with self.assertRaises(ActionRejected):
|
| 281 |
+
s.cancel(op, 'c2')
|
| 282 |
+
|
| 283 |
+
def test18_unsupported_options_are_explicit(self):
|
| 284 |
+
h = configured()
|
| 285 |
+
for k in UNSUPPORTED:
|
| 286 |
+
with self.assertRaises(ActionRejected) as e:
|
| 287 |
+
h.invoke(k)
|
| 288 |
+
self.assertEqual(str(e.exception), 'UNSUPPORTED')
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
class Physics(unittest.TestCase):
|
| 292 |
+
def test20_heatup_matches_manufacturer_order_of_magnitude(self):
|
| 293 |
+
h = configured()
|
| 294 |
+
call(h, 'thermal.set_temperature', target_k=313.15)
|
| 295 |
+
t = 0.0
|
| 296 |
+
while h.T + PLANT_EXAMPLE['temperature_sensor_bias_k'] < T23 + 0.99 * (313.15 - T23):
|
| 297 |
+
h.step(30.0); t += 30.0
|
| 298 |
+
self.assertLess(t, 6 * 3600.0) # not an order of magnitude slower than ~60 min (2/28 manual)
|
| 299 |
+
self.assertGreater(t, 20 * 60.0)
|
| 300 |
+
h.step(3 * 3600.0)
|
| 301 |
+
bias = PLANT_EXAMPLE['temperature_sensor_bias_k']
|
| 302 |
+
self.assertLess(abs(h.T + bias - 313.15), 0.02) # controlled on the (biased) sensor
|
| 303 |
+
self.assertLess(abs(h.read('agent')['thermal.indicated_k'] - 313.15), 0.02)
|
| 304 |
+
call(h, 'thermal.set_temperature', target_k=283.15) # thermoelectric cooling below ambient
|
| 305 |
+
h.step(4 * 3600.0)
|
| 306 |
+
self.assertLess(abs(h.T + bias - 283.15), 0.05)
|
| 307 |
+
L = h.ledger()
|
| 308 |
+
self.assertLess(abs(L['energy_residual_j']), 1e-6 * max(1.0, abs(L['tec_heat_j'])))
|
| 309 |
+
|
| 310 |
+
def test21_pet_time_lag_and_steady_state_vs_analytical(self):
|
| 311 |
+
h = loaded()
|
| 312 |
+
res = run_test(h)['result'] if False else run_test(h)
|
| 313 |
+
exams = [r['otr_mol_m2_s'] for r in res['readings'] if r['kind'] == 'exam']
|
| 314 |
+
target = steady_otr(PET, 100e-6)
|
| 315 |
+
self.assertEqual(res['validity'], 'valid')
|
| 316 |
+
self.assertLess(exams[0], 0.7 * target) # the first exam still sits on the time-lag rise
|
| 317 |
+
self.assertLess(abs(res['final_otr_mol_m2_s'] - target) / target, 0.01)
|
| 318 |
+
self.assertTrue(res['converged'] and res['within_repeatability_spec'])
|
| 319 |
+
self.assertAlmostEqual(res['permeance_mol_m2_s_pa'], res['final_otr_mol_m2_s'] / STD_PRESSURE_PA)
|
| 320 |
+
self.assertAlmostEqual(res['permeability_mol_m_per_m2_s_pa'], res['permeance_mol_m2_s_pa'] * 100e-6)
|
| 321 |
+
PROCESS_EVIDENCE['representative_pet_100um'] = dict(final_cc_m2_day=res['final_otr_cc_m2_day'], expected_cc_m2_day=target * CC_DAY_PER_MOL_S,
|
| 322 |
+
exams=len(exams), individual_zero=res['individual_zero_mol_m2_s'])
|
| 323 |
+
|
| 324 |
+
def test22_quantisation_resolution_and_sensor_counts(self):
|
| 325 |
+
h = loaded()
|
| 326 |
+
res = run_test(h)
|
| 327 |
+
for r in res['readings']:
|
| 328 |
+
q = r['otr_cc_pkg_day'] / (OTR_RESOLUTION_CC_M2_DAY * TEST_AREA_M2)
|
| 329 |
+
self.assertAlmostEqual(q, round(q), places=6)
|
| 330 |
+
self.assertIsInstance(r['sensor_counts'], int)
|
| 331 |
+
self.assertEqual(h.read('agent')['sensor.raw_counts'], int(round(h._measured_current() / COUNT_A))) # measured (noisy) current
|
| 332 |
+
|
| 333 |
+
def test23_faraday_sensor_current_matches_input(self):
|
| 334 |
+
h = loaded()
|
| 335 |
+
call(h, 'test.start', cell='A')
|
| 336 |
+
h.step(6 * 3600.0)
|
| 337 |
+
while h.route != 'A':
|
| 338 |
+
h.step(60.0)
|
| 339 |
+
h.step(29 * 60.0)
|
| 340 |
+
I_ss = 4 * FARADAY * PLANT_EXAMPLE['sensor_efficiency'] * h.sensor_in + PLANT_EXAMPLE['sensor_background_a']
|
| 341 |
+
self.assertLess(abs(h.sensor_I - I_ss) / I_ss, 0.01)
|
| 342 |
+
|
| 343 |
+
def test24_rezero_baseline_is_subtracted(self):
|
| 344 |
+
nz = dict(individual_zero='none')
|
| 345 |
+
base = run_test(loaded(gas=dict(carrier_o2_impurity_fraction=2e-6), cfg=nz))
|
| 346 |
+
dirty = run_test(loaded(gas=dict(carrier_o2_impurity_fraction=5e-4), cfg=nz)) # large carrier residual: cancels via ReZero
|
| 347 |
+
self.assertGreater(dirty['rezero_readings'][0]['sensor_counts'], 20 * base['rezero_readings'][0]['sensor_counts'])
|
| 348 |
+
self.assertLess(abs(dirty['final_otr_mol_m2_s'] - base['final_otr_mol_m2_s']) / base['final_otr_mol_m2_s'], 0.02)
|
| 349 |
+
noz = run_test(loaded(gas=dict(carrier_o2_impurity_fraction=5e-4), inst=dict(rezero_enabled=False), cfg=nz))
|
| 350 |
+
self.assertGreater(noz['final_otr_mol_m2_s'], dirty['final_otr_mol_m2_s'] + 5 * REPEATABILITY_CC_M2_DAY / CC_DAY_PER_MOL_S)
|
| 351 |
+
|
| 352 |
+
def test25_no_catalyst_removal_without_hydrogen(self):
|
| 353 |
+
h1 = loaded(gas=dict(carrier_h2_fraction=0.02))
|
| 354 |
+
h2 = loaded(gas=dict(carrier_h2_fraction=0.0))
|
| 355 |
+
self.assertAlmostEqual(h1._carrier_residual_fraction(), 2e-6 * (1 - PLANT_EXAMPLE['catalyst_removal_efficiency']))
|
| 356 |
+
self.assertAlmostEqual(h2._carrier_residual_fraction(), 2e-6)
|
| 357 |
+
|
| 358 |
+
def test26_barometric_and_permeant_normalisation(self):
|
| 359 |
+
ref = run_test(loaded())
|
| 360 |
+
alt = run_test(loaded(plant=dict(barometric_pa=85000.0)))
|
| 361 |
+
self.assertLess(abs(alt['final_otr_mol_m2_s'] - ref['final_otr_mol_m2_s']) / ref['final_otr_mol_m2_s'], 0.015) # normalised to 760 mmHg
|
| 362 |
+
air = run_test(loaded(gas=dict(test_o2_fraction=0.2095), inst=dict(permeant_concentration_percent=20.95)))
|
| 363 |
+
self.assertLess(abs(air['final_otr_mol_m2_s'] - ref['final_otr_mol_m2_s']) / ref['final_otr_mol_m2_s'], 0.03)
|
| 364 |
+
wrong = run_test(loaded(gas=dict(test_o2_fraction=0.2095))) # air supplied but 100 % declared
|
| 365 |
+
self.assertLess(wrong['final_otr_mol_m2_s'], 0.25 * ref['final_otr_mol_m2_s'])
|
| 366 |
+
|
| 367 |
+
def test27_temperature_arrhenius(self):
|
| 368 |
+
cold = run_test(loaded())
|
| 369 |
+
h = configured()
|
| 370 |
+
call(h, 'thermal.set_temperature', target_k=308.15)
|
| 371 |
+
h.step(3 * 3600.0)
|
| 372 |
+
hot = run_test(loaded(h=h))
|
| 373 |
+
ratio = hot['final_otr_mol_m2_s'] / cold['final_otr_mol_m2_s']
|
| 374 |
+
expected = steady_otr(PET, 100e-6, T=308.15 - PLANT_EXAMPLE['temperature_sensor_bias_k']) / steady_otr(PET, 100e-6)
|
| 375 |
+
self.assertLess(abs(ratio - expected) / expected, 0.02)
|
| 376 |
+
self.assertGreater(ratio, 1.06 ** 12) # manufacturer: 6-15 % per degC for many barriers
|
| 377 |
+
|
| 378 |
+
def test28_humidity_dilution_and_water_sensitive_coefficient(self):
|
| 379 |
+
h = configured()
|
| 380 |
+
call(h, 'humidity.set', rh_fraction=0.9)
|
| 381 |
+
h.step(3 * 3600.0)
|
| 382 |
+
wet = run_test(loaded(h=h))
|
| 383 |
+
dry = run_test(loaded())
|
| 384 |
+
pw = h._rh_true() * saturation_pressure_pa(h.T)
|
| 385 |
+
self.assertLess(abs(wet['final_otr_mol_m2_s'] / dry['final_otr_mol_m2_s'] - (101325 - pw) / 101325), 0.02)
|
| 386 |
+
h2 = configured()
|
| 387 |
+
call(h2, 'humidity.set', rh_fraction=0.5)
|
| 388 |
+
call(h2, 'drawer.move', cell='A', open=True); h2.step(3.0)
|
| 389 |
+
with self.assertRaises(ActionRejected) as e:
|
| 390 |
+
h2.invoke('sample.mount', **dict(MOUNT_EXAMPLE, template_id='polyacrylonitrile'))
|
| 391 |
+
self.assertEqual(str(e.exception), 'HUMIDITY_COEFFICIENT_REQUIRED')
|
| 392 |
+
call(h2, 'sample.mount', **dict(MOUNT_EXAMPLE, template_id='polyacrylonitrile', thickness_m=25e-6, humidity_coefficient=2.0))
|
| 393 |
+
with self.assertRaises(ActionRejected) as e2:
|
| 394 |
+
h2.invoke('sample.mount', **dict(MOUNT_EXAMPLE, cell='B', template_id='nylon_6'))
|
| 395 |
+
self.assertIn(str(e2.exception), ('DIFFUSIVITY_REQUIRED', 'DRAWER_NOT_OPEN'))
|
| 396 |
+
f = h2.cells['A']['film']
|
| 397 |
+
P1, D1, S1 = h2._transport(f, T23, 0.5)
|
| 398 |
+
P0, D0, S0 = h2._transport(f, T23, 0.0)
|
| 399 |
+
self.assertAlmostEqual(P1 / P0, math.exp(1.0)); self.assertAlmostEqual(S1, S0)
|
| 400 |
+
with self.assertRaises(ActionRejected):
|
| 401 |
+
h2.invoke('sample.mount', **dict(MOUNT_EXAMPLE, cell='B', humidity_coefficient=1.0))
|
| 402 |
+
|
| 403 |
+
def test29_mask_area_scales_package_but_not_area_result(self):
|
| 404 |
+
full = run_test(loaded())
|
| 405 |
+
masked = run_test(loaded(mount=dict(exposed_area_m2=5e-4), cfg=dict(declared_area_m2=5e-4)))
|
| 406 |
+
self.assertLess(abs(masked['final_otr_mol_m2_s'] - full['final_otr_mol_m2_s']) / full['final_otr_mol_m2_s'], 0.03)
|
| 407 |
+
self.assertLess(abs(masked['final_otr_cc_pkg_day'] / full['final_otr_cc_pkg_day'] - 0.1), 0.005)
|
| 408 |
+
pkg = run_test(loaded(cfg=dict(report_basis='package')))
|
| 409 |
+
self.assertAlmostEqual(pkg['final_otr_cc_pkg_day'], pkg['final_otr_mol_m2_s'] * TEST_AREA_M2 * CC_DAY_PER_MOL_S)
|
| 410 |
+
|
| 411 |
+
def test30_over_range_protection(self):
|
| 412 |
+
h = loaded(thickness=25e-6) # PET 25 um ~ 257 cc/(m2 day) at 23 degC > 200
|
| 413 |
+
res = run_test(h)
|
| 414 |
+
self.assertEqual(res['validity'], 'sensor_over_range')
|
| 415 |
+
self.assertEqual(res['phase'], 'failed')
|
| 416 |
+
self.assertGreaterEqual(h.ledger()['over_range_events'], 1)
|
| 417 |
+
h.step(3600.0)
|
| 418 |
+
self.assertFalse(h.over_range)
|
| 419 |
+
empty = loaded(template=PET, mount=None, clamp=False)
|
| 420 |
+
call(empty, 'drawer.move', cell='A', open=True); empty.step(3.0)
|
| 421 |
+
call(empty, 'sample.unmount', cell='A')
|
| 422 |
+
call(empty, 'drawer.move', cell='A', open=False); empty.step(3.0)
|
| 423 |
+
call(empty, 'cell.load_unload', cell='A'); empty.step(600.0)
|
| 424 |
+
self.assertEqual(run_test(empty)['validity'], 'sensor_over_range') # an empty cartridge floods the sensor
|
| 425 |
+
|
| 426 |
+
def test31_individual_zero_removes_ambient_ingress_not_edge_leak(self):
|
| 427 |
+
leaky = run_test(loaded(plant=dict(ambient_ingress_mol_s_pa=4e-15, truseal_flush_efficiency=0.0)))
|
| 428 |
+
clean = run_test(loaded())
|
| 429 |
+
self.assertLess(abs(leaky['final_otr_mol_m2_s'] - clean['final_otr_mol_m2_s']) / clean['final_otr_mol_m2_s'], 0.02)
|
| 430 |
+
self.assertGreater(leaky['individual_zero_mol_m2_s'], 0.5 * 4e-15 * 0.2095 * 1e5 / TEST_AREA_M2)
|
| 431 |
+
edge = run_test(loaded(plant=dict(edge_leak_mol_s_pa=1e-17)))
|
| 432 |
+
bias = 1e-17 * 0.999 * 101325 / TEST_AREA_M2
|
| 433 |
+
self.assertGreater(edge['final_otr_mol_m2_s'] - clean['final_otr_mol_m2_s'], 0.8 * bias)
|
| 434 |
+
|
| 435 |
+
def test32_two_cells_share_one_sensor_with_rezero(self):
|
| 436 |
+
h = configured(cells=('A', 'B'))
|
| 437 |
+
loaded(h=h, cell='A')
|
| 438 |
+
loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6)
|
| 439 |
+
call(h, 'test.start', cell='A'); call(h, 'test.start', cell='B')
|
| 440 |
+
seen = set()
|
| 441 |
+
for _ in range(600):
|
| 442 |
+
h.step(600.0)
|
| 443 |
+
seen.add(h.route)
|
| 444 |
+
if all(h.cells[c]['test']['phase'] != 'running' for c in 'AB'):
|
| 445 |
+
break
|
| 446 |
+
self.assertTrue({'A', 'B', 'Z'} <= seen)
|
| 447 |
+
a, b = call(h, 'test.result', cell='A'), call(h, 'test.result', cell='B')
|
| 448 |
+
self.assertEqual(a['validity'], 'valid'); self.assertEqual(b['validity'], 'valid')
|
| 449 |
+
self.assertLess(abs(b['final_otr_mol_m2_s'] - steady_otr('poly_vinyl_chloride', 50e-6)) / steady_otr('poly_vinyl_chloride', 50e-6), 0.02)
|
| 450 |
+
|
| 451 |
+
def test33_standard_mode_cycles_and_start_zero(self):
|
| 452 |
+
h = loaded(cfg=dict(test_mode='standard', cycles=4, individual_zero='start', conditioning_hours=0.0))
|
| 453 |
+
res = run_test(h)
|
| 454 |
+
kinds = [r['kind'] for r in res['readings']]
|
| 455 |
+
self.assertEqual(kinds.count('exam'), 4)
|
| 456 |
+
self.assertEqual(kinds[0], 'individual_zero')
|
| 457 |
+
self.assertEqual(res['phase'], 'succeeded')
|
| 458 |
+
|
| 459 |
+
def test34_conditioning_keeps_sensor_off_the_cell(self):
|
| 460 |
+
h = loaded(cfg=dict(conditioning_hours=5.0))
|
| 461 |
+
call(h, 'test.start', cell='A')
|
| 462 |
+
routes = set()
|
| 463 |
+
for _ in range(28):
|
| 464 |
+
h.step(600.0)
|
| 465 |
+
if h.cells['A']['phase'] == 'conditioning':
|
| 466 |
+
routes.add(h.route)
|
| 467 |
+
self.assertNotIn('A', routes)
|
| 468 |
+
self.assertGreater(h.cells['A']['p_up'], 9e4) # test gas already on during conditioning
|
| 469 |
+
|
| 470 |
+
def test35_drawer_clamp_interlocks_and_scene_states(self):
|
| 471 |
+
h = configured()
|
| 472 |
+
call(h, 'drawer.move', cell='A', open=True)
|
| 473 |
+
h.step(DRAWER_TRAVEL_M / PLANT_EXAMPLE['drawer_speed_m_s'] / 2)
|
| 474 |
+
self.assertTrue(0 < h.read('evaluator')['drawer_a.position_m'] < DRAWER_TRAVEL_M)
|
| 475 |
+
with self.assertRaises(ActionRejected):
|
| 476 |
+
h.invoke('cell.load_unload', cell='A')
|
| 477 |
+
h.step(5.0)
|
| 478 |
+
self.assertEqual(h.read('evaluator')['drawer_a.position_m'], DRAWER_TRAVEL_M)
|
| 479 |
+
call(h, 'sample.mount', **MOUNT_EXAMPLE)
|
| 480 |
+
call(h, 'drawer.move', cell='A', open=False); h.step(5.0)
|
| 481 |
+
call(h, 'cell.load_unload', cell='A')
|
| 482 |
+
h.step(PLANT_EXAMPLE['clamp_actuation_s'] / 2)
|
| 483 |
+
self.assertTrue(0 < h.read('evaluator')['clamp_a.position_m'] < CLAMP_TRAVEL_M)
|
| 484 |
+
h.step(5.0)
|
| 485 |
+
st = h.read('evaluator')
|
| 486 |
+
self.assertEqual(st['clamp_a.position_m'], CLAMP_TRAVEL_M)
|
| 487 |
+
self.assertTrue(st['cell_a.clamped'] and st['cell_a.indicator_on'])
|
| 488 |
+
with self.assertRaises(ActionRejected):
|
| 489 |
+
h.invoke('drawer.move', cell='A', open=True)
|
| 490 |
+
call(h, 'test.start', cell='A')
|
| 491 |
+
with self.assertRaises(ActionRejected) as e:
|
| 492 |
+
h.invoke('cell.load_unload', cell='A')
|
| 493 |
+
self.assertEqual(str(e.exception), 'TEST_ACTIVE')
|
| 494 |
+
call(h, 'test.stop', cell='A')
|
| 495 |
+
call(h, 'cell.load_unload', cell='A'); h.step(5.0)
|
| 496 |
+
self.assertFalse(h.read('agent')['cell_a.clamped'])
|
| 497 |
+
self.assertGreater(h.ledger()['released_to_air_mol'], 0.0)
|
| 498 |
+
|
| 499 |
+
def test36_power_off_cancels_and_keeps_clamp(self):
|
| 500 |
+
h = loaded()
|
| 501 |
+
call(h, 'test.start', cell='A')
|
| 502 |
+
h.step(3 * 3600.0)
|
| 503 |
+
call(h, 'power.set', enabled=False)
|
| 504 |
+
st = h.read('evaluator')
|
| 505 |
+
self.assertEqual(st['cell_a.phase'], 'cancelled')
|
| 506 |
+
self.assertTrue(st['cell_a.clamped'])
|
| 507 |
+
self.assertIsNone(st['thermal.indicated_k'])
|
| 508 |
+
self.assertEqual(st['power.angle_rad'], 0.0)
|
| 509 |
+
self.assertEqual(call(h, 'test.result', cell='A')['validity'], 'cancelled')
|
| 510 |
+
h.step(3600.0)
|
| 511 |
+
self.assertEqual(h.sensor_I, 0.0)
|
| 512 |
+
|
| 513 |
+
def test37_conservation_over_a_complete_workflow(self):
|
| 514 |
+
h = configured(cells=('A', 'B'))
|
| 515 |
+
loaded(h=h, cell='A'); loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6)
|
| 516 |
+
call(h, 'test.start', cell='A'); call(h, 'test.start', cell='B')
|
| 517 |
+
h.step(4 * 3600.0)
|
| 518 |
+
self.assertTrue(h._test_active('B'))
|
| 519 |
+
call(h, 'test.stop', cell='B')
|
| 520 |
+
call(h, 'cell.load_unload', cell='B'); h.step(10.0)
|
| 521 |
+
call(h, 'drawer.move', cell='B', open=True); h.step(5.0)
|
| 522 |
+
call(h, 'sample.unmount', cell='B')
|
| 523 |
+
h.step(10 * 3600.0)
|
| 524 |
+
L = call(h, 'ledger.read')
|
| 525 |
+
prov = call(h, 'provenance.read')
|
| 526 |
+
self.assertIsNone(prov['cell_b'])
|
| 527 |
+
self.assertIn('poly_ethylene_terephthalate', prov['cell_a'])
|
| 528 |
+
self.assertEqual(len(prov['operations']), 2)
|
| 529 |
+
scale = max(L['film_mounted_mol'], L['carrier_in_mol'])
|
| 530 |
+
self.assertLess(abs(L['film_residual_mol']), 1e-9 * scale)
|
| 531 |
+
self.assertLess(abs(L['carrier_residual_balance_mol']), 1e-9 * scale)
|
| 532 |
+
self.assertLess(abs(L['sensor_balance_residual_mol']), 1e-12 * max(L['sensor_input_mol'], 1e-30) + 1e-24)
|
| 533 |
+
self.assertLess(abs(L['energy_residual_j']), 1e-6 * max(1.0, abs(L['tec_heat_j'])))
|
| 534 |
+
self.assertGreater(L['carrier_gas_used_mol'], 0); self.assertGreater(L['test_gas_used_mol'], 0)
|
| 535 |
+
|
| 536 |
+
def test38_step_splitting_is_consistent(self):
|
| 537 |
+
a, b = loaded(), loaded()
|
| 538 |
+
call(a, 'test.start', cell='A'); call(b, 'test.start', cell='A')
|
| 539 |
+
a.step(6 * 3600.0)
|
| 540 |
+
for _ in range(360):
|
| 541 |
+
b.step(60.0)
|
| 542 |
+
self.assertEqual(a.time_ns, b.time_ns)
|
| 543 |
+
self.assertLess(abs(a.read('evaluator')['truth.cell_a.flux_mol_s'] - b.read('evaluator')['truth.cell_a.flux_mol_s']),
|
| 544 |
+
0.01 * a.read('evaluator')['truth.cell_a.flux_mol_s'])
|
| 545 |
+
self.assertEqual(len(a.cells['A']['test']['readings']), len(b.cells['A']['test']['readings']))
|
| 546 |
+
|
| 547 |
+
def test39_no_user_gain_on_the_2_22_and_analysis(self):
|
| 548 |
+
h = loaded()
|
| 549 |
+
with self.assertRaises(ActionRejected) as e: # 2/22: out-of-spec certified film -> service, no user adjustment
|
| 550 |
+
h.invoke('sensor.adjust')
|
| 551 |
+
self.assertEqual(str(e.exception), 'UNSUPPORTED')
|
| 552 |
+
self.assertNotIn('sensor.adjust_gain', SLOTS)
|
| 553 |
+
out = call(h, 'analysis.otr', readings_mol_m2_s=[1e-8, 1.01e-8, 1e-8], individual_zero_mol_m2_s=1e-10, window=3, driving_partial_pressure_pa=1e5,
|
| 554 |
+
thickness_m=1e-4, convergence_percent=2.0)
|
| 555 |
+
self.assertAlmostEqual(out['steady_state_otr_mol_m2_s'], 1.0033333333333333e-8 - 1e-10)
|
| 556 |
+
self.assertTrue(out['converged'])
|
| 557 |
+
self.assertAlmostEqual(out['permeability_barrer'], out['permeability_mol_m_per_m2_s_pa'] / rt.BARRER_SI)
|
| 558 |
+
|
| 559 |
+
def test40_metadata_exports_every_capability_and_slot(self):
|
| 560 |
+
meta = export_ametek_oxtran_contract_metadata()
|
| 561 |
+
self.assertEqual(set(meta['capabilities']), set(CAPS))
|
| 562 |
+
self.assertEqual(set(meta['state_slots']), set(SLOTS))
|
| 563 |
+
for k, c in meta['capabilities'].items():
|
| 564 |
+
self.assertEqual(asset_tool.lint_schema(c['input_schema']) if hasattr(asset_tool, 'lint_schema') else [], [], k)
|
| 565 |
+
validate(c['input_schema'], c['example_arguments'])
|
| 566 |
+
for k, s in meta['state_slots'].items():
|
| 567 |
+
if s['origin'] == 'process_truth':
|
| 568 |
+
self.assertIn(s['visibility'], ('evaluator', 'debug'))
|
| 569 |
+
self.assertEqual(set(WRITE_VIA), {'thermal.target_k', 'humidity.target_fraction'})
|
| 570 |
+
|
| 571 |
+
|
| 572 |
+
def test41_high_permeance_film_is_stable_and_matches_coupled_steady_state(self):
|
| 573 |
+
# most permeable template with a measured D, thin film, tiny carrier chamber: film and chamber strongly coupled
|
| 574 |
+
lib = library()
|
| 575 |
+
top = max((k for k in lib if lib[k]['oxygen_diffusivity_m2_s']), key=lambda k: lib[k]['oxygen_permeability_mol_m_per_m2_s_Pa'])
|
| 576 |
+
V = 1e-7
|
| 577 |
+
h = loaded(template=top, thickness=25e-6, settle=5.0, plant=dict(carrier_chamber_volume_m3=V), cfg=dict(conditioning_hours=5.0, individual_zero='none'))
|
| 578 |
+
call(h, 'test.start', cell='A')
|
| 579 |
+
for _ in range(24):
|
| 580 |
+
call(h, 'sim.step', dt_s=300.0)
|
| 581 |
+
ev = h.read('evaluator')
|
| 582 |
+
self.assertTrue(all(math.isfinite(v) for v in ev.values() if isinstance(v, float) and not isinstance(v, bool)))
|
| 583 |
+
self.assertGreaterEqual(ev['truth.cell_a.carrier_side_o2_mol'], 0.0)
|
| 584 |
+
self.assertEqual(h.cells['A']['phase'], 'conditioning') # sensor bypassed: no over-range trip while conditioning
|
| 585 |
+
film = h.cells['A']['film']
|
| 586 |
+
P, D, S = h._transport(film, h.T, h._rh_true())
|
| 587 |
+
p = h.plant
|
| 588 |
+
p_up = h.cells['A']['p_up']
|
| 589 |
+
n_c = rt.molar_flow(CARRIER_FLOW_SCCM)
|
| 590 |
+
kh = n_c * GAS_CONSTANT * h.T / h._baro() / V
|
| 591 |
+
g = TEST_AREA_M2 * P / film['L']
|
| 592 |
+
q_in = p['edge_leak_mol_s_pa'] * p_up + p['ambient_ingress_mol_s_pa'] * (1 - p['truseal_flush_efficiency']) * h._air_o2_pa() + h._carrier_residual_fraction() * n_c
|
| 593 |
+
n_ss = (g * p_up + q_in) / (kh + g * GAS_CONSTANT * h.T / V)
|
| 594 |
+
self.assertLess(abs(h.cells['A']['n_h'] / n_ss - 1), 1e-6)
|
| 595 |
+
self.assertGreater(n_ss * GAS_CONSTANT * h.T / V, 0.5 * p_up) # carrier side far from the zero-back-pressure limit
|
| 596 |
+
L = h.ledger()
|
| 597 |
+
scale = max(L['film_mounted_mol'], L['carrier_in_mol'])
|
| 598 |
+
self.assertLess(abs(L['film_residual_mol']), 1e-9 * scale)
|
| 599 |
+
self.assertLess(abs(L['carrier_residual_balance_mol']), 1e-9 * scale)
|
| 600 |
+
|
| 601 |
+
def test42_no_carrier_supply_means_no_sweep_and_no_sensor_flow(self):
|
| 602 |
+
h = loaded(gas=dict(carrier_supply_gauge_pa=0.0), settle=1800.0)
|
| 603 |
+
n_air = AIR_O2_FRACTION * (101325.0 - 0.45 * saturation_pressure_pa(296.15)) * PLANT_EXAMPLE['carrier_chamber_volume_m3'] / (GAS_CONSTANT * 296.15)
|
| 604 |
+
self.assertGreaterEqual(h.read('evaluator')['truth.cell_a.carrier_side_o2_mol'], n_air * (1 - 1e-9)) # trapped air is not flushed
|
| 605 |
+
L = h.ledger()
|
| 606 |
+
self.assertEqual(L['carrier_gas_used_mol'], 0.0)
|
| 607 |
+
self.assertLess(abs(L['to_sensor_mol'] + L['to_vent_mol']), 1e-18) # no sweep (rounding-level only)
|
| 608 |
+
self.assertEqual(L['rezero_stream_mol'] + L['sensor_input_mol'], 0.0)
|
| 609 |
+
self.assertFalse(h.read('agent')['gas.supply_ok'])
|
| 610 |
+
with self.assertRaises(ActionRejected) as e:
|
| 611 |
+
h.invoke('test.start', cell='A')
|
| 612 |
+
self.assertEqual(str(e.exception), 'GAS_SUPPLY_PRESSURE_OUT_OF_RANGE')
|
| 613 |
+
|
| 614 |
+
def test43_rezero_stream_is_over_range_protected(self):
|
| 615 |
+
# no H2 in the carrier: 1000 ppm O2 x 10 sccm ~ 14 cc/day on the ReZero stream, far above the 1.25 cc/day protection limit
|
| 616 |
+
h = loaded(gas=dict(carrier_h2_fraction=0.0, carrier_o2_impurity_fraction=1e-3), cfg=dict(individual_zero='none', conditioning_hours=0.0))
|
| 617 |
+
call(h, 'test.start', cell='A')
|
| 618 |
+
self.assertEqual(h.seq['kind'], 'Z')
|
| 619 |
+
stream = 1e-3 * rt.molar_flow(CARRIER_FLOW_SCCM)
|
| 620 |
+
worst = 0.0
|
| 621 |
+
while h._test_active('A') and h.time_s < 40 * 3600:
|
| 622 |
+
h.step(MAX_SUBSTEP_S)
|
| 623 |
+
worst = max(worst, h.sensor_I)
|
| 624 |
+
self.assertLess(worst, 0.5 * 4 * FARADAY * stream) # protected within one sub-step, far below the stream's current
|
| 625 |
+
self.assertGreaterEqual(h.ledger()['over_range_events'], 1)
|
| 626 |
+
self.assertEqual(h.zero_list, []) # no ReZero value from a protected slot
|
| 627 |
+
self.assertEqual(call(h, 'test.result', cell='A')['validity'], 'sensor_over_range')
|
| 628 |
+
|
| 629 |
+
def test44_partial_slots_record_nothing(self):
|
| 630 |
+
# conditioning ends 20 s before the end of the first cell-A slot: that slot must not produce an exam
|
| 631 |
+
h = loaded(cfg=dict(conditioning_hours=(3600.0 - 20.0) / 3600.0, individual_zero='none', test_mode='standard', cycles=1))
|
| 632 |
+
res = run_test(h, dt=60.0)
|
| 633 |
+
times = [r['time_s'] for r in res['readings'] if r['kind'] == 'exam']
|
| 634 |
+
self.assertEqual(times, [9000.0]) # Z 0-1800, A 1800-3600 (partial), idle B, Z, A 7200-9000
|
| 635 |
+
self.assertEqual(res['validity'], 'valid')
|
| 636 |
+
self.assertLess(abs(res['final_otr_mol_m2_s'] / steady_otr(PET, 100e-6) - 1), 0.25)
|
| 637 |
+
# a test started in the middle of the other cell's idle slot waits for a complete slot
|
| 638 |
+
h = configured(cells=('A', 'B'))
|
| 639 |
+
loaded(h=h, cell='A'); loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6)
|
| 640 |
+
call(h, 'test.start', cell='A')
|
| 641 |
+
while not (h.seq['kind'] == 'B' and h.time_ns - h.seq['start_ns'] > 60e9):
|
| 642 |
+
h.step(30.0)
|
| 643 |
+
call(h, 'test.start', cell='B')
|
| 644 |
+
start_b = h.time_s
|
| 645 |
+
h.step(3 * 3600.0)
|
| 646 |
+
exams_b = [r for r in h.cells['B']['test']['readings'] if r['kind'] == 'exam']
|
| 647 |
+
self.assertTrue(exams_b)
|
| 648 |
+
self.assertGreaterEqual(exams_b[0]['time_s'], TEST_CFG_EXAMPLE['exam_minutes'] * 60.0)
|
| 649 |
+
self.assertGreater(exams_b[0]['time_s'] + start_b, start_b + 1800.0)
|
| 650 |
+
|
| 651 |
+
def test45_power_loss_during_release_unseals_the_cell(self):
|
| 652 |
+
h = loaded(settle=600.0)
|
| 653 |
+
call(h, 'cell.load_unload', cell='A') # release stroke starts
|
| 654 |
+
h.step(PLANT_EXAMPLE['clamp_actuation_s'] / 2)
|
| 655 |
+
call(h, 'power.set', enabled=False)
|
| 656 |
+
st = h.read('evaluator')
|
| 657 |
+
self.assertFalse(st['cell_a.clamped'])
|
| 658 |
+
self.assertTrue(0 < st['clamp_a.position_m'] < CLAMP_TRAVEL_M)
|
| 659 |
+
self.assertEqual(st['truth.cell_a.carrier_side_o2_mol'], 0.0)
|
| 660 |
+
with self.assertRaises(ActionRejected) as e:
|
| 661 |
+
h.invoke('drawer.move', cell='A', open=True) # the platen is still part-way down
|
| 662 |
+
self.assertEqual(str(e.exception), 'CARTRIDGE_CLAMPED')
|
| 663 |
+
call(h, 'power.set', enabled=True)
|
| 664 |
+
call(h, 'cell.load_unload', cell='A'); h.step(5.0) # completes the clamp stroke and reseals with trapped air
|
| 665 |
+
self.assertTrue(h.read('agent')['cell_a.clamped'])
|
| 666 |
+
call(h, 'cell.load_unload', cell='A'); h.step(5.0)
|
| 667 |
+
call(h, 'drawer.move', cell='A', open=True); h.step(3.0)
|
| 668 |
+
self.assertEqual(h.read('evaluator')['drawer_a.position_m'], DRAWER_TRAVEL_M)
|
| 669 |
+
L = h.ledger()
|
| 670 |
+
scale = max(L['film_mounted_mol'], L['carrier_in_mol'])
|
| 671 |
+
self.assertLess(abs(L['carrier_residual_balance_mol']), 1e-9 * scale)
|
| 672 |
+
self.assertLess(abs(L['film_residual_mol']), 1e-9 * scale)
|
| 673 |
+
|
| 674 |
+
def test46_analysis_inputs_are_bounded(self):
|
| 675 |
+
h = configured()
|
| 676 |
+
for bad in ([1e308, 1e308], [2e-3]):
|
| 677 |
+
with self.assertRaises(ActionRejected):
|
| 678 |
+
h.invoke('analysis.otr', readings_mol_m2_s=bad, individual_zero_mol_m2_s=None, window=2, driving_partial_pressure_pa=1e5, thickness_m=None,
|
| 679 |
+
convergence_percent=1.0)
|
| 680 |
+
out = call(h, 'analysis.otr', readings_mol_m2_s=[1e-3, -1e-3] * (MAX_READINGS // 2), individual_zero_mol_m2_s=-1e-3, window=100,
|
| 681 |
+
driving_partial_pressure_pa=1.0, thickness_m=0.01, convergence_percent=1.0)
|
| 682 |
+
self.assertTrue(all(math.isfinite(v) for v in out.values() if isinstance(v, float)))
|
| 683 |
+
|
| 684 |
+
def test47_describe_returns_private_copies(self):
|
| 685 |
+
h = configured()
|
| 686 |
+
h.register_principal('ag', 'agent')
|
| 687 |
+
d = h.session('ag').describe(instance_id='oxtran_01')
|
| 688 |
+
n = len(rt.LIMITATIONS)
|
| 689 |
+
d['capabilities']['test.result']['limitations'].append('mutated by a caller')
|
| 690 |
+
d['state_slots']['clock.time_s']['meaning_zh'] = 'mutated'
|
| 691 |
+
self.assertEqual(len(rt.LIMITATIONS), n)
|
| 692 |
+
meta = export_ametek_oxtran_contract_metadata()
|
| 693 |
+
self.assertNotIn('mutated by a caller', meta['mechanisms']['oxygen_permeation']['limitations'])
|
| 694 |
+
self.assertNotIn('mutated by a caller', meta['capabilities']['power.set']['limitations'])
|
| 695 |
+
self.assertNotEqual(meta['state_slots']['clock.time_s']['meaning_zh'], 'mutated')
|
| 696 |
+
|
| 697 |
+
def test48_rezero_time_base_and_new_gas_invalidates_the_baseline(self):
|
| 698 |
+
h = loaded(cfg=dict(individual_zero='none', conditioning_hours=0.0, test_mode='standard', cycles=2))
|
| 699 |
+
res = run_test(h, dt=600.0)
|
| 700 |
+
self.assertEqual([z['time_s'] for z in res['rezero_readings']][:2], [1800.0, 7200.0]) # same time base as the exams
|
| 701 |
+
self.assertEqual([r['time_s'] for r in res['readings']], [3600.0, 9000.0])
|
| 702 |
+
self.assertIsNotNone(h.zero_current)
|
| 703 |
+
call(h, 'gas.configure', **dict(GAS_EXAMPLE, carrier_o2_impurity_fraction=5e-4))
|
| 704 |
+
self.assertIsNone(h.zero_current)
|
| 705 |
+
call(h, 'test.start', cell='A')
|
| 706 |
+
self.assertEqual(h.seq['kind'], 'Z') # a new supply is re-zeroed before the next exam
|
| 707 |
+
call(h, 'power.set', enabled=False)
|
| 708 |
+
self.assertIsNone(h.zero_current)
|
| 709 |
+
|
| 710 |
+
def test49_panel_counts_carry_the_measurement_noise(self):
|
| 711 |
+
h = loaded()
|
| 712 |
+
call(h, 'test.start', cell='A')
|
| 713 |
+
diffs = []
|
| 714 |
+
for _ in range(400):
|
| 715 |
+
h.step(30.0)
|
| 716 |
+
a = h.read('agent')
|
| 717 |
+
self.assertEqual(a, h.read('agent')) # reads stay pure
|
| 718 |
+
sigma = math.hypot(PLANT_EXAMPLE['sensor_noise_a'], PLANT_EXAMPLE['sensor_relative_noise'] * max(h.sensor_I_o2, 0.0))
|
| 719 |
+
diffs.append((a['sensor.raw_counts'] * COUNT_A - h.read('evaluator')['truth.sensor_current_a']) / sigma)
|
| 720 |
+
rms = math.sqrt(sum(d * d for d in diffs) / len(diffs))
|
| 721 |
+
self.assertTrue(0.6 < rms < 1.6, rms) # carries the declared noise, not the noise-free truth
|
| 722 |
+
# an exam reading is the panel measurement at the slot end
|
| 723 |
+
t = h.cells['A']['test']
|
| 724 |
+
n = len(t['readings'])
|
| 725 |
+
while len(t['readings']) == n:
|
| 726 |
+
before = h._measured_current()
|
| 727 |
+
h.step(1.0)
|
| 728 |
+
self.assertEqual(t['readings'][-1]['sensor_counts'], int(round(h._measured_current() / COUNT_A)))
|
| 729 |
+
|
| 730 |
+
def test50_over_range_is_detected_on_the_measured_current_and_visible(self):
|
| 731 |
+
target = 1.6 / CC_DAY_PER_MOL_S # 1.6 cc/day on the sensor (> 1.25 cc/day)
|
| 732 |
+
L = steady_otr(PET, 1.0) * TEST_AREA_M2 / target
|
| 733 |
+
h = loaded(thickness=L, settle=3 * 3600.0, cfg=dict(individual_zero='none', conditioning_hours=0.0),
|
| 734 |
+
plant=dict(sensor_noise_a=0.0, sensor_relative_noise=0.0))
|
| 735 |
+
call(h, 'test.start', cell='A')
|
| 736 |
+
seen = None
|
| 737 |
+
for _ in range(800):
|
| 738 |
+
h.step(10.0)
|
| 739 |
+
a = h.read('agent')
|
| 740 |
+
if a['sensor.over_range']:
|
| 741 |
+
seen = (a['sensor.route'], a['cell_a.phase'])
|
| 742 |
+
break
|
| 743 |
+
self.assertEqual(seen, ('bypass', 'failed'))
|
| 744 |
+
self.assertGreater(h.sensor_I, 0.5 * OVER_RANGE_CURRENT_A) # the flag is raised by the current, not by the inlet flow
|
| 745 |
+
h.step(3600.0)
|
| 746 |
+
self.assertFalse(h.read('agent')['sensor.over_range'])
|
| 747 |
+
self.assertEqual(call(h, 'test.result', cell='A')['terminal_reason'], 'SENSOR_OVER_RANGE')
|
| 748 |
+
|
| 749 |
+
def test51_continuous_mode_ends_by_operator_stop(self):
|
| 750 |
+
for zero in ('end', 'none'):
|
| 751 |
+
h = loaded(cfg=dict(test_mode='continuous', individual_zero=zero, conditioning_hours=0.0))
|
| 752 |
+
call(h, 'test.start', cell='A')
|
| 753 |
+
while h.cells['A']['exam_count'] < 6:
|
| 754 |
+
call(h, 'sim.step', dt_s=1800.0)
|
| 755 |
+
out = call(h, 'test.stop', cell='A')
|
| 756 |
+
if zero == 'end':
|
| 757 |
+
self.assertEqual(out['phase'], 'running')
|
| 758 |
+
self.assertEqual(h.cells['A']['phase'], 'zero_end')
|
| 759 |
+
while h._test_active('A'):
|
| 760 |
+
call(h, 'sim.step', dt_s=1800.0)
|
| 761 |
+
res = call(h, 'test.result', cell='A')
|
| 762 |
+
self.assertEqual(res['phase'], 'succeeded')
|
| 763 |
+
self.assertEqual(res['terminal_reason'], 'TEST_COMPLETE' if zero == 'end' else 'OPERATOR_STOP')
|
| 764 |
+
self.assertEqual(res['validity'], 'valid')
|
| 765 |
+
self.assertEqual(res['individual_zero_mol_m2_s'] is not None, zero == 'end')
|
| 766 |
+
self.assertEqual(h.read('agent')['cell_a.final_otr_mol_m2_s'], res['final_otr_mol_m2_s'])
|
| 767 |
+
# standard mode stopped early is still a cancellation
|
| 768 |
+
h = loaded(cfg=dict(test_mode='standard', cycles=10, individual_zero='none', conditioning_hours=0.0))
|
| 769 |
+
call(h, 'test.start', cell='A'); h.step(3 * 3600.0)
|
| 770 |
+
self.assertEqual(call(h, 'test.stop', cell='A')['phase'], 'cancelled')
|
| 771 |
+
|
| 772 |
+
def test52_humidity_change_during_a_test_is_flagged(self):
|
| 773 |
+
h = loaded(cfg=dict(test_mode='standard', cycles=4, individual_zero='none', conditioning_hours=0.0))
|
| 774 |
+
call(h, 'test.start', cell='A')
|
| 775 |
+
h.step(2 * 3600.0)
|
| 776 |
+
call(h, 'humidity.set', rh_fraction=0.9)
|
| 777 |
+
res = run_test(h) if False else None
|
| 778 |
+
while h._test_active('A'):
|
| 779 |
+
call(h, 'sim.step', dt_s=1800.0)
|
| 780 |
+
res = call(h, 'test.result', cell='A')
|
| 781 |
+
self.assertEqual(res['validity'], 'humidity_out_of_tolerance')
|
| 782 |
+
self.assertEqual(res['conditions']['target_rh'], 0.0)
|
| 783 |
+
|
| 784 |
+
def test53_humidity_coefficient_is_a_mount_prior_without_agent_oracle(self):
|
| 785 |
+
h = configured()
|
| 786 |
+
call(h, 'drawer.move', cell='A', open=True); h.step(3.0)
|
| 787 |
+
with self.assertRaises(ActionRejected) as e: # even for a dry test
|
| 788 |
+
h.invoke('sample.mount', **dict(MOUNT_EXAMPLE, template_id='polyacrylonitrile'))
|
| 789 |
+
self.assertEqual(str(e.exception), 'HUMIDITY_COEFFICIENT_REQUIRED')
|
| 790 |
+
call(h, 'sample.mount', **dict(MOUNT_EXAMPLE, template_id='polyacrylonitrile', humidity_coefficient=0.0))
|
| 791 |
+
h.register_principal('ag', 'agent')
|
| 792 |
+
r = h.session('ag').invoke(instance_id='oxtran_01', capability_id='humidity.set', arguments={'rh_fraction': 0.5}, request_id='rh')
|
| 793 |
+
self.assertEqual(r['status'], 'succeeded') # no template-class dependent rejection
|
| 794 |
+
|
| 795 |
+
def test54_provenance_is_bounded(self):
|
| 796 |
+
h = loaded()
|
| 797 |
+
for _ in range(MAX_PROVENANCE + 5):
|
| 798 |
+
h.invoke('test.start', cell='A')
|
| 799 |
+
h.invoke('test.stop', cell='A')
|
| 800 |
+
prov = call(h, 'provenance.read')
|
| 801 |
+
self.assertEqual(len(prov['operations']), MAX_PROVENANCE)
|
| 802 |
+
self.assertEqual(prov['operations'][-1]['operation_id'], h.cells['A']['test']['op'])
|
| 803 |
+
|
| 804 |
+
def test55_ledgers_are_real_conservation_checks(self):
|
| 805 |
+
h = configured(cells=('A', 'B'), cfg=dict(conditioning_hours=0.5))
|
| 806 |
+
loaded(h=h, cell='A'); loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6)
|
| 807 |
+
call(h, 'test.start', cell='A'); call(h, 'test.start', cell='B')
|
| 808 |
+
h.step(4 * 3600.0)
|
| 809 |
+
call(h, 'humidity.set', rh_fraction=0.4); call(h, 'thermal.set_temperature', target_k=303.15)
|
| 810 |
+
h.step(3 * 3600.0)
|
| 811 |
+
call(h, 'test.stop', cell='B'); call(h, 'cell.load_unload', cell='B'); h.step(5.0)
|
| 812 |
+
call(h, 'drawer.move', cell='B', open=True); h.step(3.0)
|
| 813 |
+
call(h, 'sample.unmount', cell='B')
|
| 814 |
+
call(h, 'sample.mount', **dict(MOUNT_EXAMPLE, cell='B', template_id='polystyrene', thickness_m=500e-6))
|
| 815 |
+
h.step(1200.0)
|
| 816 |
+
call(h, 'power.set', enabled=False); h.step(1800.0); call(h, 'power.set', enabled=True)
|
| 817 |
+
call(h, 'drawer.move', cell='B', open=False); h.step(3.0)
|
| 818 |
+
call(h, 'cell.load_unload', cell='B')
|
| 819 |
+
h.step(20 * 3600.0)
|
| 820 |
+
L = call(h, 'ledger.read')
|
| 821 |
+
scale = max(L['film_mounted_mol'], L['carrier_in_mol'])
|
| 822 |
+
self.assertLess(abs(L['film_residual_mol']), 1e-12 * scale)
|
| 823 |
+
self.assertLess(abs(L['carrier_residual_balance_mol']), 1e-12 * scale)
|
| 824 |
+
self.assertLess(abs(L['sensor_balance_residual_mol']), 1e-13 * L['sensor_input_mol'])
|
| 825 |
+
self.assertLess(abs(L['energy_residual_j']), 1e-9 * abs(L['tec_heat_j']))
|
| 826 |
+
self.assertGreater(L['sensor_discarded_mol'], 0.0)
|
| 827 |
+
# the residuals are not identities: an O2 amount that appears without a booked flux shows up
|
| 828 |
+
h.cells['A']['n_h'] += 1e-9
|
| 829 |
+
self.assertAlmostEqual(h.ledger()['carrier_residual_balance_mol'] / -1e-9, 1.0, places=3)
|
| 830 |
+
h.cells['A']['conc'][0] += 1.0
|
| 831 |
+
f = h.cells['A']['film']
|
| 832 |
+
self.assertAlmostEqual(h.ledger()['film_residual_mol'] / -(f['dx'] * f['area']), 1.0, places=3)
|
| 833 |
+
|
| 834 |
+
def test56_rezero_over_range_fails_every_active_test_once(self):
|
| 835 |
+
h = configured(cells=('A', 'B'), gas=dict(carrier_h2_fraction=0.0, carrier_o2_impurity_fraction=1e-3), cfg=dict(individual_zero='none', conditioning_hours=0.0))
|
| 836 |
+
loaded(h=h, cell='A'); loaded(h=h, cell='B', template='poly_vinyl_chloride', thickness=50e-6)
|
| 837 |
+
call(h, 'test.start', cell='A'); call(h, 'test.start', cell='B')
|
| 838 |
+
self.assertEqual(h.seq['kind'], 'Z')
|
| 839 |
+
for _ in range(360):
|
| 840 |
+
h.step(10.0)
|
| 841 |
+
for cell in 'AB':
|
| 842 |
+
res = call(h, 'test.result', cell=cell)
|
| 843 |
+
self.assertEqual((res['phase'], res['validity'], res['terminal_reason']), ('failed', 'sensor_over_range', 'SENSOR_OVER_RANGE'))
|
| 844 |
+
self.assertEqual(res['exam_count'], 0)
|
| 845 |
+
self.assertEqual(h.ledger()['over_range_events'], 1) # the tripped stream is not re-entered
|
| 846 |
+
self.assertEqual(h.zero_list, [])
|
| 847 |
+
self.assertIsNone(h.seq)
|
| 848 |
+
|
| 849 |
+
def test57_cancel_aborts_even_a_continuous_test(self):
|
| 850 |
+
h = loaded(cfg=dict(test_mode='continuous', individual_zero='end', conditioning_hours=0.0))
|
| 851 |
+
h.register_principal('ag', 'agent')
|
| 852 |
+
s = h.session('ag')
|
| 853 |
+
op = s.invoke(instance_id='oxtran_01', capability_id='test.start', arguments={'cell': 'A'}, request_id='s')['operation_id']
|
| 854 |
+
h.step(6 * 3600.0)
|
| 855 |
+
c = s.cancel(op, 'c1')
|
| 856 |
+
self.assertEqual((c['status'], c['result']['phase']), ('succeeded', 'cancelled'))
|
| 857 |
+
self.assertEqual(s.cancel(op, 'c1'), c)
|
| 858 |
+
self.assertEqual(s.poll(op)['status'], 'cancelled')
|
| 859 |
+
self.assertEqual(s.poll(op)['result']['validity'], 'cancelled')
|
| 860 |
+
with self.assertRaises(ActionRejected):
|
| 861 |
+
s.cancel(op, 'c2')
|
| 862 |
+
call(h, 'cell.load_unload', cell='A') # no longer TEST_ACTIVE
|
| 863 |
+
|
| 864 |
+
def test58_no_exam_without_a_baseline(self):
|
| 865 |
+
pvc = 'poly_vinyl_chloride'
|
| 866 |
+
kw = dict(template=pvc, thickness=50e-6, cfg=dict(test_mode='standard', cycles=1, individual_zero='none', conditioning_hours=0.0), inst=dict(rezero_frequency=3))
|
| 867 |
+
h = loaded(**kw)
|
| 868 |
+
call(h, 'test.start', cell='A')
|
| 869 |
+
h.step(3600.0 - 100.0) # Z 0-1800, A 1800-3600: 100 s before the first exam
|
| 870 |
+
call(h, 'test.stop', cell='A')
|
| 871 |
+
call(h, 'gas.configure', **dict(GAS_EXAMPLE, carrier_o2_impurity_fraction=5e-4)) # new cylinder: baseline invalid
|
| 872 |
+
call(h, 'test.start', cell='A')
|
| 873 |
+
while h._test_active('A'):
|
| 874 |
+
h.step(600.0)
|
| 875 |
+
res = call(h, 'test.result', cell='A')
|
| 876 |
+
self.assertTrue(res['rezero_readings'])
|
| 877 |
+
self.assertLess(res['rezero_readings'][0]['time_s'], res['readings'][0]['time_s'])
|
| 878 |
+
self.assertEqual(res['validity'], 'valid')
|
| 879 |
+
self.assertLess(abs(res['final_otr_mol_m2_s'] / steady_otr(pvc, 50e-6) - 1), 0.03)
|
| 880 |
+
|
| 881 |
+
def test59_capability_metadata_is_specific(self):
|
| 882 |
+
meta = export_ametek_oxtran_contract_metadata()
|
| 883 |
+
slots = meta['state_slots']
|
| 884 |
+
pre = {json.dumps(c['preconditions'], ensure_ascii=False, sort_keys=True) for c in meta['capabilities'].values() if c['preconditions']}
|
| 885 |
+
self.assertGreater(len(pre), 8) # not one template for every command
|
| 886 |
+
for k, c in meta['capabilities'].items():
|
| 887 |
+
for e in c['errors']:
|
| 888 |
+
self.assertNotEqual(e['meaning_zh'], e['code'], k)
|
| 889 |
+
self.assertNotIn(e['code'], ('TEST_COMPLETE', 'OPERATOR_STOP'), k) # success reasons are not errors
|
| 890 |
+
for sid in c['observes'] + [x for p in c['preconditions'] for x in p['state_ids']]:
|
| 891 |
+
self.assertIn(sid, slots, k)
|
| 892 |
+
if c['visibility'] == 'agent':
|
| 893 |
+
self.assertTrue(all(slots[sid]['visibility'] == 'agent' for sid in c['observes']), k)
|
| 894 |
+
if c['availability'] == 'implemented' and c['kind'] not in ('analysis', 'query'):
|
| 895 |
+
self.assertTrue(c['observes'] or k == 'test.configure', k)
|
| 896 |
+
params = meta['mechanisms']['oxygen_permeation']['parameters']
|
| 897 |
+
humanized = [k for k, v in params.items() if v['meaning_zh'].split(';')[0].replace(' ', '_').lower() == k.lower()]
|
| 898 |
+
self.assertEqual(humanized, [])
|
| 899 |
+
self.assertIsNotNone(slots['truth.cell_a.test_side_o2_pa']['reference_conditions'])
|
| 900 |
+
for k in ('humidity_coefficient', 'permeability_override_mol_m_per_m2_s_pa', 'diffusivity_override_m2_s', 'declared_thickness_m', 'manual_barometer_pa'):
|
| 901 |
+
self.assertIn(k, params) # nullable host priors are exported too
|
| 902 |
+
caps = meta['capabilities']
|
| 903 |
+
self.assertNotIn('ACCESS_DENIED', [e['code'] for e in caps['test.start']['errors']]) # agent-visible and not foreign-guarded
|
| 904 |
+
self.assertIn('ACCESS_DENIED', [e['code'] for e in caps['test.stop']['errors']])
|
| 905 |
+
self.assertIn('INVALID_ARGUMENT', [e['code'] for e in caps['sensor.adjust']['errors']])
|
| 906 |
+
# the preconditions that reject test.start / cell.load_unload are visible to an agent
|
| 907 |
+
h = loaded(cells=('A',), clamp=False)
|
| 908 |
+
a = h.read('agent')
|
| 909 |
+
self.assertTrue(a['cell_a.method_configured'] and not a['cell_b.method_configured'])
|
| 910 |
+
call(h, 'cell.load_unload', cell='A')
|
| 911 |
+
self.assertTrue(h.read('agent')['cell_a.clamp_moving'])
|
| 912 |
+
h.step(5.0)
|
| 913 |
+
self.assertFalse(h.read('agent')['cell_a.clamp_moving'])
|
| 914 |
+
|
| 915 |
+
if __name__ == '__main__':
|
| 916 |
+
unittest.main()
|
tests/test_asset_antonpaar_hit300.py
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM130 empirical indentation, finite work, OP observation and session tests."""
|
| 2 |
+
import copy,hashlib,importlib.util,json,math,sys,unittest
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
import numpy as np
|
| 5 |
+
ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts'))
|
| 6 |
+
from asset_runtime import antonpaar_hit300 as rt
|
| 7 |
+
OBSERVED=[];STATES=[]
|
| 8 |
+
def canonical(v):
|
| 9 |
+
if isinstance(v,dict):return {str(k):canonical(x) for k,x in v.items()}
|
| 10 |
+
if isinstance(v,(list,tuple)):return [canonical(x) for x in v]
|
| 11 |
+
if isinstance(v,np.ndarray):return v.tolist()
|
| 12 |
+
return v
|
| 13 |
+
def state(h):return json.dumps(canonical(h.__dict__),sort_keys=True,allow_nan=False)
|
| 14 |
+
def call(h,k,**a):
|
| 15 |
+
before=h.read();r=h.invoke(k,**a);after=h.read();json.dumps(r,allow_nan=False);json.dumps(after,allow_nan=False);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));STATES.append(after)
|
| 16 |
+
changed={x for x in before if before[x]!=after[x]}
|
| 17 |
+
if not changed<=set(rt.CAPS[k]['effects']):raise AssertionError((k,'undeclared state effects',changed-set(rt.CAPS[k]['effects'])))
|
| 18 |
+
return r
|
| 19 |
+
def step(h,t):h.step(t);STATES.append(h.read());json.dumps(h.read(),allow_nan=False)
|
| 20 |
+
def setup(name='hit_test',plant=None,sample=None,method=None,calibration=None):
|
| 21 |
+
h=rt.AntonpaarHit300Runtime(name)
|
| 22 |
+
for k,a in [('plant.configure',dict(rt.PLANT_EXAMPLE,**(plant or {}))),('specimen.load',dict(rt.SAMPLE_EXAMPLE,**(sample or {}))),('power.set',{'enabled':True}),('clamp.set',{'locked':True}),('stage.set_y',{'position_m':.02,'accept_manual':True}),('stage.move_x',{'position_m':.02,'speed_m_s':.005}),('sensor.zero',{}),('sensor.calibrate',dict(rt.CALIBRATION_EXAMPLE,**(calibration or {}))),('head.set_position',{'distance_m':0.})]:call(h,k,**a)
|
| 23 |
+
step(h,9.);call(h,'contact.set',engaged=True);call(h,'method.configure',**dict(dict(rt.METHOD_EXAMPLE,x_positions_m=[.02],hold_s=.2),**(method or {})));return h
|
| 24 |
+
def run(h):
|
| 25 |
+
call(h,'acquisition.start')
|
| 26 |
+
for _ in range(4000):
|
| 27 |
+
step(h,.1)
|
| 28 |
+
if h.phase!='running':break
|
| 29 |
+
if h.phase=='running':raise AssertionError('no finite terminal state')
|
| 30 |
+
return call(h,'acquisition.result')
|
| 31 |
+
def park(h):
|
| 32 |
+
if h.phase=='running':call(h,'acquisition.stop')
|
| 33 |
+
step(h,3.);call(h,'contact.set',engaged=False);call(h,'head.set_position',distance_m=.09);step(h,9.)
|
| 34 |
+
def cleanup(h):park(h);call(h,'clamp.set',locked=False);call(h,'specimen.remove');call(h,'power.set',enabled=False)
|
| 35 |
+
def fixture(m=1.5,frame=0.,n=101):
|
| 36 |
+
x=np.linspace(1.,.05,n);p=.005*x**m;h=1e-7+1e-7*x+frame*p;return p.tolist(),h.tolist()
|
| 37 |
+
class TestHIT300(unittest.TestCase):
|
| 38 |
+
def rejected(self,h,k,error='.',**a):
|
| 39 |
+
before=state(h)
|
| 40 |
+
with self.assertRaisesRegex(rt.ActionRejected,error):h.invoke(k,**a)
|
| 41 |
+
self.assertEqual(before,state(h))
|
| 42 |
+
def ledger(self,h):
|
| 43 |
+
l=call(h,'ledger.read');self.assertLess(abs(l['sample_error_kg']),1e-13);self.assertLess(abs(l['volume_error_m3']),1e-19);self.assertLess(abs(l['energy_error_j']),1e-19);self.assertLess(abs(l['thermal_error_j']),1e-19);self.assertGreaterEqual(l['pristine_volume_m3'],0.);self.assertAlmostEqual(l['plastic_work_j'],l['heat_input_j']+l['defect_stored_j'],places=20);return l
|
| 44 |
+
def test_01_raw_source_time_padding_and_branch_preservation(self):
|
| 45 |
+
r=rt.library()['substances']['borofloat33_5mn_rep1'];original=json.dumps(r,sort_keys=True);m=rt.source_model(r,True);self.assertEqual(len(r['values']['load_n']),652);self.assertIsNone(r['values']['time_s']);self.assertEqual(m['projection']['padding_nodes_excluded'],540);self.assertEqual(m['projection']['active_last_index'],111);self.assertGreater(m['projection']['elastic_release_below_observed_min_load_n'],0);self.assertEqual(original,json.dumps(r,sort_keys=True));self.assertGreater(m['maximum_load'],.005);self.assertTrue(np.all(np.diff(m['plastic'])>=0))
|
| 46 |
+
def test_02_two_real_materials_drive_different_observed_outputs(self):
|
| 47 |
+
moduli=[]
|
| 48 |
+
for rid in ['borofloat33_5mn_rep1','soda_lime_glass_5mn_rep1']:
|
| 49 |
+
h=setup(sample={'reference_id':rid});r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(r['completed_indents'],1);self.assertIsNotNone(r['points'][0]['analysis']);self.assertEqual(r['reference_id'],rid);moduli.append(r['points'][0]['analysis']['sample_modulus_pa']);self.ledger(h)
|
| 50 |
+
self.assertNotEqual(*moduli)
|
| 51 |
+
def test_03_full_array_load_release_retract_move_and_history(self):
|
| 52 |
+
h=setup(method={'x_positions_m':[.02,.022]});r=run(h);self.assertEqual(r['completed_indents'],2);self.assertEqual(len(r['points']),2);self.assertEqual(len(h.damage),2);self.assertGreater(h.damage[0]['plastic_depth_m'],0);self.assertEqual(h.stage_y,.02);self.assertAlmostEqual(h.stage_x,.022);phases={x['phase'] for x in r['rows']};self.assertTrue({'loading','holding','unloading','release','retracting','moving','approaching'}<=phases);self.assertEqual(h.force,0.);self.ledger(h)
|
| 53 |
+
def test_04_actual_load_is_not_target_and_read_never_steps(self):
|
| 54 |
+
h=setup();call(h,'acquisition.start');self.assertEqual(h.force,0.);before=state(h)
|
| 55 |
+
for _ in range(3):h.read();call(h,'acquisition.result');h.describe()
|
| 56 |
+
self.assertEqual(state(h),before);step(h,.1);self.assertGreater(h.force,0.);self.assertLess(h.force,h.force_target);self.assertAlmostEqual(h.force_target,.1*h.method['loading_rate_n_s']);self.assertGreater(h.plastic_depth,0.)
|
| 57 |
+
def test_05_op_analytic_powerlaw_hardness_and_reduced_vs_sample_modulus(self):
|
| 58 |
+
for exponent in [1.2,1.5,2.,2.8]:
|
| 59 |
+
p,h=fixture(exponent);c=rt.CALIBRATION_EXAMPLE;r=rt.oliver_pharr(p,h,c);s=.005*exponent/1e-7;hc=2e-7-c['epsilon']*.005/s;area=24.5*hc*hc;er=math.sqrt(math.pi)*s/(2*c['beta']*math.sqrt(area));e=(1-c['poisson_sample']**2)/(1/er-(1-c['poisson_tip']**2)/c['young_tip_pa']);self.assertAlmostEqual(r['unloading_exponent'],exponent,delta=1e-6);self.assertAlmostEqual(r['hardness_pa'],.005/area,delta=1000);self.assertAlmostEqual(r['sample_modulus_pa'],e,delta=10000);self.assertNotEqual(r['sample_modulus_pa'],r['reduced_modulus_pa'])
|
| 60 |
+
def test_06_frame_compliance_corrected_once(self):
|
| 61 |
+
p,h=fixture(frame=3e-7);base=rt.oliver_pharr(*fixture(),rt.CALIBRATION_EXAMPLE);good=rt.oliver_pharr(p,h,dict(rt.CALIBRATION_EXAMPLE,frame_compliance_m_n=3e-7));bad=rt.oliver_pharr(p,h,rt.CALIBRATION_EXAMPLE);self.assertAlmostEqual(good['stiffness_n_m'],base['stiffness_n_m'],delta=.01);self.assertAlmostEqual(good['sample_modulus_pa'],base['sample_modulus_pa'],delta=1000);self.assertGreater(abs(bad['stiffness_n_m']-good['stiffness_n_m']),100)
|
| 62 |
+
def test_07_op_rejects_loading_creep_nose_and_bad_window(self):
|
| 63 |
+
hst=setup();p,h=fixture();a=dict(load_n=p,depth_m=h,calibration=rt.CALIBRATION_EXAMPLE);self.rejected(hst,'analysis.oliver_pharr','NOT_UNLOADING',**dict(a,load_n=p[::-1],depth_m=h[::-1]));nose=h.copy();nose[2]=h[0]*1.1;self.rejected(hst,'analysis.oliver_pharr','UNLOADING_NOSE',**dict(a,depth_m=nose));self.rejected(hst,'analysis.oliver_pharr','FIT_DATA',**dict(a,depth_m=h[:-1]));self.rejected(hst,'analysis.oliver_pharr','CALIBRATION_DOMAIN',**dict(a,calibration=dict(rt.CALIBRATION_EXAMPLE,fit_min_fraction=.8,fit_max_fraction=.5)));self.rejected(hst,'analysis.oliver_pharr','ELASTIC_UNLOADING_NOT_ACCEPTED',**dict(a,calibration=dict(rt.CALIBRATION_EXAMPLE,accept_elastic_unloading=False)))
|
| 64 |
+
def test_08_op_peak_depth_is_paired_not_global_max(self):
|
| 65 |
+
p,h=fixture();h[1]=h[0]*1.001;r=rt.oliver_pharr(p,h,rt.CALIBRATION_EXAMPLE);self.assertEqual(r['max_depth_m'],h[0]);self.assertNotEqual(r['max_depth_m'],max(h))
|
| 66 |
+
def test_09_area_domain_and_tip_poisson_correction_fail_explicitly(self):
|
| 67 |
+
h=setup();p,d=fixture();a=dict(load_n=p,depth_m=d,calibration=dict(rt.CALIBRATION_EXAMPLE,area_min_depth_m=1e-6));self.rejected(h,'analysis.oliver_pharr','CONTACT_AREA_DOMAIN',**a);a['calibration']=dict(rt.CALIBRATION_EXAMPLE,young_tip_pa=1e9);self.rejected(h,'analysis.oliver_pharr','MODULUS_DOMAIN',**a)
|
| 68 |
+
def test_10_live_analysis_uses_only_observed_unloading(self):
|
| 69 |
+
h=setup();r=run(h);rr=[x for x in r['rows'] if x['phase']=='unloading'];external=call(h,'analysis.oliver_pharr',load_n=[x['force_n'] for x in rr],depth_m=[x['depth_m'] for x in rr],calibration=rt.CALIBRATION_EXAMPLE);self.assertEqual(external,r['points'][0]['analysis']);self.assertIn('h_corrected',external['evidence'])
|
| 70 |
+
def test_11_no_fake_success_on_sparse_analysis(self):
|
| 71 |
+
h=setup(method={'sample_interval_s':2.});r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertIsNone(r['points'][0]['analysis']);self.assertIn(r['points'][0]['analysis_error'],['FIT_POINTS','FIT_DATA']);self.assertEqual(r['completed_indents'],1)
|
| 72 |
+
def test_12_known_force_program_exact_and_actual_phase_times(self):
|
| 73 |
+
h=setup(method={'hold_s':1.});r=run(h);phases={k:[x for x in r['rows'] if x['phase']==k] for k in ['loading','holding','unloading','release']};self.assertAlmostEqual(phases['holding'][0]['time_s']-phases['loading'][0]['time_s'],3.,places=9);self.assertAlmostEqual(phases['unloading'][0]['time_s']-phases['holding'][0]['time_s'],1.,places=9);self.assertAlmostEqual(phases['release'][0]['time_s']-phases['unloading'][0]['time_s'],3.,places=9);self.assertGreater(r['elapsed_s'],7.);self.assertAlmostEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s'])
|
| 74 |
+
def test_13_piecewise_plastic_work_matches_independent_source_integral(self):
|
| 75 |
+
h=setup();r=run(h);pmax=h.method['peak_load_n'];p=h.model['load'];hp=h.model['plastic'];grid=np.r_[0.,p[(p>0)&(p<pmax)],pmax];plastic=np.interp(grid,p,hp);expected=float(np.sum(.5*(grid[1:]+grid[:-1])*np.diff(plastic)));l=self.ledger(h);self.assertAlmostEqual(l['plastic_work_j'],expected,delta=1e-19);self.assertAlmostEqual(h.plastic_depth,float(np.interp(pmax,p,hp)),places=17);m=h.model['exponent'];elastic=pmax*(pmax/h.model['coefficient'])**(1/m)/(m+1);self.assertAlmostEqual(l['elastic_recovered_j'],elastic,delta=1e-17);self.assertEqual(l['elastic_stored_j'],0.)
|
| 76 |
+
def test_14_finite_mass_persistent_deformation_and_recovery(self):
|
| 77 |
+
h=setup();mass=h._ledger()['sample_present_kg'];run(h);l=self.ledger(h);self.assertEqual(l['sample_present_kg'],mass);self.assertGreater(l['deformed_volume_m3'],0);self.assertGreater(l['pristine_volume_m3'],0);self.assertAlmostEqual(l['deformed_volume_m3'],h.specimen['deformation_shape_factor']*h.specimen['deformation_area_c2']*h.plastic_depth**3,delta=1e-32);cleanup(h);l=self.ledger(h);self.assertEqual(l['sample_present_kg'],0.);self.assertEqual(l['sample_recovered_kg'],mass);self.assertEqual(l['deformed_volume_m3'],0.)
|
| 78 |
+
def test_15_reject_same_position_overlap_and_allow_new_manual_y(self):
|
| 79 |
+
h=setup();run(h);self.rejected(h,'acquisition.start','POSITION_ALREADY_DAMAGED');park(h);call(h,'stage.set_y',position_m=.021,accept_manual=True);call(h,'head.set_position',distance_m=0.);step(h,9.);call(h,'contact.set',engaged=True);r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(len(h.damage),2)
|
| 80 |
+
h=setup(method={'x_positions_m':[.02,.02001]});self.rejected(h,'acquisition.start','ARRAY_OVERLAP')
|
| 81 |
+
def test_16_atomic_hardware_limits_and_sampling_grid(self):
|
| 82 |
+
h=setup()
|
| 83 |
+
for field,v in [('peak_load_n',.500001),('peak_load_n',0.),('x_positions_m',[.04001]),('sample_interval_s',.15),('sample_interval_s',.16)]:self.rejected(h,'method.configure',**dict(h.method,**{field:v}))
|
| 84 |
+
for dt in [True,-.1,float('nan'),float('inf')]:self.rejected(h,'sim.step',dt_s=dt)
|
| 85 |
+
self.rejected(h,'stage.move_x',position_m=.05,speed_m_s=.01);self.rejected(h,'head.set_position',distance_m=.09001);self.rejected(h,'power.set',enabled=1);self.rejected(h,'method.configure',**dict(h.method,unexpected=1))
|
| 86 |
+
def test_17_source_load_range_unknown_conditions_and_explicit_transfer(self):
|
| 87 |
+
h=setup(method={'peak_load_n':.01});self.rejected(h,'acquisition.start','REFERENCE_LOAD_DOMAIN');h=setup(sample={'accept_unknown_conditions':False});self.rejected(h,'acquisition.start','UNKNOWN_REFERENCE_CONDITIONS');h=setup(sample={'accept_condition_transfer':False},method={'hold_s':5.,'peak_load_n':.002});self.rejected(h,'acquisition.start','REFERENCE_CONDITIONS');h=rt.AntonpaarHit300Runtime();call(h,'plant.configure',**rt.PLANT_EXAMPLE);self.rejected(h,'specimen.load','MODEL_NOT_ACCEPTED',**dict(rt.SAMPLE_EXAMPLE,accept_elastic_release_extrapolation=False))
|
| 88 |
+
def test_18_dynamic_strain_rate_hold_and_noise_unsupported(self):
|
| 89 |
+
h=setup()
|
| 90 |
+
for key,v in [('mode','dynamic'),('control','strain_rate')]:self.rejected(h,'method.configure','UNSUPPORTED',**dict(h.method,**{key:v}))
|
| 91 |
+
self.rejected(h,'method.configure','HOLD_MODEL_NOT_ACCEPTED',**dict(h.method,accept_no_creep_hold=False))
|
| 92 |
+
for k in rt.UNSUPPORTED:self.rejected(h,k,'UNSUPPORTED')
|
| 93 |
+
def test_19_manual_y_requires_clearance_acceptance_and_no_automatic_y(self):
|
| 94 |
+
h=setup();self.rejected(h,'stage.set_y','HEAD_NOT_CLEAR',position_m=.01,accept_manual=True);park(h);self.rejected(h,'stage.set_y','MANUAL_ACTION_NOT_ACCEPTED',position_m=.01,accept_manual=False);t=h.time_s;call(h,'stage.set_y',position_m=.01,accept_manual=True);self.assertEqual(h.time_s,t);self.assertEqual(h.stage_y,.01);call(h,'stage.move_x',position_m=.03,speed_m_s=.005);self.assertEqual(h.stage_x,.02);step(h,1.);self.assertAlmostEqual(h.stage_x,.025);self.assertEqual(h.stage_y,.01)
|
| 95 |
+
def test_20_common_reference_ring_drift_cancels_not_differential(self):
|
| 96 |
+
a=setup();b=setup(plant={'common_drift_m_s':5e-9});c=setup(plant={'differential_drift_m_s':5e-9});ra=run(a);rb=run(b);rc=run(c)
|
| 97 |
+
for x,y in zip(ra['rows'],rb['rows']):
|
| 98 |
+
if x['depth_m'] is not None:self.assertAlmostEqual(x['depth_m'],y['depth_m'],places=19)
|
| 99 |
+
self.assertNotEqual(ra['rows'][-1]['tip_indicated_m'],rb['rows'][-1]['tip_indicated_m']);self.assertGreater(abs(rc['points'][0]['analysis']['hardness_pa']-ra['points'][0]['analysis']['hardness_pa']),1e8)
|
| 100 |
+
def test_21_frame_compliance_and_sensor_gain_change_observations(self):
|
| 101 |
+
a=setup();b=setup(plant={'frame_compliance_m_n':3e-7},calibration={'frame_compliance_m_n':3e-7});c=setup(plant={'force_gain':.9,'depth_gain':1.03});ra=run(a)['points'][0]['analysis'];rb=run(b)['points'][0]['analysis'];rc=run(c)['points'][0]['analysis'];self.assertLess(abs(rb['hardness_pa']/ra['hardness_pa']-1),.002);self.assertGreater(abs(rc['hardness_pa']/ra['hardness_pa']-1),.05);self.assertAlmostEqual(a.plastic_work,b.plastic_work,places=20);self.assertAlmostEqual(a.plastic_work,c.plastic_work,places=20)
|
| 102 |
+
def test_22_external_sensor_zero_no_free_truth(self):
|
| 103 |
+
h=setup(plant={'force_offset_n':1e-5,'depth_offset_m':2e-9});park(h);call(h,'sensor.zero');self.assertAlmostEqual(h.calibration['force_zero_n'],1e-5,places=14);self.assertAlmostEqual(h.calibration['depth_zero_m'],2e-9,places=16);self.assertEqual(h.read()['depth.indicated_m'],None);self.assertNotIn('sample_modulus_pa',h.__dict__)
|
| 104 |
+
def test_23_nanowatt_heat_stable_energy_and_defect_partition(self):
|
| 105 |
+
h=setup(plant={'heat_loss_w_k':0.,'plastic_heat_fraction':.7});run(h);l=self.ledger(h);self.assertGreater(l['thermal_stored_j'],1e-11);self.assertAlmostEqual(l['thermal_stored_j'],.7*l['plastic_work_j'],delta=1e-23);self.assertAlmostEqual(l['defect_stored_j'],.3*l['plastic_work_j'],delta=1e-23)
|
| 106 |
+
h=setup(plant={'thermal_capacity_j_k':1e-6,'heat_loss_w_k':1000.});run(h);self.assertGreaterEqual(h.temperature,296.15);self.assertLess(h.temperature,296.15001);self.ledger(h)
|
| 107 |
+
def test_24_passive_cooling_tracks_nanojoules_without_absolute_T_loss(self):
|
| 108 |
+
h=setup();run(h);e=h.thermal_excess_j;step(h,10.);self.assertAlmostEqual(h.thermal_excess_j,e*math.exp(-.1),delta=1e-23);self.ledger(h)
|
| 109 |
+
def test_25_finite_thickness_failure_and_no_material_deletion(self):
|
| 110 |
+
h=setup(sample={'thickness_m':1e-8});r=run(h);self.assertEqual(r['error_code'],'SPECIMEN_THICKNESS');self.assertLess(r['elapsed_s'],3.);self.assertLessEqual(h._depth(),1e-8+1e-16);self.assertEqual(r['completed_indents'],0);self.assertEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s']);self.ledger(h)
|
| 111 |
+
def test_26_force_sensor_overrange_and_tiny_thermal_domain(self):
|
| 112 |
+
h=setup(plant={'depth_gain':10.,'depth_offset_m':.000199});r=run(h);self.assertEqual(r['error_code'],'SENSOR_OVER_RANGE');self.assertIsNone(r['rows'][-1]['depth_m']);self.ledger(h)
|
| 113 |
+
h=setup(plant={'thermal_capacity_j_k':1e-6,'heat_loss_w_k':0.,'temperature_max_k':296.150001});r=run(h);self.assertEqual(r['error_code'],'THERMAL_MODEL_RANGE');self.assertLessEqual(h.temperature,296.150001);self.ledger(h)
|
| 114 |
+
def test_27_cancel_partial_array_keeps_damage_and_force(self):
|
| 115 |
+
h=setup(method={'x_positions_m':[.02,.022]});call(h,'acquisition.start');step(h,7.);self.assertEqual(h.completed,1);step(h,2.);call(h,'acquisition.stop');r=call(h,'acquisition.result');self.assertEqual(r['completed_indents'],1);self.assertEqual(r['points'][-1]['phase'],'cancelled');force=h.force;depth=h.damage[-1]['plastic_depth_m'];self.assertGreater(force,0);self.rejected(h,'contact.set','LOAD_NOT_RELEASED',engaged=False);step(h,3.);self.assertEqual(h.force,0.);self.assertEqual(h.damage[-1]['plastic_depth_m'],depth);self.assertEqual(r,call(h,'acquisition.result'));self.ledger(h)
|
| 116 |
+
def test_28_emergency_timeout_and_explicit_no_auto_resume(self):
|
| 117 |
+
h=setup();call(h,'acquisition.start');step(h,.5);call(h,'emergency.stop');self.assertEqual(h.error,'SOFTWARE_STOP');self.rejected(h,'emergency.reset','LOAD_NOT_RELEASED');step(h,3.);call(h,'emergency.reset');self.assertEqual(h.phase,'failed');self.ledger(h)
|
| 118 |
+
h=setup(method={'timeout_s':.2});r=run(h);self.assertEqual(r['error_code'],'TIMEOUT');self.assertAlmostEqual(r['elapsed_s'],.2)
|
| 119 |
+
def test_29_array_reject_prevalidated_later_damage_and_overlap(self):
|
| 120 |
+
h=setup();run(h);park(h);call(h,'stage.move_x',position_m=.022,speed_m_s=.005);step(h,1.);call(h,'head.set_position',distance_m=0.);step(h,9.);call(h,'contact.set',engaged=True);call(h,'method.configure',**dict(h.method,x_positions_m=[.022,.02]));self.rejected(h,'acquisition.start','POSITION_ALREADY_DAMAGED');self.assertEqual(len(h.damage),1)
|
| 121 |
+
def test_30_frozen_result_survives_sample_calibration_and_method(self):
|
| 122 |
+
h=setup();r=run(h);op=r['operation_id'];cleanup(h);call(h,'sensor.calibrate',**dict(rt.CALIBRATION_EXAMPLE,area_c2=30.));call(h,'method.configure',**dict(h.method,peak_load_n=.001));call(h,'specimen.load',**dict(rt.SAMPLE_EXAMPLE,reference_id='soda_lime_glass_5mn_rep1'));self.assertEqual(r,call(h,'acquisition.result'));self.assertEqual(r,h.records[op]);self.assertEqual(r['reference_id'],'borofloat33_5mn_rep1')
|
| 123 |
+
def test_31_pure_queries_and_owner_not_stolen(self):
|
| 124 |
+
h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start')['operation_id'];step(h,.3);before=state(h);h.read();h.describe();s.read(instance_id=h.instance_id);s.poll(op);call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);call(h,'ledger.read');self.assertEqual(state(h),before);q=s.invoke(instance_id=h.instance_id,capability_id='acquisition.result',arguments={},request_id='result');self.assertIsNone(q['operation_id']);self.assertEqual(h._owners[op],'agent');json.dumps(q,allow_nan=False)
|
| 125 |
+
def test_32_session_identity_owner_and_request_idempotence(self):
|
| 126 |
+
h=setup();h.register_principal('other');a=h.session();b=h.session('other');args=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start');r=a.invoke(**args);self.assertEqual(r,a.invoke(**args));op=r['operation_id']
|
| 127 |
+
for k in ['acquisition.result','acquisition.stop']:self.assertEqual(b.invoke(instance_id=h.instance_id,capability_id=k,arguments={},request_id=k)['error']['code'],'ACCESS_DENIED')
|
| 128 |
+
for fn in [lambda:b.poll(op),lambda:b.cancel(op,'cancel')]:
|
| 129 |
+
with self.assertRaises(rt.ActionRejected):fn()
|
| 130 |
+
self.assertEqual(a.invoke(**dict(args,capability_id='power.set',arguments={'enabled':False}))['error']['code'],'REQUEST_CONFLICT');c=a.cancel(op,'cancel');self.assertEqual(c,a.cancel(op,'cancel'))
|
| 131 |
+
def test_33_stale_cancel_retry_keeps_new_operation_running(self):
|
| 132 |
+
h=setup();s=h.session();a=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='one');op=s.invoke(**a)['operation_id'];c=s.cancel(op,'cancel');step(h,.1);op2=s.invoke(**dict(a,request_id='two'))['operation_id'];self.assertEqual(c,s.cancel(op,'cancel'));self.assertEqual(h.phase,'running');self.assertEqual(h.operation_id,op2)
|
| 133 |
+
with self.assertRaisesRegex(rt.ActionRejected,'REQUEST_CONFLICT'):s.cancel(op2,'cancel')
|
| 134 |
+
def test_34_agent_truth_recovery_and_writes_denied(self):
|
| 135 |
+
h=setup();s=h.session();meta=s.describe(instance_id=h.instance_id);self.assertTrue(all(not k.startswith('truth.') for k in meta['state_slots']));self.assertNotIn('specimen.remove',meta['capabilities']);self.assertNotIn('ledger.read',meta['capabilities']);self.assertTrue(all(not k.startswith('truth.') for k in s.read(instance_id=h.instance_id)['observations']))
|
| 136 |
+
for k in ['specimen.remove','ledger.read','plant.configure','sim.step']:
|
| 137 |
+
before=state(h);r=s.invoke(instance_id=h.instance_id,capability_id=k,arguments=rt.CAPS[k]['example_arguments'],request_id=k);self.assertEqual(r['error']['code'],'ACCESS_DENIED');self.assertEqual(before,state(h))
|
| 138 |
+
with self.assertRaises(rt.ActionRejected):s.read(instance_id=h.instance_id,state_ids=['truth.plastic_depth_m'])
|
| 139 |
+
with self.assertRaises(rt.ActionRejected):s.write(instance_id=h.instance_id,state_id='force.target_n',value=.4,request_id='x')
|
| 140 |
+
def test_35_two_instances_fractional_and_large_host_steps(self):
|
| 141 |
+
a=setup('a');b=setup('b');call(a,'acquisition.start');call(b,'acquisition.start');step(a,1.3)
|
| 142 |
+
for dt in [.03,.07,.25,.15,.4,.4]:step(b,dt)
|
| 143 |
+
self.assertEqual(a.read(),b.read());self.assertEqual(a.rows,b.rows);before=state(b);step(a,.1);self.assertEqual(before,state(b));call(a,'sim.step',dt_s=0.)
|
| 144 |
+
a=setup('a',plant={'force_response_tau_s':1e-5,'sensor_tau_s':1e-5});b=setup('b',plant={'force_response_tau_s':1e-5,'sensor_tau_s':1e-5});call(a,'acquisition.start');call(b,'acquisition.start');step(a,8.)
|
| 145 |
+
for _ in range(80):step(b,.1)
|
| 146 |
+
self.assertEqual(a.read(),b.read());self.assertEqual(a.rows,b.rows);self.assertEqual(a.phase,'succeeded')
|
| 147 |
+
def test_36_reference_only_and_projection_acceptance(self):
|
| 148 |
+
h=setup();park(h);call(h,'clamp.set',locked=False);call(h,'specimen.remove');records=rt.library()['substances'];rid=next(k for k,r in records.items() if not r.get('runtime_usable'));self.rejected(h,'specimen.load','INVALID_REFERENCE',**dict(rt.SAMPLE_EXAMPLE,reference_id=rid));self.rejected(h,'reference.query','INVALID_REFERENCE',reference_id='missing');r=copy.deepcopy(records[rt.SAMPLE_EXAMPLE['reference_id']]);r['values']['depth_m'][5]=-1e-9
|
| 149 |
+
with self.assertRaisesRegex(rt.ActionRejected,'PROJECTION_NOT_ACCEPTED'):rt.source_model(r,False)
|
| 150 |
+
self.assertGreater(rt.source_model(r,True)['projection']['plastic_projection_nodes'],0)
|
| 151 |
+
def test_37_no_agent_hidden_elastic_or_deformation_result_fields(self):
|
| 152 |
+
h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s')['operation_id'];step(h,8.);r=s.poll(op);json.dumps(r,allow_nan=False)
|
| 153 |
+
def visit(v):
|
| 154 |
+
if isinstance(v,dict):
|
| 155 |
+
for k,x in v.items():self.assertFalse(k.startswith('truth.') or k in ['plastic_depth_m','elastic_depth_m','deformed_volume_m3','sample_present_kg']);visit(x)
|
| 156 |
+
elif isinstance(v,list):
|
| 157 |
+
for x in v:visit(x)
|
| 158 |
+
visit(r);visit(s.read(instance_id=h.instance_id))
|
| 159 |
+
def test_38_laser_power_interlock_and_protocol_errors(self):
|
| 160 |
+
h=setup();call(h,'laser.set',enabled=True);park(h);call(h,'power.set',enabled=False);self.assertFalse(h.laser);self.rejected(h,'laser.set','NOT_READY',enabled=True);s=h.session();self.assertEqual(s.describe(asset_type_id=rt.ASSET_TYPE_ID)['asset_type_id'],rt.ASSET_TYPE_ID)
|
| 161 |
+
for fn in [lambda:s.describe(),lambda:h.session('unknown'),lambda:h.register_principal('agent'),lambda:s.read(instance_id='unknown')]:
|
| 162 |
+
with self.assertRaises(rt.ActionRejected):fn()
|
| 163 |
+
for cap,args in [('unknown',{}),('power.set',{'enabled':3}),('dynamic.acquire',{})]:json.dumps(s.invoke(instance_id=h.instance_id,capability_id=cap,arguments=args,request_id=cap),allow_nan=False)
|
| 164 |
+
def test_39_analysis_incomplete_cancel_and_history_owner(self):
|
| 165 |
+
h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s')['operation_id'];step(h,1.);s.cancel(op,'cancel');result=s.poll(op);self.assertEqual(result['result']['completed_indents'],0);self.assertIsNone(result['result']['points'][0]['analysis']);self.assertEqual(result['result']['points'][0]['analysis_error'],'INCOMPLETE_UNLOADING');cleanup(h);self.assertEqual(s.poll(op),result);self.ledger(h)
|
| 166 |
+
def test_40_zero_thermal_margin_rejects_sub_ulp_heat(self):
|
| 167 |
+
h=setup(plant={'temperature_max_k':296.15});r=run(h);self.assertEqual(r['error_code'],'THERMAL_MODEL_RANGE');self.assertEqual(h.thermal_excess_j,0.);self.assertEqual(h.plastic_work,0.);self.assertEqual(r['completed_indents'],0);self.ledger(h)
|
| 168 |
+
def test_zz_real_inputs_outputs_states_metadata_and_effects(self):
|
| 169 |
+
spec=importlib.util.spec_from_file_location('hit_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(tool);meta=rt.export_antonpaar_hit300_contract_metadata();json.dumps(meta,allow_nan=False)
|
| 170 |
+
for k,c in meta['capabilities'].items():self.assertEqual(tool.lint_schema(c['input_schema'],path=k+'.input'),[]);self.assertEqual(tool.lint_schema(c['output_schema'],path=k+'.output'),[])
|
| 171 |
+
covered=set()
|
| 172 |
+
for k,a,r in OBSERVED:
|
| 173 |
+
self.assertEqual(tool.validate_value(a,meta['capabilities'][k]['input_schema'],path=k+'.input'),[]);self.assertEqual(tool.validate_value(r,meta['capabilities'][k]['output_schema'],path=k+'.output'),[]);covered.add(k)
|
| 174 |
+
self.assertEqual(covered,set(rt.CAPS)-set(rt.UNSUPPORTED))
|
| 175 |
+
for values in STATES:
|
| 176 |
+
self.assertEqual(set(values),set(rt.SLOTS));json.dumps(values,allow_nan=False)
|
| 177 |
+
for k,v in values.items():self.assertEqual(tool.validate_value(v,meta['state_slots'][k]['value_schema'],path=k),[])
|
| 178 |
+
for k,c in meta['capabilities'].items():self.assertTrue(set(rt.CAPS[k]['effects'])<={e['state_id'] for e in c['state_effects']})
|
| 179 |
+
if __name__=='__main__':unittest.main()
|
tests/test_asset_antonpaar_mcr503.py
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM137 tests: real templates, independent mechanics, ledgers and public protocol."""
|
| 2 |
+
import copy,importlib.util,json,math,unittest
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
import numpy as np
|
| 5 |
+
from scipy.integrate import quad
|
| 6 |
+
from scripts.asset_runtime import antonpaar_mcr503 as r
|
| 7 |
+
ROOT=Path(__file__).resolve().parents[1];spec=importlib.util.spec_from_file_location('mcr_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');asset_tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(asset_tool)
|
| 8 |
+
OBSERVED=[]
|
| 9 |
+
class Checked(r.AntonpaarMcr503Runtime):
|
| 10 |
+
def invoke(self,k,**a):
|
| 11 |
+
before=self.read();out=super().invoke(k,**a);after=self.read();changed={x for x in after if after[x]!=before[x]}
|
| 12 |
+
assert not changed-set(r.CAPS[k]['effects']),(k,changed-set(r.CAPS[k]['effects']))
|
| 13 |
+
assert not asset_tool.validate_value(out,r.CAPS[k]['output_schema']),(k,asset_tool.validate_value(out,r.CAPS[k]['output_schema']))
|
| 14 |
+
OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(out)));return out
|
| 15 |
+
|
| 16 |
+
def make(plant=None,sample=None,method=None,geometry=None):
|
| 17 |
+
h=Checked();h.invoke('plant.configure',**dict(r.PLANT_EXAMPLE,**(plant or {})));h.invoke('geometry.configure',**dict(r.GEOMETRY_EXAMPLE,**(geometry or {})));h.invoke('sample.load',**dict(r.SAMPLE_EXAMPLE,**(sample or {})));h.invoke('power.set',enabled=True);h.invoke('geometry.set_gap',gap_m=.001);h.step(4.);h.invoke('thermal.set_temperature',temperature_k=298.15);h.invoke('method.configure',**dict(r.METHOD_EXAMPLE,**(method or {})));return h
|
| 18 |
+
|
| 19 |
+
def finish(h):h.invoke('acquisition.start');h.step(h.method['duration_s']);return h.invoke('acquisition.result')
|
| 20 |
+
def remove(h):
|
| 21 |
+
if h.phase=='running':h.invoke('acquisition.stop')
|
| 22 |
+
h.invoke('geometry.set_gap',gap_m=.08);h.step(4.);h.invoke('sample.remove')
|
| 23 |
+
def sessions(h):
|
| 24 |
+
for name,role in [('student','agent'),('teacher','evaluator'),('other','agent')]:h.register_principal(name,role)
|
| 25 |
+
return h.session('student'),h.session('teacher'),h.session('other')
|
| 26 |
+
def call(s,c,a=None,rid='r1'):return s.invoke(instance_id=s._host.instance_id,capability_id=c,arguments=a or {},request_id=rid)
|
| 27 |
+
|
| 28 |
+
class McrTests(unittest.TestCase):
|
| 29 |
+
def budget(self,h):
|
| 30 |
+
d=h.invoke('ledger.read')
|
| 31 |
+
for key,value in d.items():
|
| 32 |
+
if 'error' in key:self.assertLess(abs(value),1e-8,(key,value))
|
| 33 |
+
def test_01_targets_do_not_teleport(self):
|
| 34 |
+
h=make();temp=h.temperature;h.invoke('thermal.set_temperature',temperature_k=310.);self.assertEqual(h.temperature,temp);h.invoke('geometry.set_gap',gap_m=.08);self.assertEqual(h.gap,.001);h.step(.1);self.assertAlmostEqual(h.gap,.003);self.assertGreater(h.temperature,temp)
|
| 35 |
+
def test_02_read_describe_and_zero_are_pure(self):
|
| 36 |
+
h=make();a,e,_=sessions(h);before=copy.deepcopy(h.__dict__)
|
| 37 |
+
for _ in range(2):a.read(instance_id=h.instance_id);a.describe(instance_id=h.instance_id);e.describe(asset_type_id=r.ASSET_TYPE_ID);h.step(0.)
|
| 38 |
+
self.assertEqual(h.__dict__,before)
|
| 39 |
+
def test_03_real_water_viscosity(self):
|
| 40 |
+
h=make();o=finish(h);self.assertEqual(o['phase'],'succeeded');self.assertEqual(len(o['rows']),201);self.assertLess(abs(o['mean_apparent_viscosity_pa_s']/r.library()['water']['viscosity_Pa_s']-1),.0002);self.assertIsNone(o['oscillation_fit']);self.assertEqual(h.angle,16.);self.budget(h)
|
| 41 |
+
def test_04_sixtynine_real_references(self):
|
| 42 |
+
lib=r.library();self.assertGreaterEqual(len(lib),50)
|
| 43 |
+
for row in lib.values():self.assertGreater(row['viscosity_Pa_s'],0);self.assertTrue(row['source']);self.assertTrue(row['evidence']);self.assertIsNone(row['storage_modulus_Pa'])
|
| 44 |
+
a=make();b=make(sample={'reference_id':'glycerol'});oa=finish(a);ob=finish(b);self.assertGreater(ob['mean_apparent_viscosity_pa_s']/oa['mean_apparent_viscosity_pa_s'],1000)
|
| 45 |
+
def test_05_newtonian_torque_radial_integral(self):
|
| 46 |
+
eta=.954;rate=100.;R=.0125
|
| 47 |
+
exact=quad(lambda radius:2*math.pi*eta*rate*radius/R*radius**2,0,R,epsabs=1e-15)[0]
|
| 48 |
+
self.assertAlmostEqual(exact,r.pp_torque(rate,R,eta),14)
|
| 49 |
+
def test_06_hb_radial_integral(self):
|
| 50 |
+
radius=.0125;rate=100.;K=.4;n=.7;yield_stress=2.
|
| 51 |
+
numerical=quad(lambda x:2*math.pi*(yield_stress+K*(rate*x/radius)**n)*x*x,0,radius,epsabs=1e-14)[0]
|
| 52 |
+
self.assertAlmostEqual(numerical,float(r.hb_torque(rate,radius,yield_stress,K,n)),13)
|
| 53 |
+
def test_07_external_hb_inverse(self):
|
| 54 |
+
h=Checked();out=h.invoke('analysis.flow_curve',**r.FLOW_EXAMPLE);self.assertAlmostEqual(out['yield_stress_pa'],.2,7);self.assertAlmostEqual(out['consistency_pa_sn'],.3,7);self.assertAlmostEqual(out['flow_index'],.7,7);self.assertIsNone(h.sample)
|
| 55 |
+
def test_08_hb_forward_apparent_viscosity(self):
|
| 56 |
+
h=make(sample={'reference_id':'glycerol','constitutive_model':'herschel_bulkley','yield_stress_pa':.2,'flow_index':.7});o=finish(h);expected=float(r.hb_torque(100,.0125,.2,.954,.7))*2/(math.pi*.0125**3*100)
|
| 57 |
+
self.assertAlmostEqual(o['mean_apparent_viscosity_pa_s'],expected,6);self.assertNotAlmostEqual(expected,.954,2);self.budget(h)
|
| 58 |
+
def test_09_external_oscillation_inverse(self):
|
| 59 |
+
h=Checked();out=h.invoke('analysis.oscillation',**r.OSC_EXAMPLE);self.assertAlmostEqual(out['storage_modulus_pa'],2.,12);self.assertAlmostEqual(out['loss_modulus_pa'],3.,12);self.assertIsNone(h.sample)
|
| 60 |
+
def test_10_newtonian_oscillation(self):
|
| 61 |
+
h=make(sample={'reference_id':'glycerol'},method={'mode':'oscillation'});o=finish(h);self.assertEqual(o['phase'],'succeeded');self.assertLess(abs(o['oscillation_fit']['storage_modulus_pa']),1e-5);self.assertAlmostEqual(o['oscillation_fit']['loss_modulus_pa'],.954*2*math.pi*5,5);self.budget(h)
|
| 62 |
+
def test_11_maxwell_gprime_gdoubleprime(self):
|
| 63 |
+
h=make(sample={'reference_id':'glycerol','constitutive_model':'maxwell'},method={'mode':'oscillation'});o=finish(h);u=2*math.pi*5*.05;G=.954/.05
|
| 64 |
+
self.assertAlmostEqual(o['oscillation_fit']['storage_modulus_pa'],G*u*u/(1+u*u),4);self.assertAlmostEqual(o['oscillation_fit']['loss_modulus_pa'],G*u/(1+u*u),4);self.budget(h)
|
| 65 |
+
def test_12_maxwell_startup_time_response(self):
|
| 66 |
+
h=make(sample={'reference_id':'glycerol','constitutive_model':'maxwell'});h.invoke('acquisition.start');self.assertEqual(h.stress,0);h.step(.05);self.assertAlmostEqual(h.stress,.954*100*(1-math.exp(-1)),12);self.assertAlmostEqual(h.angle,.4,12);self.budget(h)
|
| 67 |
+
def test_13_maxwell_work_independent_quadrature(self):
|
| 68 |
+
h=make(sample={'reference_id':'glycerol','constitutive_model':'maxwell'},method={'mode':'oscillation'});h.invoke('acquisition.start');duration=.173
|
| 69 |
+
numerical=quad(lambda t:h._mechanical(t)['torque']*h._mechanical(t)['speed'],0,duration,epsabs=1e-16)[0];h.step(duration);self.assertAlmostEqual(h.mechanical_work,numerical,15);self.assertGreaterEqual(h.viscous_heat,0);self.budget(h)
|
| 70 |
+
def test_14_cancel_preserves_and_relaxes_energy(self):
|
| 71 |
+
h=make(sample={'reference_id':'glycerol','constitutive_model':'maxwell'});h.invoke('acquisition.start');h.step(.05);h.invoke('acquisition.stop');elastic=h.elastic;stress=h.stress;heat=h.viscous_heat;work=h.mechanical_work;rows=copy.deepcopy(h.rows);angle=h.angle;h.step(.05)
|
| 72 |
+
self.assertAlmostEqual(h.stress,stress/math.e,12);self.assertAlmostEqual(h.elastic,elastic/math.e**2,15);self.assertAlmostEqual(h.viscous_heat-heat,elastic-h.elastic,15);self.assertEqual(h.mechanical_work,work);self.assertEqual(h.angle,angle);self.assertEqual(h.rows,rows);self.budget(h)
|
| 73 |
+
def test_15_thermal_control_heat_balance(self):
|
| 74 |
+
h=make();h.invoke('thermal.set_temperature',temperature_k=308.15);h.step(120);self.assertAlmostEqual(h.temperature,308.15,3);self.assertGreater(h.controller_input,1000);self.budget(h)
|
| 75 |
+
h.invoke('thermal.set_temperature',temperature_k=288.15);h.step(180);self.assertAlmostEqual(h.temperature,288.15,3);self.budget(h);h.invoke('thermal.disable');T=h.temperature;h.step(5);self.assertGreater(h.temperature,T);self.budget(h)
|
| 76 |
+
def test_16_thermal_saturation_partition(self):
|
| 77 |
+
a=make(plant={'heater_max_w':2.,'cooler_max_w':1.});b=make(plant={'heater_max_w':2.,'cooler_max_w':1.})
|
| 78 |
+
for h in (a,b):h.invoke('thermal.set_temperature',temperature_k=300.15)
|
| 79 |
+
a.step(600)
|
| 80 |
+
for _ in range(120):b.step(5)
|
| 81 |
+
self.assertAlmostEqual(a.temperature,b.temperature,10);self.assertAlmostEqual(a.controller_input,b.controller_input,8);self.budget(a);self.budget(b)
|
| 82 |
+
def test_17_material_volume_and_remove_energy(self):
|
| 83 |
+
h=make();mass=h._mass();volume=h.sample['volume_m3'];h.invoke('thermal.set_temperature',temperature_k=303.15);h.step(100);h.invoke('geometry.set_gap',gap_m=.08);h.step(4)
|
| 84 |
+
self.assertEqual(h._mass(),mass);self.assertEqual(h.sample['volume_m3'],volume);h.invoke('sample.remove');d=h.invoke('ledger.read');self.assertEqual(d['mass_removed_kg'],mass);self.assertEqual(d['volume_removed_m3'],volume);self.assertGreater(d['sample_removed_heat_j'],0);self.assertEqual(d['mass_present_kg'],0);self.budget(h)
|
| 85 |
+
def test_18_squeeze_and_fill_guards_atomic(self):
|
| 86 |
+
h=make();before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'SQUEEZE_FLOW_UNSUPPORTED',h.invoke,'geometry.set_gap',gap_m=.0005);self.assertEqual(h.__dict__,before)
|
| 87 |
+
h.invoke('geometry.set_gap',gap_m=.002);h.step(1);before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'GAP_FILL_MISMATCH',h.invoke,'acquisition.start');self.assertEqual(h.__dict__,before)
|
| 88 |
+
def test_19_below_torque_range_null(self):
|
| 89 |
+
h=make(method={'shear_rate_s_inv':1e-6});o=finish(h);self.assertEqual(o['phase'],'failed');self.assertEqual(o['error_code'],'TORQUE_BELOW_RANGE');self.assertIsNone(o['mean_apparent_viscosity_pa_s']);self.assertTrue(all(row['torque_nm'] is None for row in o['rows']))
|
| 90 |
+
def test_20_overload_and_angular_speed(self):
|
| 91 |
+
h=make(sample={'reference_id':'glycerol','volume_m3':math.pi*.05**2*.001},geometry={'radius_m':.05},method={'shear_rate_s_inv':3000});before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'TORQUE_OVERLOAD',h.invoke,'acquisition.start');self.assertEqual(h.__dict__,before)
|
| 92 |
+
h=make(method={'shear_rate_s_inv':4000});before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'ANGULAR_SPEED_RANGE',h.invoke,'acquisition.start');self.assertEqual(h.__dict__,before)
|
| 93 |
+
def test_21_250hz_internal_grid(self):
|
| 94 |
+
h=make(sample={'reference_id':'glycerol'},method={'mode':'oscillation','frequency_hz':250.,'duration_s':.04,'sample_interval_s':.0002,'discard_time_s':.02});o=finish(h);self.assertEqual(o['phase'],'succeeded');self.assertEqual(len(o['rows']),201);self.assertAlmostEqual(o['oscillation_fit']['loss_modulus_pa'],.954*2*math.pi*250,3)
|
| 95 |
+
def test_22_sampling_and_frequency_rejection(self):
|
| 96 |
+
h=make();before=copy.deepcopy(h.__dict__)
|
| 97 |
+
for patch in [{'frequency_hz':251.},{'mode':'oscillation','frequency_hz':250.},{'sample_interval_s':.03},{'discard_time_s':2.}]:self.assertRaises(r.ActionRejected,h.invoke,'method.configure',**dict(r.METHOD_EXAMPLE,**patch));self.assertEqual(h.__dict__,before)
|
| 98 |
+
def test_23_no_temperature_extrapolation(self):
|
| 99 |
+
h=make(sample={'reference_id':'benzoic_acid'});before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'REFERENCE_TEMPERATURE_RANGE',h.invoke,'acquisition.start');self.assertEqual(h.__dict__,before)
|
| 100 |
+
def test_24_reference_drift_stops_at_sample(self):
|
| 101 |
+
h=make(plant={'ambient_k':303.15},method={'duration_s':10.,'sample_interval_s':.05});h.step(150);self.assertLess(abs(h.temperature-298.15),.001);h.invoke('thermal.disable');h.invoke('acquisition.start');h.step(10.)
|
| 102 |
+
self.assertEqual(h.phase,'failed');self.assertEqual(h.error,'REFERENCE_TEMPERATURE_RANGE');self.assertLess(h.elapsed,10.);self.assertLess(len(h.rows),201);self.assertEqual(h.speed,0);self.budget(h)
|
| 103 |
+
def test_25_independent_calibration(self):
|
| 104 |
+
h=make(plant={'torque_gain':2.,'torque_offset_nm':1e-7});h.invoke('sensor.calibrate',torque_gain_correction=.5,torque_zero_nm=1e-7);o=finish(h);self.assertLess(abs(o['mean_apparent_viscosity_pa_s']/.0008949-1),.0002)
|
| 105 |
+
def test_26_invalid_inputs_atomic(self):
|
| 106 |
+
h=make();before=copy.deepcopy(h.__dict__)
|
| 107 |
+
for patch in [{'strain_amplitude':True},{'shear_rate_s_inv':float('nan')},{'bad':1}]:self.assertRaises(r.ActionRejected,h.invoke,'method.configure',**dict(r.METHOD_EXAMPLE,**patch));self.assertEqual(h.__dict__,before)
|
| 108 |
+
for dt in [-1,float('inf'),float('nan'),True]:self.assertRaises(r.ActionRejected,h.step,dt);self.assertEqual(h.__dict__,before)
|
| 109 |
+
def test_27_busy_preconditions_atomic(self):
|
| 110 |
+
h=make();h.invoke('acquisition.start');h.step(.1);before=copy.deepcopy(h.__dict__)
|
| 111 |
+
for cap,args in [('sample.remove',{}),('geometry.set_gap',{'gap_m':.08}),('thermal.set_temperature',{'temperature_k':300.}),('method.configure',r.METHOD_EXAMPLE)]:self.assertRaisesRegex(r.ActionRejected,'BUSY',h.invoke,cap,**args);self.assertEqual(h.__dict__,before)
|
| 112 |
+
def test_28_double_instance_isolation(self):
|
| 113 |
+
a=make();b=make();before=copy.deepcopy(b.__dict__);finish(a);self.assertEqual(b.__dict__,before)
|
| 114 |
+
def test_29_float_clock_partition_rows(self):
|
| 115 |
+
a=make();b=make();a.invoke('acquisition.start');b.invoke('acquisition.start');a.step(2.)
|
| 116 |
+
for _ in range(120):b.step(1/60)
|
| 117 |
+
self.assertEqual(a.time_ns,b.time_ns);self.assertEqual(a.rows,b.rows);self.assertEqual(a.angle,b.angle);self.assertAlmostEqual(a.mechanical_work,b.mechanical_work,14);self.budget(b)
|
| 118 |
+
c=Checked()
|
| 119 |
+
for _ in range(3600):c.step(1/60)
|
| 120 |
+
self.assertEqual(c.time_ns,60000000000)
|
| 121 |
+
def test_30_identity_permissions(self):
|
| 122 |
+
h=make();a,e,o=sessions(h);self.assertNotIn('sample.load',a.describe(instance_id=h.instance_id)['capabilities']);self.assertNotIn('truth.viscosity_pa_s',a.read(instance_id=h.instance_id)['observations']);self.assertIn('truth.viscosity_pa_s',e.read(instance_id=h.instance_id)['observations']);self.assertRaises(r.ActionRejected,a.read,instance_id=h.instance_id,state_ids=['truth.viscosity_pa_s']);self.assertEqual(call(a,'sim.step',{'dt_s':1.})['error']['code'],'ACCESS_DENIED');self.assertRaises(TypeError,a.read,instance_id=h.instance_id,role='evaluator')
|
| 123 |
+
def test_31_idempotency_owner_cancel(self):
|
| 124 |
+
h=make();a,e,o=sessions(h);start=call(a,'acquisition.start');revision=h.revision;self.assertEqual(call(a,'acquisition.start'),start);self.assertEqual(h.revision,revision);self.assertEqual(call(a,'power.set',{'enabled':False})['error']['code'],'REQUEST_CONFLICT');op=start['operation_id'];h.step(.5);self.assertRaises(r.ActionRejected,o.poll,op);self.assertEqual(call(o,'acquisition.result')['error']['code'],'ACCESS_DENIED');cancel=a.cancel(op,'cancel');self.assertEqual(a.cancel(op,'cancel'),cancel);self.assertEqual(a.poll(op)['status'],'cancelled')
|
| 125 |
+
def test_32_privileged_public_provenance_is_safe(self):
|
| 126 |
+
h=make();a,e,_=sessions(h);op=call(e,'acquisition.start')['operation_id'];h.step(2.)
|
| 127 |
+
for data in [call(e,'acquisition.result',rid='result'),e.poll(op)]:text=json.dumps(data);self.assertNotIn('Viscosity',text);self.assertNotIn('PubChem',text);self.assertNotIn('locator',text);self.assertIn('rheology_library.json',text)
|
| 128 |
+
raw=call(e,'provenance.read',rid='provenance');self.assertEqual(raw['result']['reference_id'],'water');self.assertTrue(raw['result']['template_source']);self.assertEqual(call(a,'provenance.read')['error']['code'],'ACCESS_DENIED')
|
| 129 |
+
def test_33_poweroff_and_archive_residue(self):
|
| 130 |
+
h=make(sample={'reference_id':'glycerol','constitutive_model':'maxwell'});a,e,_=sessions(h);op=call(a,'acquisition.start')['operation_id'];h.step(.1);h.invoke('power.set',enabled=False);self.assertEqual(h.phase,'cancelled');self.assertGreater(h.elastic,0);old=a.poll(op);h.step(1.);self.assertEqual(a.poll(op),old);self.assertFalse(h.thermal_enabled);self.budget(h)
|
| 131 |
+
def test_34_restart_residual_maxwell(self):
|
| 132 |
+
h=make(sample={'reference_id':'glycerol','constitutive_model':'maxwell'});h.invoke('acquisition.start');h.step(.02);h.invoke('acquisition.stop');initial=h.stress;h.invoke('acquisition.start');h.step(.01);expected=.954*100+(initial-.954*100)*math.exp(-.01/.05);self.assertAlmostEqual(h.stress,expected,11);self.budget(h)
|
| 133 |
+
def test_35_model_acceptance_and_unsupported(self):
|
| 134 |
+
h=Checked();h.invoke('plant.configure',**r.PLANT_EXAMPLE);h.invoke('geometry.configure',**r.GEOMETRY_EXAMPLE);before=copy.deepcopy(h.__dict__);self.assertRaisesRegex(r.ActionRejected,'ASSUMPTION_NOT_ACCEPTED',h.invoke,'sample.load',**dict(r.SAMPLE_EXAMPLE,accept_engineering_rheology=False));self.assertEqual(h.__dict__,before)
|
| 135 |
+
h=make();a,_,_=sessions(h)
|
| 136 |
+
for index,key in enumerate(r.UNSUPPORTED):self.assertEqual(call(a,key,rid='u'+str(index))['status'],'unsupported')
|
| 137 |
+
h=make(sample={'constitutive_model':'herschel_bulkley'},method={'mode':'oscillation'});self.assertRaisesRegex(r.ActionRejected,'HB_OSCILLATION_UNSUPPORTED',h.invoke,'acquisition.start')
|
| 138 |
+
def test_36_all_metadata_and_real_output_schemas(self):
|
| 139 |
+
meta=r.export_antonpaar_mcr503_contract_metadata();self.assertEqual(set(meta['state_slots']),set(r.SLOTS))
|
| 140 |
+
for key,cap in meta['capabilities'].items():self.assertEqual(asset_tool.lint_schema(cap['input_schema']),[],key);self.assertEqual(asset_tool.lint_schema(cap['output_schema']),[],key);self.assertEqual(asset_tool.validate_value(cap['example_arguments'],cap['input_schema']),[],key)
|
| 141 |
+
self.assertNotIn('含一阶响应',meta['state_slots']['thermal.indicated_k']['meaning_zh']);self.assertNotIn('含一阶响应',meta['state_slots']['torque.indicated_nm']['meaning_zh']);self.assertNotIn('样品瓶',meta['state_slots']['truth.temperature_k']['meaning_zh']);self.assertIn('thermal.set_temperature',meta['state_slots']['thermal.target_k']['meaning_zh'])
|
| 142 |
+
h=make();h.invoke('sim.step',dt_s=.01);h.invoke('provenance.read')
|
| 143 |
+
for key,args,result in OBSERVED:self.assertEqual(asset_tool.validate_value(result,meta['capabilities'][key]['output_schema']),[],key)
|
| 144 |
+
for key,value in h.read().items():self.assertEqual(asset_tool.validate_value(value,meta['state_slots'][key]['value_schema']),[],key)
|
| 145 |
+
|
| 146 |
+
def test_37_real_host_session_all_implemented_entries(self):
|
| 147 |
+
h=Checked();h.register_principal('host','evaluator');session=h.session('host')
|
| 148 |
+
actions=[('plant.configure',r.PLANT_EXAMPLE),('geometry.configure',r.GEOMETRY_EXAMPLE),('sample.load',r.SAMPLE_EXAMPLE),('power.set',{'enabled':True}),('geometry.set_gap',{'gap_m':.001}),('sim.step',{'dt_s':4.}),('thermal.set_temperature',{'temperature_k':298.15}),('method.configure',r.METHOD_EXAMPLE),('sensor.calibrate',r.CALIBRATION_EXAMPLE),('acquisition.start',{}),('sim.step',{'dt_s':.5}),('acquisition.result',{}),('provenance.read',{}),('acquisition.stop',{}),('ledger.read',{}),('analysis.flow_curve',r.FLOW_EXAMPLE),('analysis.oscillation',r.OSC_EXAMPLE),('thermal.disable',{}),('geometry.set_gap',{'gap_m':.08}),('sim.step',{'dt_s':4.}),('sample.remove',{}),('power.set',{'enabled':False})]
|
| 149 |
+
for index,(cap,args) in enumerate(actions):
|
| 150 |
+
response=call(session,cap,args,str(index));self.assertIn(response['status'],['succeeded','accepted'],(cap,response));self.assertEqual(asset_tool.validate_value(response['result'],r.CAPS[cap]['output_schema']),[],cap)
|
| 151 |
+
self.assertEqual(set(k for k,_ in actions),set(r.CAPS)-set(r.UNSUPPORTED));self.budget(h)
|
| 152 |
+
|
| 153 |
+
def test_38_multiturn_pose_representation(self):
|
| 154 |
+
h=make();finish(h);first=h.read();self.assertAlmostEqual(first['rotor.angle_rad'],16.,12)
|
| 155 |
+
self.assertAlmostEqual(first['rotor.orientation_rad'],math.atan2(math.sin(16.),math.cos(16.)),12);self.assertGreater(first['rotor.angle_rad'],4*math.pi)
|
| 156 |
+
finish(h);second=h.read();self.assertAlmostEqual(second['rotor.angle_rad'],32.,12)
|
| 157 |
+
self.assertAlmostEqual(math.sin(second['rotor.orientation_rad']),math.sin(second['rotor.angle_rad']),12);self.assertAlmostEqual(math.cos(second['rotor.orientation_rad']),math.cos(second['rotor.angle_rad']),12)
|
| 158 |
+
self.assertGreaterEqual(second['rotor.orientation_rad'],-math.pi);self.assertLessEqual(second['rotor.orientation_rad'],math.pi)
|
| 159 |
+
self.assertEqual(second['rotor.speed_rad_s'],0.);self.budget(h)
|
| 160 |
+
|
| 161 |
+
if __name__=='__main__':unittest.main()
|
tests/test_asset_antonpaar_rst300.py
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM129 finite scratch, observed pre/post profiles and protocol regressions."""
|
| 2 |
+
import copy,hashlib,importlib.util,json,math,sys,unittest
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
import numpy as np
|
| 5 |
+
ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts'))
|
| 6 |
+
from asset_runtime import antonpaar_rst300 as rt
|
| 7 |
+
OBSERVED=[];STATES=[]
|
| 8 |
+
def canonical(v):
|
| 9 |
+
if isinstance(v,dict):return {str(k):canonical(x) for k,x in v.items()}
|
| 10 |
+
if isinstance(v,(list,tuple)):return [canonical(x) for x in v]
|
| 11 |
+
if isinstance(v,np.ndarray):return v.tolist()
|
| 12 |
+
return v
|
| 13 |
+
def state(h):return json.dumps(canonical(h.__dict__),sort_keys=True,allow_nan=False)
|
| 14 |
+
def call(h,k,**a):
|
| 15 |
+
before=h.read();r=h.invoke(k,**a);after=h.read();json.dumps(r,allow_nan=False);json.dumps(after,allow_nan=False);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));STATES.append(after)
|
| 16 |
+
changed={x for x in before if before[x]!=after[x]}
|
| 17 |
+
if not changed<=set(rt.CAPS[k]['effects']):raise AssertionError((k,'undeclared state effects',changed-set(rt.CAPS[k]['effects'])))
|
| 18 |
+
return r
|
| 19 |
+
def step(h,t):h.step(t);STATES.append(h.read());json.dumps(h.read(),allow_nan=False)
|
| 20 |
+
def setup(name='rst_test',plant=None,sample=None,stylus=None,method=None):
|
| 21 |
+
h=rt.AntonpaarRst300Runtime(name)
|
| 22 |
+
for k,a in [('plant.configure',dict(rt.PLANT_EXAMPLE,**(plant or {}))),('specimen.load',dict(rt.SAMPLE_EXAMPLE,**(sample or {}))),('stylus.load',dict(rt.STYLUS_EXAMPLE,**(stylus or {})))]:call(h,k,**a)
|
| 23 |
+
call(h,'power.set',enabled=True);call(h,'clamp.set',locked=True);call(h,'sensor.zero');call(h,'head.set_position',distance_m=0.);step(h,4.);call(h,'contact.set',engaged=True);call(h,'method.configure',**dict(dict(rt.METHOD_EXAMPLE,length_m=.0002),**(method or {})));return h
|
| 24 |
+
def run(h,kind=None):
|
| 25 |
+
if kind is not None:call(h,'method.configure',**dict(h.method,pass_kind=kind))
|
| 26 |
+
call(h,'acquisition.start')
|
| 27 |
+
for _ in range(4000):
|
| 28 |
+
step(h,.1)
|
| 29 |
+
if h.phase!='running':break
|
| 30 |
+
if h.phase=='running':raise AssertionError('operation never terminated')
|
| 31 |
+
return call(h,'acquisition.result')
|
| 32 |
+
def park(h,x=0.,y=0.):
|
| 33 |
+
if h.phase=='running':call(h,'acquisition.stop')
|
| 34 |
+
step(h,2.);call(h,'contact.set',engaged=False);call(h,'head.set_position',distance_m=.04);step(h,4.);call(h,'stage.move',x_m=x,y_m=y,speed_m_s=.01);step(h,10.)
|
| 35 |
+
def at_start(h):
|
| 36 |
+
park(h,h.method['start_x_m'],h.method['path_y_m']);call(h,'head.set_position',distance_m=0.);step(h,4.);call(h,'contact.set',engaged=True)
|
| 37 |
+
def prescanned(**kwargs):
|
| 38 |
+
h=setup(**kwargs);r=run(h,'prescan')
|
| 39 |
+
if r['phase']!='succeeded':raise AssertionError(r['error_code'])
|
| 40 |
+
at_start(h);call(h,'method.configure',**dict(h.method,pass_kind='scratch'));return h
|
| 41 |
+
def cleanup(h):
|
| 42 |
+
park(h);call(h,'clamp.set',locked=False)
|
| 43 |
+
for name in ['specimen','stylus']:
|
| 44 |
+
if getattr(h,name) is not None:call(h,name+'.remove')
|
| 45 |
+
call(h,'debris.collect');call(h,'power.set',enabled=False)
|
| 46 |
+
def rows(values,channel='friction_force_n',loads=None):
|
| 47 |
+
result=[]
|
| 48 |
+
for i,v in enumerate(values):
|
| 49 |
+
r=copy.deepcopy(rt._example_row);r.update(distance_m=i*.001,stage_x_m=i*.001,normal_force_n=(loads[i] if loads else 10.+i));r[channel]=v;result.append(r)
|
| 50 |
+
return result
|
| 51 |
+
class TestRST300(unittest.TestCase):
|
| 52 |
+
def rejected(self,h,k,error='.',**a):
|
| 53 |
+
before=state(h)
|
| 54 |
+
with self.assertRaisesRegex(rt.ActionRejected,error):h.invoke(k,**a)
|
| 55 |
+
self.assertEqual(before,state(h))
|
| 56 |
+
def ledger(self,h):
|
| 57 |
+
l=call(h,'ledger.read')
|
| 58 |
+
for n in ['coating','substrate','stylus']:self.assertLess(abs(l[n+'_error_kg']),1e-13)
|
| 59 |
+
self.assertLess(abs(l['thermal_error_j']),1e-8);self.assertLess(abs(l['normal_error_j']),1e-12);self.assertAlmostEqual(l['heat_input_j']+l['wear_work_j'],l['tangential_work_j'],places=12);return l
|
| 60 |
+
def test_01_raw_reference_command_load_negative_force_and_null_residual(self):
|
| 61 |
+
lib=rt.library();r=lib['substances']['borofloat33_10n_r1'];before=json.dumps(r,sort_keys=True);x,mu,count=rt.curve(r,True)
|
| 62 |
+
self.assertEqual(len(x),1763);self.assertGreater(count,0);self.assertLess(r['values']['tangential_force_n'][0],0);self.assertIsNone(r['values']['residual_depth_m']);self.assertTrue(all(v==0 for v in r['values']['raw_residual_depth_m']));self.assertAlmostEqual(r['values']['normal_force_n'][0],9.99999938964844);self.assertGreater(x[0],0);self.assertTrue(np.all(mu>=0));self.assertEqual(before,json.dumps(r,sort_keys=True));self.assertGreaterEqual(sum(bool(v.get('runtime_usable')) for v in lib['substances'].values()),16)
|
| 63 |
+
with self.assertRaisesRegex(rt.ActionRejected,'NEGATIVE_SOURCE_FORCE'):rt.curve(r)
|
| 64 |
+
def test_02_three_real_passes_residual_not_penetration(self):
|
| 65 |
+
h=prescanned(method={'length_m':.002});scratch=run(h);self.assertEqual(scratch['phase'],'succeeded');s=[r for r in scratch['rows'] if r['phase']=='scanning'];self.assertTrue(all(r['residual_depth_m'] is None for r in s));self.assertGreater(s[-1]['penetration_depth_m'],h.local_groove);at_start(h);post=run(h,'postscan');p=[r for r in post['rows'] if r['phase']=='scanning'];self.assertEqual(post['phase'],'succeeded');self.assertTrue(all(r['penetration_depth_m'] is None for r in p));self.assertGreater(p[-1]['residual_depth_m'],0);self.assertLess(abs(p[-1]['residual_depth_m']-h.local_groove),1e-9);self.ledger(h)
|
| 66 |
+
def test_03_force_ramp_endpoint_and_integral_moments(self):
|
| 67 |
+
from scipy.integrate import quad
|
| 68 |
+
for tau in [1e-5,.05,100.]:
|
| 69 |
+
for dt in [.000001,.01,.1,1.]:
|
| 70 |
+
f0,target,slope=3.,8.,2.;got=rt.force_ramp(f0,target,slope,tau,dt);f=lambda t:target+slope*(t-tau)+(f0-target+slope*tau)*math.exp(-t/tau);pts=sorted({v for v in [tau,5*tau,30*tau,60*tau] if v<dt});expected=[f(dt),quad(f,0,dt,points=pts,epsabs=1e-12)[0],quad(lambda t:t*f(t),0,dt,points=pts,epsabs=1e-12)[0]]
|
| 71 |
+
for a,b in zip(got,expected):self.assertAlmostEqual(a,b,delta=max(1e-10,abs(b)*1e-9))
|
| 72 |
+
def test_04_target_is_not_force_and_motion_requires_host_step(self):
|
| 73 |
+
h=setup();call(h,'method.configure',**dict(h.method,pass_kind='prescan'));call(h,'acquisition.start');self.assertEqual(h.force,0.);self.assertEqual(h.distance,0.);self.assertEqual(h.force_target,.1);t=h.time_s
|
| 74 |
+
for _ in range(5):call(h,'acquisition.result');h.read()
|
| 75 |
+
self.assertEqual(h.time_s,t);step(h,.1);self.assertGreater(h.force,0);self.assertLess(h.force,.1);self.assertEqual(h.distance,0.)
|
| 76 |
+
def test_05_friction_work_uses_source_axis_and_actual_force(self):
|
| 77 |
+
from scipy.integrate import quad
|
| 78 |
+
h=prescanned(method={'length_m':.0005,'initial_force_n':2.,'final_force_n':12.});w=h.tangential_work;r=run(h);s=[v for v in r['rows'] if v['phase']=='scanning'];start=s[0]['time_s'];finish=s[-1]['time_s'];duration=finish-start;v=h.method['speed_m_s'];load0=h.plant['force_response_tau_s'];f0=2.-2.*math.exp(-(start-h.operation_start)/load0);slope=10/duration;x0=h.method['source_start_distance_m'];knots=[(x-x0)/v for x in h.ref_x if x0<x<x0+h.method['length_m']]
|
| 79 |
+
f=lambda t:(2.+slope*(t-load0)+(f0-2.+slope*load0)*math.exp(-t/load0))*float(np.interp(x0+v*t,h.ref_x,h.ref_mu))*v
|
| 80 |
+
expected=quad(f,0,duration,points=knots,epsabs=1e-12,limit=2000)[0];self.assertAlmostEqual(h.tangential_work-w,expected,delta=2e-10);self.assertAlmostEqual(r['distance_m'],.0005);self.ledger(h)
|
| 81 |
+
def test_06_source_distance_and_condition_rejections_atomic(self):
|
| 82 |
+
h=prescanned();call(h,'method.configure',**dict(h.method,source_start_distance_m=0.));self.rejected(h,'acquisition.start','REFERENCE_DISTANCE_RANGE');call(h,'method.configure',**dict(h.method,source_start_distance_m=float(h.ref_x[-1])-.00001));self.rejected(h,'acquisition.start','REFERENCE_DISTANCE_RANGE')
|
| 83 |
+
h=prescanned(sample={'accept_condition_transfer':False},stylus={'cone_angle_rad':math.pi/2});self.rejected(h,'acquisition.start','REFERENCE_CONDITIONS')
|
| 84 |
+
h=prescanned(sample={'accept_unknown_conditions':False});self.rejected(h,'acquisition.start','UNKNOWN_REFERENCE_CONDITIONS')
|
| 85 |
+
def test_07_stage_head_access_and_software_microscope(self):
|
| 86 |
+
h=setup();self.rejected(h,'stage.move','HEAD_NOT_CLEAR',x_m=.01,y_m=0.,speed_m_s=.001);self.rejected(h,'specimen.remove','HEAD_NOT_CLEAR');self.rejected(h,'head.set_position','CONTACT_ENGAGED',distance_m=.04);park(h);call(h,'tool.select',mode='microscope');self.assertTrue(h.clamped);call(h,'stage.move',x_m=.01,y_m=-.027,speed_m_s=.01);self.assertEqual(h.stage_x,0.);step(h,3.);self.assertAlmostEqual(h.stage_y,-.027);call(h,'tool.select',mode='stylus');self.ledger(h)
|
| 87 |
+
def test_08_all_manufacturer_ranges_and_bad_inputs_are_atomic(self):
|
| 88 |
+
h=setup()
|
| 89 |
+
for field,value in [('initial_force_n',200.0001),('final_force_n',200.0001),('speed_m_s',rt.SPEED_MIN*.9),('speed_m_s',.01001),('length_m',.07001),('sample_interval_s',.15)]:self.rejected(h,'method.configure',**dict(h.method,**{field:value}))
|
| 90 |
+
self.rejected(h,'method.configure','STAGE_PATH_RANGE',**dict(h.method,start_x_m=.0699,length_m=.002));self.rejected(h,'method.configure','DECREASING_LOAD_UNSUPPORTED',**dict(h.method,initial_force_n=20.,final_force_n=10.))
|
| 91 |
+
for value in [True,float('nan'),float('inf'),-.1]:self.rejected(h,'sim.step',dt_s=value)
|
| 92 |
+
self.rejected(h,'power.set',enabled=1);self.rejected(h,'method.configure',**dict(h.method,extra=1));self.rejected(h,'head.set_position',distance_m=.04001)
|
| 93 |
+
def test_09_baseline_required_calibration_and_probe_load_match(self):
|
| 94 |
+
h=setup();self.rejected(h,'acquisition.start','PRESCAN_REQUIRED');h=prescanned();call(h,'sensor.calibrate',**dict(rt.CALIBRATION_EXAMPLE,depth_zero_m=1e-6));self.rejected(h,'acquisition.start','BASELINE_CALIBRATION_MISMATCH');call(h,'sensor.calibrate',**rt.CALIBRATION_EXAMPLE);call(h,'method.configure',**dict(h.method,scan_force_n=.2));self.rejected(h,'acquisition.start','BASELINE_LOAD_MISMATCH')
|
| 95 |
+
def test_10_damaged_track_reuse_rejected_new_y_allowed(self):
|
| 96 |
+
h=prescanned();run(h);at_start(h);self.rejected(h,'acquisition.start','TRACK_ALREADY_DAMAGED');call(h,'method.configure',**dict(h.method,pass_kind='prescan'));self.rejected(h,'acquisition.start','TRACK_ALREADY_DAMAGED');park(h,0.,.001);call(h,'method.configure',**dict(h.method,path_y_m=.001));call(h,'head.set_position',distance_m=0.);step(h,4.);call(h,'contact.set',engaged=True);self.assertEqual(run(h)['phase'],'succeeded');self.ledger(h)
|
| 97 |
+
def test_11_finite_coating_then_substrate_and_segment_volume(self):
|
| 98 |
+
h=prescanned(sample={'coating_thickness_m':1e-8});l0=h._ledger();r=run(h);self.assertEqual(r['phase'],'succeeded');l=self.ledger(h);self.assertGreater(l['coating_removed_m3'],0);self.assertGreater(l['substrate_removed_m3'],0);volume=sum((s['x1']-s['x0'])*s['depth_m']*h.specimen['track_width_m'] for s in h.active_track['segments']);self.assertAlmostEqual(volume,l['coating_removed_m3']+l['substrate_removed_m3'],places=23);self.assertAlmostEqual(l['coating_removed_m3']*1e9+l['substrate_removed_m3']*1e9+l['stylus_removed_m3']*1e10,l['wear_work_j']-l0['wear_work_j'],places=14)
|
| 99 |
+
def test_12_tiny_stylus_exhaustion_exact_partial_and_ledger(self):
|
| 100 |
+
h=prescanned(stylus={'volume_m3':1e-15,'removal_energy_j_m3':1e3,'wear_energy_fraction':.5});r=run(h);self.assertEqual(r['phase'],'failed');self.assertEqual(r['error_code'],'STYLUS_EXHAUSTED');self.assertGreater(r['distance_m'],0);self.assertLess(r['distance_m'],h.method['length_m']);self.assertGreaterEqual(h.volumes['stylus'],0);self.assertLess(h.volumes['stylus'],1e-23);self.assertEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s']);self.ledger(h)
|
| 101 |
+
def test_13_local_depth_force_and_temperature_finite_boundaries(self):
|
| 102 |
+
cases=[({'contact_stiffness_n_m':1e3},None,None,'DEPTH_RANGE'),({'thermal_capacity_j_k':.001,'heat_loss_w_k':0.,'temperature_max_k':296.16},None,None,'THERMAL_MODEL_RANGE'),({}, {'substrate_thickness_m':1e-9},None,'LOCAL_SPECIMEN_THICKNESS')]
|
| 103 |
+
for plant,sample,stylus,error in cases:
|
| 104 |
+
h=prescanned(plant=plant,sample=sample,stylus=stylus);r=run(h);self.assertEqual(r['error_code'],error);self.assertLessEqual(h._depth(),rt.DEPTH_MAX+1e-15);self.assertLessEqual(h.temperature,h.plant['temperature_max_k']+1e-12);self.ledger(h)
|
| 105 |
+
h=prescanned(method={'initial_force_n':1.,'final_force_n':150.});h.ref_mu=np.full_like(h.ref_mu,2.);r=run(h);self.assertEqual(r['error_code'],'FRICTION_FORCE_RANGE');self.assertLessEqual(h.force,100.+1e-10);self.ledger(h)
|
| 106 |
+
def test_14_energy_fractions_reject_without_loading(self):
|
| 107 |
+
h=setup(sample={'sample_wear_energy_fraction':.9},stylus={'wear_energy_fraction':.2});call(h,'method.configure',**dict(h.method,pass_kind='prescan'));self.rejected(h,'acquisition.start','ENERGY_FRACTIONS');self.assertEqual(h.force,0.)
|
| 108 |
+
def test_15_heat_adiabatic_cooling_stiff_stability_and_spring_return(self):
|
| 109 |
+
h=prescanned(plant={'heat_loss_w_k':0.,'thermal_capacity_j_k':.01});run(h);l=self.ledger(h);self.assertAlmostEqual(h.temperature,296.15+l['heat_input_j']/.01,places=8);self.assertEqual(h.force,0.);self.assertAlmostEqual(l['normal_loading_work_j'],l['normal_recovered_work_j'],places=13)
|
| 110 |
+
h=prescanned(plant={'thermal_capacity_j_k':.001,'heat_loss_w_k':1000.});run(h);self.assertGreaterEqual(h.temperature,296.15);self.assertLess(h.temperature,296.16);self.ledger(h)
|
| 111 |
+
def test_16_passive_cooling_and_hot_access(self):
|
| 112 |
+
h=prescanned(plant={'thermal_capacity_j_k':.01,'heat_loss_w_k':0.,'safe_access_temperature_k':296.150001});run(h);park(h);call(h,'clamp.set',locked=False);self.rejected(h,'specimen.remove','HOT_SPECIMEN');self.ledger(h)
|
| 113 |
+
h=prescanned(plant={'thermal_capacity_j_k':1.,'heat_loss_w_k':.1});run(h);start=h.temperature;step(h,3.);self.assertAlmostEqual(h.temperature,296.15+(start-296.15)*math.exp(-.3),places=9)
|
| 114 |
+
def test_17_nondestructive_prescan_postscan_do_not_replenish_damage(self):
|
| 115 |
+
h=setup();v=copy.deepcopy(h.volumes);run(h,'prescan');self.assertEqual(v,h.volumes);at_start(h);run(h,'scratch');v=copy.deepcopy(h.volumes);at_start(h);run(h,'postscan');self.assertEqual(v,h.volumes);self.ledger(h)
|
| 116 |
+
def test_18_sensor_bias_coefficient_and_external_calibration(self):
|
| 117 |
+
h=prescanned(plant={'force_gain':2.,'friction_gain':1.5});r=run(h);s=[v for v in r['rows'] if v['phase']=='scanning' and v['friction_coefficient'] is not None][-1];self.assertAlmostEqual(s['friction_coefficient'],abs(s['friction_force_n'])/s['normal_force_n']);self.assertAlmostEqual(s['normal_force_n'],20.,places=8);self.assertNotAlmostEqual(s['friction_coefficient'],float(np.interp(h.method['source_start_distance_m']+h.distance,h.ref_x,h.ref_mu)),places=4)
|
| 118 |
+
h=setup(plant={'force_offset_n':.2,'friction_offset_n':.3,'depth_offset_m':1e-6});park(h);call(h,'sensor.zero');self.assertAlmostEqual(h.calibration['normal_zero_n'],.2);self.assertAlmostEqual(h.calibration['friction_zero_n'],.3);call(h,'sensor.calibrate',**rt.CALIBRATION_EXAMPLE)
|
| 119 |
+
def test_19_sensor_overrange_unavailable_and_lowload_reason(self):
|
| 120 |
+
h=prescanned(plant={'force_gain':10.},method={'initial_force_n':30.,'final_force_n':30.});r=run(h);self.assertEqual(r['error_code'],'SENSOR_OVER_RANGE');self.assertIsNone(r['rows'][-1]['normal_force_n']);self.ledger(h)
|
| 121 |
+
h=setup(plant={'force_gain':.1},method={'pass_kind':'prescan','scan_force_n':.001});call(h,'acquisition.start');step(h,.2);self.assertEqual(h.read()['observation.unavailable_reason'],'LOW_LOAD');self.assertIsNone(h.read()['friction.coefficient'])
|
| 122 |
+
def test_20_tilted_same_coordinate_baseline_cancels_surface_profile(self):
|
| 123 |
+
a=prescanned();b=prescanned(sample={'surface_slope_x':.001});run(a);run(b);at_start(a);at_start(b);ra=run(a,'postscan');rb=run(b,'postscan');pa=[r for r in ra['rows'] if r['phase']=='scanning'];pb=[r for r in rb['rows'] if r['phase']=='scanning'];self.assertAlmostEqual(pa[-1]['residual_depth_m'],pb[-1]['residual_depth_m'],delta=1e-10);self.assertNotEqual(pa[-1]['raw_depth_m'],pb[-1]['raw_depth_m'])
|
| 124 |
+
def test_21_critical_bracket_persistence_missing_and_leftcensor(self):
|
| 125 |
+
a=rows([0.,1.,3.,4.]);r=rt.critical_load(a,'friction_force_n',2.,2);self.assertAlmostEqual(r['position_m'],.0015);self.assertAlmostEqual(r['critical_load_n'],11.5)
|
| 126 |
+
for values in [[0.,None,3.,4.],[0.,1.,3.,None],[3.,4.,5.]]:
|
| 127 |
+
r=rt.critical_load(rows(values),'friction_force_n',2.,2);self.assertIsNone(r['critical_load_n'])
|
| 128 |
+
self.assertEqual(rt.critical_load(rows([3.,4.]),'friction_force_n',2.,1)['reason'],'LEFT_CENSORED')
|
| 129 |
+
def test_22_postscan_lc_maps_scratch_load_never_probe_load(self):
|
| 130 |
+
post=rows([0.,1e-6,3e-6,4e-6],'residual_depth_m',loads=[.1]*4);scratch=rows([0.,1.,2.,3.],loads=[5.,15.,25.,35.]);r=rt.critical_load(post,'residual_depth_m',2e-6,2,scratch);self.assertAlmostEqual(r['critical_load_n'],20.);self.assertNotEqual(r['critical_load_n'],.1)
|
| 131 |
+
self.assertIsNone(rt.critical_load(post,'residual_depth_m',2e-6,2)['critical_load_n']);scratch[1]['normal_force_n']=None;self.assertIsNone(rt.critical_load(post,'residual_depth_m',2e-6,2,scratch)['critical_load_n'])
|
| 132 |
+
h=setup();args=dict(rt.CAPS['analysis.critical_load']['example_arguments'],rows=post,load_rows=rows([0.,1.,2.,3.],loads=[5.,15.,25.,35.]),channel='residual_depth_m',threshold_m=2e-6,persistence=2);self.assertAlmostEqual(call(h,'analysis.critical_load',**args)['critical_load_n'],20.)
|
| 133 |
+
def test_23_criterion_stop_preserves_partial_track_and_released_load(self):
|
| 134 |
+
h=prescanned(method={'length_m':.002,'criterion_threshold_n':.5,'criterion_persistence':1});call(h,'method.configure',**dict(h.method,stop_on_criterion=True));r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertGreater(r['distance_m'],0.);self.assertLess(r['distance_m'],.002);self.assertEqual(h.force,0.);self.assertEqual(h.active_track['distance'],r['distance_m']);self.ledger(h)
|
| 135 |
+
def test_24_cancel_keeps_damage_and_force_relaxes_only_by_step(self):
|
| 136 |
+
h=prescanned();call(h,'acquisition.start');step(h,.8);f=h.force;v=copy.deepcopy(h.volumes);call(h,'acquisition.stop');r=call(h,'acquisition.result');self.assertEqual(h.force,f);self.assertEqual(v,h.volumes);self.rejected(h,'contact.set','LOAD_NOT_RELEASED',engaged=False);step(h,2.);self.assertEqual(h.force,0.);self.assertEqual(v,h.volumes);self.assertEqual(r,call(h,'acquisition.result'));self.ledger(h)
|
| 137 |
+
def test_25_timeout_and_software_stop_keep_partial_effects(self):
|
| 138 |
+
h=setup(method={'pass_kind':'prescan','timeout_s':.1});r=run(h);self.assertEqual(r['error_code'],'TIMEOUT');self.assertAlmostEqual(r['elapsed_s'],.1)
|
| 139 |
+
h=prescanned();call(h,'acquisition.start');step(h,.8);call(h,'emergency.stop');self.assertEqual(h.phase,'failed');self.assertEqual(h.error,'SOFTWARE_STOP');self.rejected(h,'emergency.reset','LOAD_NOT_RELEASED');step(h,2.);call(h,'emergency.reset');self.assertFalse(h.emergency);self.assertEqual(h.phase,'failed');self.ledger(h)
|
| 140 |
+
def test_26_history_frozen_after_method_clean_and_new_sample(self):
|
| 141 |
+
h=prescanned();r=run(h);op=r['operation_id'];frozen=copy.deepcopy(h.records[op]);cleanup(h);call(h,'method.configure',**dict(h.method,pass_kind='postscan',criterion_threshold_m=1e-4));call(h,'specimen.load',**rt.SAMPLE_EXAMPLE);self.assertEqual(h.records[op],frozen);self.assertEqual(call(h,'acquisition.result'),frozen);self.assertEqual(json.loads(frozen['method_json'])['pass_kind'],'scratch');self.assertIn('derived_nominal_load_ratio',frozen['evidence']);self.assertGreater(frozen['source_projection_count'],0)
|
| 142 |
+
def test_27_queries_pure_and_owner_not_stolen(self):
|
| 143 |
+
h=setup(method={'pass_kind':'prescan'});s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start')['operation_id'];step(h,.3);before=state(h);h.read();h.describe();s.read(instance_id=h.instance_id);s.poll(op);call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);call(h,'image.reference',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);call(h,'ledger.read');self.assertEqual(state(h),before);q=s.invoke(instance_id=h.instance_id,capability_id='acquisition.result',arguments={},request_id='result');self.assertIsNone(q['operation_id']);self.assertEqual(h._owners[op],'agent');json.dumps(q,allow_nan=False)
|
| 144 |
+
def test_28_session_owner_access_poll_cancel_and_idempotence(self):
|
| 145 |
+
h=setup(method={'pass_kind':'prescan'});h.register_principal('other');a=h.session();b=h.session('other');args=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start');r=a.invoke(**args);self.assertEqual(r,a.invoke(**args));op=r['operation_id'];self.assertEqual(h._counter,1)
|
| 146 |
+
for k in ['acquisition.result','acquisition.stop']:self.assertEqual(b.invoke(instance_id=h.instance_id,capability_id=k,arguments={},request_id=k)['error']['code'],'ACCESS_DENIED')
|
| 147 |
+
for fn in [lambda:b.poll(op),lambda:b.cancel(op,'stop')]:
|
| 148 |
+
with self.assertRaises(rt.ActionRejected):fn()
|
| 149 |
+
c=a.cancel(op,'stop');self.assertEqual(c,a.cancel(op,'stop'));self.assertEqual(a.invoke(**dict(args,capability_id='power.set',arguments={'enabled':False}))['error']['code'],'REQUEST_CONFLICT')
|
| 150 |
+
def test_29_stale_cancel_retry_cannot_cancel_new_operation(self):
|
| 151 |
+
h=setup(method={'pass_kind':'prescan'});s=h.session();a=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='one');op1=s.invoke(**a)['operation_id'];c=s.cancel(op1,'cancel');step(h,2.);op2=s.invoke(**dict(a,request_id='two'))['operation_id'];self.assertEqual(s.cancel(op1,'cancel'),c);self.assertEqual(h.phase,'running');self.assertEqual(h.operation_id,op2)
|
| 152 |
+
with self.assertRaisesRegex(rt.ActionRejected,'REQUEST_CONFLICT'):s.cancel(op2,'cancel')
|
| 153 |
+
def test_30_no_agent_truth_or_recovery_capabilities(self):
|
| 154 |
+
h=setup();s=h.session();meta=s.describe(instance_id=h.instance_id);self.assertTrue(all(not k.startswith('truth.') for k in meta['state_slots']));self.assertNotIn('ledger.read',meta['capabilities']);self.assertNotIn('specimen.remove',meta['capabilities']);self.assertTrue(all(not k.startswith('truth.') for k in s.read(instance_id=h.instance_id)['observations']))
|
| 155 |
+
for k in ['ledger.read','specimen.remove','stylus.remove','debris.collect','sim.step','plant.configure']:
|
| 156 |
+
args=rt.CAPS[k]['example_arguments'];before=state(h);r=s.invoke(instance_id=h.instance_id,capability_id=k,arguments=args,request_id=k);self.assertEqual(r['error']['code'],'ACCESS_DENIED');self.assertEqual(state(h),before)
|
| 157 |
+
with self.assertRaises(rt.ActionRejected):s.read(instance_id=h.instance_id,state_ids=['truth.normal_force_n'])
|
| 158 |
+
with self.assertRaises(rt.ActionRejected):s.write(instance_id=h.instance_id,state_id='load.target_n',value=100.,request_id='x')
|
| 159 |
+
def test_31_two_instances_and_fractional_host_time_partition(self):
|
| 160 |
+
a=setup('one',method={'pass_kind':'prescan'});b=setup('two',method={'pass_kind':'prescan'});call(a,'acquisition.start');call(b,'acquisition.start');step(a,1.3)
|
| 161 |
+
for dt in [.03,.07,.25,.15,.4,.4]:step(b,dt)
|
| 162 |
+
self.assertEqual(a.read(),b.read());self.assertEqual(a.rows,b.rows);snapshot=state(b);step(a,.2);self.assertEqual(state(b),snapshot);self.assertNotEqual(a.time_s,b.time_s);call(a,'sim.step',dt_s=0.)
|
| 163 |
+
def test_32_extreme_dt_and_stiff_force_stable(self):
|
| 164 |
+
a=setup('a',plant={'force_response_tau_s':1e-5,'sensor_tau_s':1e-5},method={'pass_kind':'prescan'});b=setup('b',plant={'force_response_tau_s':1e-5,'sensor_tau_s':1e-5},method={'pass_kind':'prescan'});call(a,'acquisition.start');call(b,'acquisition.start');step(a,10.)
|
| 165 |
+
for _ in range(100):step(b,.1)
|
| 166 |
+
self.assertEqual(a.read(),b.read());self.assertEqual(a.rows,b.rows);self.assertEqual(a.phase,'succeeded');self.ledger(a)
|
| 167 |
+
def test_33_full_recovery_mass_ledger_and_no_resurrection(self):
|
| 168 |
+
h=prescanned(sample={'coating_thickness_m':1e-8});run(h);cleanup(h);l=self.ledger(h)
|
| 169 |
+
for n in ['coating','substrate','stylus']:self.assertEqual(l[n+'_remaining_kg'],0.);self.assertEqual(l[n+'_debris_kg'],0.)
|
| 170 |
+
self.assertGreater(l['substrate_debris_recovered_kg'],0.);self.assertGreater(l['stylus_debris_recovered_kg'],0.);self.rejected(h,'specimen.remove','NOT_LOADED')
|
| 171 |
+
def test_34_no_hidden_truth_in_agent_results(self):
|
| 172 |
+
h=setup(method={'pass_kind':'prescan'});s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start')['operation_id'];step(h,5.);r=s.poll(op);json.dumps(r,allow_nan=False)
|
| 173 |
+
def visit(value):
|
| 174 |
+
if isinstance(value,dict):
|
| 175 |
+
for k,v in value.items():self.assertFalse(k.startswith('truth.') or k in ['local_groove_m','coating_remaining_kg','substrate_remaining_kg','stylus_remaining_kg']);visit(v)
|
| 176 |
+
elif isinstance(value,list):
|
| 177 |
+
for v in value:visit(v)
|
| 178 |
+
visit(r);visit(s.read(instance_id=h.instance_id))
|
| 179 |
+
def test_35_declared_unsupported_and_reference_only_reject(self):
|
| 180 |
+
h=setup()
|
| 181 |
+
for k in rt.UNSUPPORTED:self.rejected(h,k,'UNSUPPORTED')
|
| 182 |
+
park(h);call(h,'clamp.set',locked=False);call(h,'specimen.remove');lib=rt.library();rid=next(k for k,r in lib['substances'].items() if not r.get('runtime_usable'));self.rejected(h,'specimen.load','INVALID_REFERENCE',**dict(rt.SAMPLE_EXAMPLE,reference_id=rid));self.rejected(h,'reference.query','INVALID_REFERENCE',reference_id='missing');self.rejected(h,'specimen.load','NEGATIVE_SOURCE_FORCE',**dict(rt.SAMPLE_EXAMPLE,accept_negative_force_projection=False))
|
| 183 |
+
def test_36_protocol_describe_registration_errors_and_json(self):
|
| 184 |
+
h=setup();s=h.session();self.assertEqual(s.describe(asset_type_id=rt.ASSET_TYPE_ID)['asset_type_id'],rt.ASSET_TYPE_ID)
|
| 185 |
+
for fn in [lambda:s.describe(),lambda:s.describe(instance_id='bad'),lambda:h.session('bad'),lambda:h.register_principal('agent'),lambda:s.read(instance_id=h.instance_id,state_ids='bad')]:
|
| 186 |
+
with self.assertRaises(rt.ActionRejected):fn()
|
| 187 |
+
for capability,arguments in [('unknown',{}),('power.set',{'enabled':'yes'}),('acoustic_emission.acquire',{})]:json.dumps(s.invoke(instance_id=h.instance_id,capability_id=capability,arguments=arguments,request_id=capability),allow_nan=False)
|
| 188 |
+
def test_37_failed_method_does_not_mutate_existing_results(self):
|
| 189 |
+
h=prescanned();r=run(h);self.rejected(h,'method.configure','STAGE_PATH_RANGE',**dict(h.method,start_x_m=.07));self.assertEqual(r,call(h,'acquisition.result'));before=state(h);s=h.session();rejected=s.invoke(instance_id=h.instance_id,capability_id='stage.move',arguments={'x_m':.1,'y_m':0.,'speed_m_s':.01},request_id='bad');self.assertEqual(rejected['status'],'rejected');self.assertEqual(state(h),before)
|
| 190 |
+
def test_38_phases_actual_sampling_time_and_endpoint_snapshot(self):
|
| 191 |
+
h=prescanned(method={'length_m':.0005,'speed_m_s':.001,'sample_interval_s':.2});r=run(h);scan=[x for x in r['rows'] if x['phase']=='scanning'];self.assertAlmostEqual(scan[-1]['time_s']-scan[0]['time_s'],.5,places=9);self.assertAlmostEqual(scan[-1]['distance_m'],.0005);self.assertEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s']);self.assertEqual(r['rows'][-1]['normal_force_n'],h.rows[-1]['normal_force_n']);self.assertGreater(r['elapsed_s'],.5);self.assertEqual(h.force,0.);self.assertTrue(all(y['time_s']>=x['time_s'] for x,y in zip(r['rows'],r['rows'][1:])))
|
| 192 |
+
def test_39_accepted_source_variants_change_actual_work(self):
|
| 193 |
+
usable=[(k,r) for k,r in rt.library()['substances'].items() if r.get('runtime_usable') and k.startswith(('borofloat33_','b4c_','al2o3_'))];works=[]
|
| 194 |
+
for rid,ref in usable[:2]:
|
| 195 |
+
h=prescanned(sample={'reference_id':rid},method={'source_start_distance_m':ref['values']['distance_m'][0]});r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(r['reference_id'],rid);works.append(h.tangential_work)
|
| 196 |
+
self.assertEqual(len(works),2);self.assertNotEqual(*works)
|
| 197 |
+
def test_zz_all_real_capability_returns_and_state_schemas(self):
|
| 198 |
+
spec=importlib.util.spec_from_file_location('rst_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(tool);meta=rt.export_antonpaar_rst300_contract_metadata();json.dumps(meta,allow_nan=False)
|
| 199 |
+
for k,c in meta['capabilities'].items():
|
| 200 |
+
self.assertEqual(tool.lint_schema(c['input_schema'],path=k+'.input'),[]);self.assertEqual(tool.lint_schema(c['output_schema'],path=k+'.output'),[])
|
| 201 |
+
covered=set()
|
| 202 |
+
for k,a,r in OBSERVED:
|
| 203 |
+
self.assertEqual(tool.validate_value(a,meta['capabilities'][k]['input_schema'],path=k+'.input'),[]);self.assertEqual(tool.validate_value(r,meta['capabilities'][k]['output_schema'],path=k+'.output'),[]);covered.add(k)
|
| 204 |
+
self.assertEqual(covered,set(rt.CAPS)-set(rt.UNSUPPORTED))
|
| 205 |
+
for state_values in STATES:
|
| 206 |
+
self.assertEqual(set(state_values),set(rt.SLOTS));json.dumps(state_values,allow_nan=False)
|
| 207 |
+
for k,v in state_values.items():self.assertEqual(tool.validate_value(v,meta['state_slots'][k]['value_schema'],path=k),[])
|
| 208 |
+
for k,c in meta['capabilities'].items():self.assertTrue(set(rt.CAPS[k]['effects'])<={e['state_id'] for e in c['state_effects']})
|
| 209 |
+
if __name__=='__main__':unittest.main()
|
tests/test_asset_antonpaar_saxspace.py
ADDED
|
@@ -0,0 +1,1547 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""tests for CHEM-153 antonpaar_saxspace: python3 -m unittest tests/test_asset_antonpaar_saxspace.py
|
| 2 |
+
|
| 3 |
+
Topics (pipeline.md): set points only write targets, read/describe are pure, rejected preconditions leave the state unchanged, two instances
|
| 4 |
+
are isolated, agent/evaluator truth isolation, conservation (photons, liquid volume, solute mass, tube energy), real return values validated
|
| 5 |
+
against the declared schemas (asset_tool lint_schema / validate_value), asynchronous completion and cancellation remnants, host-step
|
| 6 |
+
independence, declared immediate and on_step effects covering what the process changes; plus the instrument behaviour (generator interlocks and
|
| 7 |
+
ramps, vacuum below 3 mbar, TCStage range and heating rate, q range 0.03-40.7 nm^-1 and SWAXS to 60 deg, MYTHEN2 R 1K strips) and the scattering
|
| 8 |
+
physics (absolute scale from water cross-checked against the NIST SRM 3600 certified curve, Guinier Rg and molecular weight of SASBDB proteins
|
| 9 |
+
after desmearing, Percus-Yevick concentration effect, silver behenate calibration, silicon Ka doublet, NIST gold nanoparticles, sample states,
|
| 10 |
+
faults and the autosampler carry-over).
|
| 11 |
+
"""
|
| 12 |
+
import copy
|
| 13 |
+
import json
|
| 14 |
+
import math
|
| 15 |
+
import random
|
| 16 |
+
import sys
|
| 17 |
+
import unittest
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
|
| 20 |
+
import numpy as np
|
| 21 |
+
|
| 22 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 23 |
+
sys.path.insert(0, str(ROOT / "scripts"))
|
| 24 |
+
sys.path.insert(0, str(ROOT / "skills/chemistry-lab-assets/scripts"))
|
| 25 |
+
from asset_runtime import antonpaar_saxspace as rt # noqa: E402
|
| 26 |
+
import asset_tool # noqa: E402
|
| 27 |
+
|
| 28 |
+
CHECKS, PROCESS_EVIDENCE = [], {}
|
| 29 |
+
_META = {}
|
| 30 |
+
RNGS = ('rng', 'rng_acq', 'rng_mount', 'rng_cal')
|
| 31 |
+
LYS = 'sasbdb_sasdrm8_lysozyme_c'
|
| 32 |
+
BSA = 'sasbdb_sasdeb5_bsa'
|
| 33 |
+
GC = 'nist_srm3600_glassy_carbon'
|
| 34 |
+
AU30 = 'nist_rm8012_gold_30nm'
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def _meta():
|
| 38 |
+
if not _META:
|
| 39 |
+
_META.update(rt.export_antonpaar_saxspace_contract_metadata())
|
| 40 |
+
return _META
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
_orig_invoke = rt.AntonpaarSaxspaceRuntime.invoke
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def _instrumented_invoke(self, capability_id, **a):
|
| 47 |
+
"""Every successful call is checked against its declared output schema and immediate state effects (read does not advance time)."""
|
| 48 |
+
before = self.read('evaluator') if capability_id != 'sim.step' else None
|
| 49 |
+
t0 = self.time_ns
|
| 50 |
+
out = _orig_invoke(self, capability_id, **a)
|
| 51 |
+
meta = _meta()['capabilities'][capability_id]
|
| 52 |
+
errs = asset_tool.validate_value(out, meta['output_schema'])
|
| 53 |
+
if errs:
|
| 54 |
+
raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}')
|
| 55 |
+
if before is not None:
|
| 56 |
+
assert self.time_ns == t0, capability_id
|
| 57 |
+
after = self.read('evaluator')
|
| 58 |
+
undeclared = {k for k in after if json.dumps(after[k], sort_keys=True, default=str) != json.dumps(before[k], sort_keys=True, default=str)
|
| 59 |
+
and _changed(before[k], after[k])} - set(rt.CAPS[capability_id]['effects'])
|
| 60 |
+
if undeclared and rt.EFFECTS:
|
| 61 |
+
raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}')
|
| 62 |
+
PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=copy.deepcopy(a), result_keys=sorted(out)))
|
| 63 |
+
return out
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
rt.AntonpaarSaxspaceRuntime.invoke = _instrumented_invoke
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
class QuietRng:
|
| 70 |
+
"""Noise-free stand-in for random.Random (gauges exact, fixed draws) so that two runs differ only by the process."""
|
| 71 |
+
def gauss(self, mu, sigma):
|
| 72 |
+
return mu
|
| 73 |
+
|
| 74 |
+
def random(self):
|
| 75 |
+
return 0.5
|
| 76 |
+
|
| 77 |
+
def uniform(self, a, b):
|
| 78 |
+
return 0.5 * (a + b)
|
| 79 |
+
|
| 80 |
+
def getrandbits(self, k):
|
| 81 |
+
return 12345
|
| 82 |
+
|
| 83 |
+
def seed(self, x):
|
| 84 |
+
pass
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def configured(seed=1, **plant):
|
| 88 |
+
h = rt.AntonpaarSaxspaceRuntime()
|
| 89 |
+
h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant))
|
| 90 |
+
return h
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def ready(seed=1, xray=True, **plant):
|
| 94 |
+
"""Powered, SAXSdrive up, chiller flowing, key at I and (optionally) X-rays at 40 kV / 50 mA."""
|
| 95 |
+
h = configured(seed, **plant)
|
| 96 |
+
h.invoke('power.set', enabled=True)
|
| 97 |
+
h.step(61.0)
|
| 98 |
+
h.invoke('generator.set_key', on=True)
|
| 99 |
+
if xray:
|
| 100 |
+
h.invoke('generator.xray_on')
|
| 101 |
+
h.step(21.0)
|
| 102 |
+
return h
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def liquid(h, sid, comps=(), volume=500e-9):
|
| 106 |
+
h.invoke('sample.provide', sample_id=sid, form='solution', solvent='water', volume_m3=volume, thickness_m=None,
|
| 107 |
+
components=[dict(template_id=t, concentration_kg_m3=c, model_parameters=None) for t, c in comps])
|
| 108 |
+
return sid
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def solid(h, sid, tid, thickness, form='solid'):
|
| 112 |
+
h.invoke('sample.provide', sample_id=sid, form=form, solvent='none', volume_m3=0.0, thickness_m=thickness,
|
| 113 |
+
components=[dict(template_id=tid, concentration_kg_m3=None, model_parameters=None)])
|
| 114 |
+
return sid
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def load(h, sid, holder='capillary_1mm', pump_s=220.0, temp=None, align=True):
|
| 118 |
+
"""Vent, open the door, exchange the holder, close, pump below 3 mbar, (optionally) set the temperature and TrueFocus-align."""
|
| 119 |
+
if not h.door_open:
|
| 120 |
+
h.invoke('vacuum.set_pump', on=False)
|
| 121 |
+
h.step(80.0)
|
| 122 |
+
h.invoke('chamber.set_door', open=True)
|
| 123 |
+
if h.holder is not None or h.holder_broken:
|
| 124 |
+
h.invoke('sample.unload')
|
| 125 |
+
h.invoke('sample.load', sample_id=sid, holder=holder)
|
| 126 |
+
h.invoke('chamber.set_door', open=False)
|
| 127 |
+
h.invoke('vacuum.set_pump', on=True)
|
| 128 |
+
if temp is not None:
|
| 129 |
+
h.invoke('stage.set_temperature', temperature_k=temp)
|
| 130 |
+
h.step(pump_s)
|
| 131 |
+
if align and holder in ('capillary_1mm', 'mu_cell') and sid is not None:
|
| 132 |
+
h.invoke('stage.auto_align')
|
| 133 |
+
h.step(rt.ALIGN_S + 2.0)
|
| 134 |
+
return h
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def acquire(h, exposure=300.0, frames=1):
|
| 138 |
+
op = h.invoke('acquisition.start', exposure_s=exposure, frames=frames)['operation_id']
|
| 139 |
+
h.step(exposure + 1.0)
|
| 140 |
+
rec = h.records[h.operations[op]['record_id']]
|
| 141 |
+
assert rec['status'] == 'completed', (rec['status'], rec['error_code'])
|
| 142 |
+
return rec['record_id']
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
def empty_beam(h, pump_s=220.0):
|
| 146 |
+
"""Vent, open the door, remove the holder, close and pump: the beam passes only air and the collimation (empty-beam background)."""
|
| 147 |
+
if not h.door_open:
|
| 148 |
+
h.invoke('vacuum.set_pump', on=False)
|
| 149 |
+
h.step(80.0)
|
| 150 |
+
h.invoke('chamber.set_door', open=True)
|
| 151 |
+
if h.holder is not None or h.holder_broken:
|
| 152 |
+
h.invoke('sample.unload')
|
| 153 |
+
h.invoke('chamber.set_door', open=False)
|
| 154 |
+
h.invoke('vacuum.set_pump', on=True)
|
| 155 |
+
h.step(pump_s)
|
| 156 |
+
return h
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def calibrated(seed=1, collimation='line'):
|
| 160 |
+
"""Ready instrument with the zero angle and the SDD calibrated on silver behenate (paste cell)."""
|
| 161 |
+
h = ready(seed)
|
| 162 |
+
if collimation != 'line':
|
| 163 |
+
h.invoke('collimation.set_mode', mode=collimation)
|
| 164 |
+
solid(h, 'agbe', 'silver_behenate', 1e-3, form='powder')
|
| 165 |
+
load(h, 'agbe', holder='paste_cell')
|
| 166 |
+
r = acquire(h, 60.0 if collimation == 'line' else 600.0)
|
| 167 |
+
h.invoke('calibration.zero_angle', record_id=r)
|
| 168 |
+
h.invoke('calibration.q_scale', record_id=r, calibrant='silver_behenate')
|
| 169 |
+
return h
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def water_calibration(h, temp=293.15, exposure=600.0):
|
| 173 |
+
liquid(h, 'water_std')
|
| 174 |
+
load(h, 'water_std', temp=temp)
|
| 175 |
+
rw = acquire(h, exposure)
|
| 176 |
+
load(h, None, temp=temp)
|
| 177 |
+
re_ = acquire(h, exposure)
|
| 178 |
+
return h.invoke('calibration.absolute', record_id=rw, background_record_id=re_, standard='water', thickness_m=1e-3)['calibration_id']
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
def rejected(h, cap, code, **a):
|
| 182 |
+
before = h.read('evaluator')
|
| 183 |
+
rev = h.revision
|
| 184 |
+
try:
|
| 185 |
+
h.invoke(cap, **a)
|
| 186 |
+
except rt.ActionRejected as exc:
|
| 187 |
+
assert str(exc) == code, (cap, str(exc), code)
|
| 188 |
+
assert json.dumps(h.read('evaluator'), sort_keys=True, default=str) == json.dumps(before, sort_keys=True, default=str), cap
|
| 189 |
+
assert h.revision == rev, cap
|
| 190 |
+
return True
|
| 191 |
+
raise AssertionError(f'{cap} was not rejected (expected {code})')
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
def reduced_arrays(r):
|
| 195 |
+
return np.asarray(r['q_per_m']) * 1e-9, np.asarray(r['intensity']) / 100.0, np.asarray(r['sigma']) / 100.0 # 1/nm, 1/cm
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
class ContractAndSchemas(unittest.TestCase):
|
| 199 |
+
def test_module_identity(self):
|
| 200 |
+
self.assertEqual(rt.ASSET_TYPE_ID, 'instrument.antonpaar_saxspace')
|
| 201 |
+
self.assertEqual(rt.CATALOG_ID, 'CHEM-153')
|
| 202 |
+
|
| 203 |
+
def test_schemas_lint_and_examples_validate(self):
|
| 204 |
+
meta = _meta()
|
| 205 |
+
for k, c in meta['capabilities'].items():
|
| 206 |
+
self.assertEqual(asset_tool.lint_schema(c['input_schema']), [], k)
|
| 207 |
+
self.assertEqual(asset_tool.lint_schema(c['output_schema']), [], k)
|
| 208 |
+
if c['availability'] == 'implemented':
|
| 209 |
+
self.assertEqual(asset_tool.validate_value(c['example_arguments'], c['input_schema']), [], k)
|
| 210 |
+
for k, s in meta['state_slots'].items():
|
| 211 |
+
self.assertEqual(asset_tool.lint_schema(s['value_schema']), [], k)
|
| 212 |
+
|
| 213 |
+
def test_metadata_references_are_consistent(self):
|
| 214 |
+
meta = _meta()
|
| 215 |
+
slots = set(meta['state_slots'])
|
| 216 |
+
for k, c in meta['capabilities'].items():
|
| 217 |
+
for e in c['state_effects']:
|
| 218 |
+
self.assertIn(e['state_id'], slots, k)
|
| 219 |
+
for x in c['observes']:
|
| 220 |
+
self.assertIn(x, slots, k)
|
| 221 |
+
for p in c['preconditions']:
|
| 222 |
+
for x in p['state_ids']:
|
| 223 |
+
self.assertIn(x, slots, k)
|
| 224 |
+
for e in c['errors']:
|
| 225 |
+
self.assertIn(e['code'], rt.ERROR_ZH, k)
|
| 226 |
+
queries = {k for k, v in rt.CAPS.items() if v['kind'] in ('query', 'analysis')}
|
| 227 |
+
self.assertEqual(set(rt.EFFECTS) | set(rt.UNSUPPORTED) | queries, set(rt.CAPS))
|
| 228 |
+
self.assertEqual(set(rt.CAP_SOURCES), set(rt.CAPS))
|
| 229 |
+
comps = {p['id'] for p in json.loads((rt.ASSET / 'geometry_manifest.json').read_text())['components']}
|
| 230 |
+
for k, c in meta['capabilities'].items():
|
| 231 |
+
self.assertLessEqual(set(c['component_ids']) - {'monitor'}, comps, k)
|
| 232 |
+
for k, s in meta['state_slots'].items():
|
| 233 |
+
self.assertLessEqual(set(s['component_ids']) - {'monitor'}, comps, k)
|
| 234 |
+
|
| 235 |
+
def test_every_rejection_code_is_declared(self):
|
| 236 |
+
"""Each ActionRejected code raised by a command method appears in that capability's declared errors."""
|
| 237 |
+
import inspect
|
| 238 |
+
import re
|
| 239 |
+
src = inspect.getsource(rt.AntonpaarSaxspaceRuntime)
|
| 240 |
+
meta = _meta()['capabilities']
|
| 241 |
+
helpers = {'_need_plant': ['PLANT_REQUIRED'], '_need_power': ['PLANT_REQUIRED', 'POWER_OFF'], '_need_gen_power': ['PLANT_REQUIRED', 'POWER_OFF'],
|
| 242 |
+
'_need_ready': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING'], '_need_idle': ['ACQUISITION_RUNNING'],
|
| 243 |
+
'_need_door_open': ['DOOR_CLOSED'], '_need_stage': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ACQUISITION_RUNNING'],
|
| 244 |
+
'_need_beam_ready': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ACQUISITION_RUNNING', 'DOOR_OPEN', 'XRAY_NOT_READY',
|
| 245 |
+
'VACUUM_NOT_READY', 'MOTION_IN_PROGRESS', 'RECORDS_FULL'],
|
| 246 |
+
'_need_asx': ['PLANT_REQUIRED', 'POWER_OFF', 'NOT_READY', 'ERROR_PENDING', 'ASX_DOOR_OPEN', 'ASX_BUSY', 'ACQUISITION_RUNNING'],
|
| 247 |
+
'_rec(': ['UNKNOWN_RECORD', 'RECORD_NOT_COMPLETED'], '_norm(': ['NO_PRIMARY_BEAM'], '_red(': ['UNKNOWN_REDUCED'],
|
| 248 |
+
'_cmd_analysis_guinier(': ['UNKNOWN_REDUCED', 'GUINIER_FAILED']}
|
| 249 |
+
for k in rt.CAPS:
|
| 250 |
+
if k in rt.UNSUPPORTED:
|
| 251 |
+
continue
|
| 252 |
+
m = re.search(r' def _cmd_' + k.replace('.', '_') + r'\(.*?(?=\n def |\Z)', src, re.S)
|
| 253 |
+
self.assertIsNotNone(m, k)
|
| 254 |
+
body = m.group(0)
|
| 255 |
+
codes = set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", body))
|
| 256 |
+
for hname, hcodes in helpers.items():
|
| 257 |
+
if hname in body:
|
| 258 |
+
codes |= set(hcodes)
|
| 259 |
+
codes.discard('INVALID_ARGUMENT')
|
| 260 |
+
declared = {e['code'] for e in meta[k]['errors']}
|
| 261 |
+
self.assertLessEqual(codes, declared, (k, sorted(codes - declared)))
|
| 262 |
+
|
| 263 |
+
def test_unsupported_capabilities_report_unsupported(self):
|
| 264 |
+
h = configured()
|
| 265 |
+
h.register_principal('a', 'agent')
|
| 266 |
+
s = h.session('a')
|
| 267 |
+
for k in rt.UNSUPPORTED:
|
| 268 |
+
r = s.invoke(instance_id=h.instance_id, capability_id=k, arguments={}, request_id='u-' + k)
|
| 269 |
+
self.assertEqual(r['status'], 'unsupported', k)
|
| 270 |
+
self.assertEqual(r['error']['code'], 'UNSUPPORTED')
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
class HostClockAndPurity(unittest.TestCase):
|
| 274 |
+
def test_read_and_describe_do_not_advance_time(self):
|
| 275 |
+
h = ready()
|
| 276 |
+
h.register_principal('a', 'agent')
|
| 277 |
+
t, rev = h.time_ns, h.revision
|
| 278 |
+
h.read('evaluator')
|
| 279 |
+
s = h.session('a')
|
| 280 |
+
s.read(instance_id=h.instance_id)
|
| 281 |
+
s.describe(instance_id=h.instance_id)
|
| 282 |
+
self.assertEqual((h.time_ns, h.revision), (t, rev))
|
| 283 |
+
|
| 284 |
+
def test_step_zero_and_negative(self):
|
| 285 |
+
h = configured()
|
| 286 |
+
rev = h.revision
|
| 287 |
+
h.step(0.0)
|
| 288 |
+
self.assertEqual(h.revision, rev)
|
| 289 |
+
with self.assertRaises(rt.ActionRejected):
|
| 290 |
+
h.step(-1.0)
|
| 291 |
+
|
| 292 |
+
def test_host_step_chopping_does_not_change_the_result(self):
|
| 293 |
+
def run(chunks):
|
| 294 |
+
h = ready(seed=5)
|
| 295 |
+
h.rng = QuietRng()
|
| 296 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 297 |
+
load(h, 'lys', temp=283.15)
|
| 298 |
+
h.invoke('acquisition.swaxs_scan', arm_angles_rad=[0.0, 0.3], exposure_s=30.0)
|
| 299 |
+
h.invoke('asx.set_door', open=True)
|
| 300 |
+
h.invoke('asx.set_door', open=False)
|
| 301 |
+
for dt in chunks:
|
| 302 |
+
h.step(dt)
|
| 303 |
+
rec = h.records['sx-%d' % h.seq['sx']]
|
| 304 |
+
return h.read('evaluator'), h.ledger(), rec
|
| 305 |
+
(a, la, ra), (b, lb, rb) = run([90.0]), run([0.37] * 243 + [0.09])
|
| 306 |
+
for k in ('truth.pressure_pa', 'truth.stage_temperature_k', 'detector.arm_angle_rad', 'stage.y_m', 'clock.time_s'):
|
| 307 |
+
self.assertAlmostEqual(a[k], b[k], delta=1e-9 * max(abs(a[k]), 1e-12), msg=k)
|
| 308 |
+
self.assertEqual(ra['status'], rb['status'])
|
| 309 |
+
self.assertEqual(len(ra['segments']), len(rb['segments']))
|
| 310 |
+
for k in ('photons_incident', 'photons_scattered_detected', 'tube_energy_j'):
|
| 311 |
+
self.assertAlmostEqual(la[k], lb[k], delta=1e-9 * max(la[k], 1.0), msg=k)
|
| 312 |
+
|
| 313 |
+
def test_reads_do_not_change_later_counts(self):
|
| 314 |
+
"""Reading (agent and evaluator, incl. detector.total_counts that evaluates the rate model) during an exposure leaves the record and the
|
| 315 |
+
ledgers bit-identical to a run without reads (the rate cache holds values that depend on its quantised key only)."""
|
| 316 |
+
h = ready(seed=4)
|
| 317 |
+
liquid(h, 'w')
|
| 318 |
+
load(h, 'w')
|
| 319 |
+
h.invoke('acquisition.start', exposure_s=30.0, frames=1)
|
| 320 |
+
a, b = copy.deepcopy(h), copy.deepcopy(h)
|
| 321 |
+
for _ in range(70):
|
| 322 |
+
a.step(0.5)
|
| 323 |
+
a.read('agent')
|
| 324 |
+
a.read('evaluator')
|
| 325 |
+
b.step(0.5)
|
| 326 |
+
ra, rb = a.records['sx-1'], b.records['sx-1']
|
| 327 |
+
self.assertEqual(ra['status'], 'completed')
|
| 328 |
+
self.assertEqual(ra['primary_beam_counts'], rb['primary_beam_counts'])
|
| 329 |
+
self.assertEqual(ra['segments'][0]['counts'], rb['segments'][0]['counts'])
|
| 330 |
+
self.assertEqual(a.ledger(), b.ledger())
|
| 331 |
+
|
| 332 |
+
def test_set_points_only_write_targets(self):
|
| 333 |
+
h = ready()
|
| 334 |
+
h.invoke('detector.move_arm', angle_rad=0.5)
|
| 335 |
+
self.assertEqual(h.arm, 0.0)
|
| 336 |
+
h.step(1.0)
|
| 337 |
+
self.assertAlmostEqual(h.arm, rt.ARM_SPEED_RAD_S, places=12)
|
| 338 |
+
h.invoke('stage.set_temperature', temperature_k=333.15)
|
| 339 |
+
t0 = h.t_stage
|
| 340 |
+
self.assertEqual(h.t_set, 333.15)
|
| 341 |
+
h.step(60.0)
|
| 342 |
+
self.assertAlmostEqual(h.t_stage - t0, rt.HOT_STAGE_RAMP_K_S * 60.0, places=6) # 10 C/min while far from the set point
|
| 343 |
+
h.invoke('generator.set_power', voltage_v=30000.0, current_a=0.02)
|
| 344 |
+
self.assertEqual(h.kv, 40000.0)
|
| 345 |
+
h.step(2.0)
|
| 346 |
+
self.assertAlmostEqual(h.kv, 40000.0 - 2.0 * rt.HV_RAMP_V_S, places=6)
|
| 347 |
+
|
| 348 |
+
|
| 349 |
+
class GeneratorAndInterlocks(unittest.TestCase):
|
| 350 |
+
def test_start_up_key_ramp_and_lamps(self):
|
| 351 |
+
h = configured()
|
| 352 |
+
rejected(h, 'generator.xray_on', 'POWER_OFF')
|
| 353 |
+
h.invoke('power.set', enabled=True)
|
| 354 |
+
h.step(rt.BOOT_S - 1.0)
|
| 355 |
+
self.assertEqual(h.state, 'booting')
|
| 356 |
+
rejected(h, 'generator.xray_on', 'NOT_READY')
|
| 357 |
+
h.step(2.0)
|
| 358 |
+
self.assertEqual(h.state, 'ready')
|
| 359 |
+
rejected(h, 'generator.xray_on', 'KEY_OFF')
|
| 360 |
+
h.invoke('generator.set_key', on=True)
|
| 361 |
+
self.assertTrue(h.read()['panel.xray_off_lamp'])
|
| 362 |
+
h.invoke('generator.xray_on')
|
| 363 |
+
self.assertTrue(h.read()['panel.warning_lamp'])
|
| 364 |
+
h.step(10.0)
|
| 365 |
+
self.assertAlmostEqual(h.kv, 20000.0, places=6)
|
| 366 |
+
self.assertAlmostEqual(h.ma, 0.05, places=9)
|
| 367 |
+
h.step(11.0)
|
| 368 |
+
self.assertEqual(h.read()['generator.voltage_indicated_v'], 40000.0)
|
| 369 |
+
self.assertAlmostEqual(h.read()['generator.current_indicated_a'], 0.05, places=9)
|
| 370 |
+
h.invoke('generator.set_key', on=False)
|
| 371 |
+
self.assertFalse(h.xray_on)
|
| 372 |
+
self.assertEqual(h.kv, 0.0)
|
| 373 |
+
|
| 374 |
+
def test_chiller_needs_30_s_and_its_failure_trips_the_tube(self):
|
| 375 |
+
h = configured()
|
| 376 |
+
h.invoke('power.set', enabled=True)
|
| 377 |
+
h.step(20.0)
|
| 378 |
+
self.assertFalse(h.read()['chiller.flow_ok'])
|
| 379 |
+
h.step(45.0)
|
| 380 |
+
h.invoke('generator.set_key', on=True)
|
| 381 |
+
h.invoke('generator.xray_on')
|
| 382 |
+
h.step(25.0)
|
| 383 |
+
h.invoke('fault.inject', fault='chiller_failure', active=True)
|
| 384 |
+
h.step(1.0)
|
| 385 |
+
r = h.read()
|
| 386 |
+
self.assertFalse(r['generator.xray_on'])
|
| 387 |
+
self.assertEqual(r['generator.fault_code'], 'COOLING_WATER_LOW')
|
| 388 |
+
self.assertTrue(r['panel.standby_lamp'])
|
| 389 |
+
rejected(h, 'generator.xray_on', 'GENERATOR_FAULT')
|
| 390 |
+
rejected(h, 'generator.acknowledge', 'COOLING_WATER_LOW')
|
| 391 |
+
h.invoke('fault.inject', fault='chiller_failure', active=False)
|
| 392 |
+
h.invoke('generator.acknowledge')
|
| 393 |
+
h.invoke('generator.xray_on')
|
| 394 |
+
self.assertTrue(h.xray_on)
|
| 395 |
+
|
| 396 |
+
def test_emergency_stop_fails_the_acquisition_and_latches(self):
|
| 397 |
+
h = ready()
|
| 398 |
+
liquid(h, 'w')
|
| 399 |
+
load(h, 'w')
|
| 400 |
+
op = h.invoke('acquisition.start', exposure_s=100.0, frames=1)['operation_id']
|
| 401 |
+
h.step(10.0)
|
| 402 |
+
h.invoke('generator.emergency_stop')
|
| 403 |
+
rec = h.records[h.operations[op]['record_id']]
|
| 404 |
+
self.assertEqual((rec['status'], rec['error_code']), ('failed', 'XRAY_OFF'))
|
| 405 |
+
self.assertEqual(rec['segments'], [])
|
| 406 |
+
self.assertFalse(h.read()['shutter.open'])
|
| 407 |
+
rejected(h, 'generator.xray_on', 'EMERGENCY_STOP')
|
| 408 |
+
rejected(h, 'generator.acknowledge', 'EMERGENCY_STOP')
|
| 409 |
+
h.invoke('generator.release_emergency_stop')
|
| 410 |
+
h.invoke('generator.acknowledge')
|
| 411 |
+
h.invoke('generator.xray_on')
|
| 412 |
+
self.assertTrue(h.xray_on)
|
| 413 |
+
|
| 414 |
+
def test_mains_fault_and_power_cycle(self):
|
| 415 |
+
h = ready()
|
| 416 |
+
h.invoke('plant.configure', room_k=295.15, mains_voltage_v=180.0, noise_seed=9)
|
| 417 |
+
r = h.read()
|
| 418 |
+
self.assertFalse(r['power.enabled'])
|
| 419 |
+
self.assertEqual(r['system.error_code'], 'MAINS_FAULT')
|
| 420 |
+
rejected(h, 'power.set', 'MAINS_OUT_OF_RANGE', enabled=True)
|
| 421 |
+
h.invoke('plant.configure', room_k=295.15, mains_voltage_v=230.0, noise_seed=9)
|
| 422 |
+
h.invoke('power.set', enabled=True)
|
| 423 |
+
self.assertIsNone(h.read()['system.error_code'])
|
| 424 |
+
|
| 425 |
+
|
| 426 |
+
class VacuumDoorAndStage(unittest.TestCase):
|
| 427 |
+
def test_pump_down_below_3_mbar_and_door_interlock(self):
|
| 428 |
+
h = ready()
|
| 429 |
+
liquid(h, 'w')
|
| 430 |
+
h.invoke('chamber.set_door', open=True)
|
| 431 |
+
h.invoke('sample.load', sample_id='w', holder='capillary_1mm')
|
| 432 |
+
rejected(h, 'vacuum.set_pump', 'DOOR_OPEN', on=True)
|
| 433 |
+
h.invoke('chamber.set_door', open=False)
|
| 434 |
+
h.invoke('vacuum.set_pump', on=True)
|
| 435 |
+
rejected(h, 'chamber.set_door', 'PUMP_ON', open=True)
|
| 436 |
+
h.step(20.0)
|
| 437 |
+
rejected(h, 'chamber.set_door', 'CHAMBER_UNDER_VACUUM', open=True)
|
| 438 |
+
t_ready = rt.V_VAC_M3 / rt.S_PUMP_M3_S * math.log((rt.P_ATM - rt.P_ULT_PA) / (rt.VACUUM_READY_PA - rt.P_ULT_PA))
|
| 439 |
+
h.step(t_ready - 25.0)
|
| 440 |
+
self.assertFalse(h.read()['vacuum.ready'])
|
| 441 |
+
rejected(h, 'acquisition.start', 'VACUUM_NOT_READY', exposure_s=10.0, frames=1)
|
| 442 |
+
h.step(10.0)
|
| 443 |
+
self.assertTrue(h.read()['vacuum.ready'])
|
| 444 |
+
self.assertLess(h.p, rt.VACUUM_READY_PA)
|
| 445 |
+
h.invoke('vacuum.set_pump', on=False)
|
| 446 |
+
h.step(60.0)
|
| 447 |
+
self.assertGreater(h.p, rt.DOOR_OPEN_MIN_PA)
|
| 448 |
+
h.invoke('chamber.set_door', open=True)
|
| 449 |
+
|
| 450 |
+
def test_air_measurement_is_allowed_but_air_scatters(self):
|
| 451 |
+
h = ready()
|
| 452 |
+
liquid(h, 'w')
|
| 453 |
+
load(h, 'w', align=False)
|
| 454 |
+
r_vac = h.records[acquire(h, 60.0)]
|
| 455 |
+
h.invoke('vacuum.set_pump', on=False)
|
| 456 |
+
h.step(90.0)
|
| 457 |
+
r_air = h.records[acquire(h, 60.0)]
|
| 458 |
+
mid = slice(200, 400)
|
| 459 |
+
self.assertGreater(sum(r_air['segments'][0]['counts'][mid]), 1.5 * sum(r_vac['segments'][0]['counts'][mid]))
|
| 460 |
+
self.assertLess(r_air['primary_beam_counts'], r_vac['primary_beam_counts'])
|
| 461 |
+
|
| 462 |
+
def test_stage_temperature_range_ramp_and_mount(self):
|
| 463 |
+
h = ready()
|
| 464 |
+
rejected(h, 'stage.set_temperature', 'TEMPERATURE_OUT_OF_RANGE', temperature_k=473.15)
|
| 465 |
+
h.invoke('stage.set_temperature', temperature_k=253.15)
|
| 466 |
+
h.step(600.0)
|
| 467 |
+
self.assertAlmostEqual(h.t_stage, 253.15, delta=rt.TEMP_ACCURACY_K)
|
| 468 |
+
h.invoke('chamber.set_door', open=True)
|
| 469 |
+
rejected(h, 'stage.mount', 'STAGE_NOT_AMBIENT', stage_type='tcstage_extended')
|
| 470 |
+
h.invoke('stage.set_temperature', temperature_k=295.15)
|
| 471 |
+
h.step(600.0)
|
| 472 |
+
h.invoke('stage.mount', stage_type='tcstage_extended')
|
| 473 |
+
h.invoke('stage.set_temperature', temperature_k=773.15)
|
| 474 |
+
h.step(60.0)
|
| 475 |
+
self.assertAlmostEqual(h.t_stage, 295.15 + 10.0, delta=0.01)
|
| 476 |
+
self.assertEqual(h.read()['stage.type'], 'tcstage_extended')
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
class SamplesAndHolders(unittest.TestCase):
|
| 480 |
+
def test_sample_validation(self):
|
| 481 |
+
h = configured()
|
| 482 |
+
bad = [dict(form='solution', solvent='none'), dict(form='solid', thickness_m=None), dict(form='powder', components=[dict(template_id=LYS, concentration_kg_m3=5.0,
|
| 483 |
+
model_parameters=None)])]
|
| 484 |
+
base = dict(sample_id='x', form='solution', solvent='water', volume_m3=1e-7, thickness_m=None, components=[])
|
| 485 |
+
for b in bad:
|
| 486 |
+
a = dict(base, **b)
|
| 487 |
+
if a['form'] != 'solution':
|
| 488 |
+
a['solvent'], a['volume_m3'] = 'none', 0.0
|
| 489 |
+
if 'thickness_m' not in b:
|
| 490 |
+
a['thickness_m'] = 1e-3
|
| 491 |
+
try:
|
| 492 |
+
h.invoke('sample.provide', **a)
|
| 493 |
+
raise AssertionError(b)
|
| 494 |
+
except rt.ActionRejected as exc:
|
| 495 |
+
self.assertIn(str(exc), ('SAMPLE_FORM_INVALID', 'CONCENTRATION_REQUIRED'), b)
|
| 496 |
+
rejected(h, 'sample.provide', 'CONCENTRATION_REQUIRED', **dict(base, components=[dict(template_id=LYS, concentration_kg_m3=None, model_parameters=None)]))
|
| 497 |
+
rejected(h, 'sample.provide', 'UNKNOWN_TEMPLATE', **dict(base, components=[dict(template_id='nope', concentration_kg_m3=1.0, model_parameters=None)]))
|
| 498 |
+
rejected(h, 'sample.provide', 'SAMPLE_FORM_INVALID', **dict(base, form='solid', solvent='none', volume_m3=0.0, thickness_m=2e-3,
|
| 499 |
+
components=[dict(template_id=GC, concentration_kg_m3=None, model_parameters=None)]))
|
| 500 |
+
rejected(h, 'sample.provide', 'MODEL_PARAMETERS_INVALID', **dict(base, form='solid', solvent='none', volume_m3=0.0, thickness_m=1e-3,
|
| 501 |
+
components=[dict(template_id='model_lamellar', concentration_kg_m3=None,
|
| 502 |
+
model_parameters=dict(d_spacing_m=1e-6))]))
|
| 503 |
+
|
| 504 |
+
def test_load_volumes_holders_and_empty_capillary(self):
|
| 505 |
+
h = ready(xray=False)
|
| 506 |
+
liquid(h, 'lys', [(LYS, 5.0)], volume=100e-9)
|
| 507 |
+
solid(h, 'gc', GC, 1.055e-3)
|
| 508 |
+
rejected(h, 'sample.load', 'DOOR_CLOSED', sample_id='lys', holder='capillary_1mm')
|
| 509 |
+
h.invoke('chamber.set_door', open=True)
|
| 510 |
+
rejected(h, 'sample.load', 'HOLDER_UNSUITABLE', sample_id='lys', holder='solid_holder')
|
| 511 |
+
rejected(h, 'sample.load', 'HOLDER_UNSUITABLE', sample_id='gc', holder='capillary_1mm')
|
| 512 |
+
h.invoke('sample.load', sample_id='lys', holder='capillary_1mm')
|
| 513 |
+
self.assertAlmostEqual(h.samples['lys']['bench_volume_m3'], 40e-9, places=18)
|
| 514 |
+
rejected(h, 'sample.load', 'HOLDER_OCCUPIED', sample_id='gc', holder='solid_holder')
|
| 515 |
+
h.invoke('sample.unload')
|
| 516 |
+
rejected(h, 'sample.load', 'INSUFFICIENT_VOLUME', sample_id='lys', holder='capillary_1mm')
|
| 517 |
+
h.invoke('sample.load', sample_id='lys', holder='mu_cell')
|
| 518 |
+
h.invoke('sample.unload')
|
| 519 |
+
h.invoke('sample.load', sample_id=None, holder='capillary_1mm')
|
| 520 |
+
self.assertIsNone(h.read()['holder.sample_id'])
|
| 521 |
+
self.assertEqual(h.read()['holder.type'], 'capillary_1mm')
|
| 522 |
+
|
| 523 |
+
def test_truefocus_finds_the_capillary_axis(self):
|
| 524 |
+
h = ready(seed=4)
|
| 525 |
+
liquid(h, 'w')
|
| 526 |
+
load(h, 'w', align=False)
|
| 527 |
+
off = h.cap_offset
|
| 528 |
+
self.assertGreater(abs(off), 0.05e-3)
|
| 529 |
+
g0 = h._geometry()
|
| 530 |
+
h.invoke('stage.auto_align')
|
| 531 |
+
h.step(rt.ALIGN_S + 1.0)
|
| 532 |
+
h.step(2.0)
|
| 533 |
+
self.assertAlmostEqual(h.stage['y'], off, delta=4e-5)
|
| 534 |
+
g1 = h._geometry()
|
| 535 |
+
self.assertGreater(g1['scat_path_m'], g0['scat_path_m'])
|
| 536 |
+
self.assertLess(g1['t_total'], g0['t_total'])
|
| 537 |
+
h.invoke('stage.move', y_m=5e-3, z_m=0.0)
|
| 538 |
+
h.step(6.0)
|
| 539 |
+
self.assertEqual(h._geometry()['pos'], 'between')
|
| 540 |
+
h.invoke('stage.auto_align')
|
| 541 |
+
h.step(rt.ALIGN_S + 1.0)
|
| 542 |
+
op = [o for o in h.operations.values() if o['kind'] == 'align'][-1]
|
| 543 |
+
self.assertEqual(op.get('reason'), 'NO_CAPILLARY_FOUND')
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
class ScatteringPhysics(unittest.TestCase):
|
| 547 |
+
def test_water_scale_reproduces_the_nist_glassy_carbon(self):
|
| 548 |
+
"""Absolute scale from water (compressibility) applied to a measured SRM 3600 coupon reproduces the certified curve (line collimation, desmeared)."""
|
| 549 |
+
h = calibrated(seed=2)
|
| 550 |
+
cal = water_calibration(h)
|
| 551 |
+
solid(h, 'gc', GC, 1.055e-3)
|
| 552 |
+
load(h, 'gc', holder='solid_holder')
|
| 553 |
+
rg = acquire(h, 300.0)
|
| 554 |
+
empty_beam(h)
|
| 555 |
+
rb = acquire(h, 300.0)
|
| 556 |
+
red = h.invoke('data.reduce', record_id=rg, background_record_id=rb, calibration_id=cal, thickness_m=1.055e-3, desmear=True)
|
| 557 |
+
q, i, s = reduced_arrays(red)
|
| 558 |
+
t = rt.template(GC)
|
| 559 |
+
m = (q > 0.1) & (q < 2.0)
|
| 560 |
+
ratio = i[m] / rt.srm3600_cm(t, q[m])
|
| 561 |
+
self.assertAlmostEqual(float(np.median(ratio)), 1.0, delta=0.08)
|
| 562 |
+
CHECKS.append(dict(id='water_scale_vs_srm3600', status='passed', median_ratio=float(np.median(ratio))))
|
| 563 |
+
|
| 564 |
+
def test_lysozyme_rg_and_molecular_weight(self):
|
| 565 |
+
h = calibrated(seed=3)
|
| 566 |
+
cal = water_calibration(h)
|
| 567 |
+
liquid(h, 'buf')
|
| 568 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 569 |
+
load(h, 'buf', temp=283.15)
|
| 570 |
+
rb = acquire(h, 900.0)
|
| 571 |
+
load(h, 'lys', temp=283.15)
|
| 572 |
+
rl = acquire(h, 900.0)
|
| 573 |
+
red = h.invoke('data.reduce', record_id=rl, background_record_id=rb, calibration_id=cal, thickness_m=1e-3, desmear=True)
|
| 574 |
+
g = h.invoke('analysis.guinier', reduced_id=red['reduced_id'], qrg_max=1.3)
|
| 575 |
+
rg_true = rt.template(LYS)['rg_template_nm'] * 1e-9
|
| 576 |
+
self.assertAlmostEqual(g['rg_m'], rg_true, delta=max(3 * g['rg_sigma_m'], 0.06 * rg_true))
|
| 577 |
+
mw = h.invoke('analysis.molecular_weight', reduced_id=red['reduced_id'], concentration_kg_m3=5.0, drho_m_m_kg=rt.DRHO_M_PROTEIN_M_KG)
|
| 578 |
+
self.assertAlmostEqual(mw['molecular_weight_kg_mol'], 14.3, delta=0.15 * 14.3)
|
| 579 |
+
smeared = h.invoke('data.reduce', record_id=rl, background_record_id=rb, calibration_id=cal, thickness_m=1e-3, desmear=False)
|
| 580 |
+
g2 = h.invoke('analysis.guinier', reduced_id=smeared['reduced_id'], qrg_max=1.3)
|
| 581 |
+
self.assertLess(g2['i0'], 0.85 * g['i0']) # line-collimation data must be desmeared for I(0)
|
| 582 |
+
CHECKS.append(dict(id='lysozyme_rg_mw', status='passed', rg_nm=g['rg_m'] * 1e9, mw_kda=mw['molecular_weight_kg_mol']))
|
| 583 |
+
|
| 584 |
+
def test_concentration_effect_and_template_scale(self):
|
| 585 |
+
t = rt.template(BSA)
|
| 586 |
+
q = np.array([0.02, 0.1, 0.3])
|
| 587 |
+
lo = rt.component_cm(dict(kind='curve', template_id=BSA, concentration_mg_ml=2.0), q, 293.15, 0.0) / 2.0
|
| 588 |
+
hi = rt.component_cm(dict(kind='curve', template_id=BSA, concentration_mg_ml=50.0), q, 293.15, 0.0) / 50.0
|
| 589 |
+
self.assertLess(hi[0], 0.8 * lo[0]) # repulsive structure factor lowers I(0)/c at 50 mg/mL
|
| 590 |
+
self.assertAlmostEqual(lo[0] / t['_i0c'], 1.0, delta=0.02)
|
| 591 |
+
self.assertAlmostEqual(t['_i0c'] / (t['abs_scale']['mass_da'] * 1e-3), 0.00080, delta=0.00008) # I(0)/c per kDa of a protein
|
| 592 |
+
|
| 593 |
+
def test_silver_behenate_orders_and_q_calibration(self):
|
| 594 |
+
h = calibrated(seed=6, collimation='point')
|
| 595 |
+
self.assertAlmostEqual(h.sdd_cal, h.sdd_true, delta=0.002 * h.sdd_true)
|
| 596 |
+
self.assertAlmostEqual(h.zero_cal, h.zero_true, delta=2.5e-5)
|
| 597 |
+
red = h.invoke('data.reduce', record_id='sx-1', background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False)
|
| 598 |
+
peaks = [p['q_per_m'] * 1e-9 for p in h.invoke('analysis.peaks', reduced_id=red['reduced_id'])['peaks']]
|
| 599 |
+
for n in (1, 2, 3):
|
| 600 |
+
qn = 2 * math.pi * n / 5.838
|
| 601 |
+
self.assertTrue(any(abs(p - qn) < 0.01 * qn + 0.02 for p in peaks), (n, peaks))
|
| 602 |
+
|
| 603 |
+
def test_silicon_111_ka_doublet_in_waxs(self):
|
| 604 |
+
h = ready(seed=7)
|
| 605 |
+
h.invoke('collimation.set_mode', mode='point')
|
| 606 |
+
solid(h, 'si', 'silicon_powder', 0.3e-3, form='powder')
|
| 607 |
+
load(h, 'si', holder='paste_cell')
|
| 608 |
+
tt111 = 2 * math.asin(rt.mean_wavelength_m() / (2 * 0.3135601e-9))
|
| 609 |
+
arm = tt111 - math.atan(0.030 / rt.SDD_NOMINAL_M)
|
| 610 |
+
op = h.invoke('acquisition.swaxs_scan', arm_angles_rad=[0.0, arm], exposure_s=60.0)['operation_id']
|
| 611 |
+
h.step(200.0)
|
| 612 |
+
rec = h.records[h.operations[op]['record_id']]
|
| 613 |
+
self.assertEqual(rec['status'], 'completed')
|
| 614 |
+
seg = rec['segments'][1]
|
| 615 |
+
c = np.asarray(seg['counts'], float)
|
| 616 |
+
tt = np.asarray(seg['two_theta_rad'])
|
| 617 |
+
l1, l2, _ = rt.ka_lines()
|
| 618 |
+
t1 = 2 * math.asin(l1 / (2 * 0.3135601e-9))
|
| 619 |
+
t2 = 2 * math.asin(l2 / (2 * 0.3135601e-9))
|
| 620 |
+
j1 = int(np.argmax(np.where(np.abs(tt - t1) < math.radians(0.03), c, 0)))
|
| 621 |
+
j2 = int(np.argmax(np.where(np.abs(tt - t2) < math.radians(0.03), c, 0)))
|
| 622 |
+
mid = int((j1 + j2) / 2)
|
| 623 |
+
self.assertGreater(c[j1], c[j2]) # Ka1 : Ka2 = 2 : 1
|
| 624 |
+
self.assertLess(c[mid], 0.95 * c[j2]) # the doublet is resolved (0.07 deg apart)
|
| 625 |
+
self.assertGreater(abs(j2 - j1), 3)
|
| 626 |
+
|
| 627 |
+
def test_gold_rm8012_guinier_radius(self):
|
| 628 |
+
t = rt.template(AU30)
|
| 629 |
+
q = np.geomspace(0.02, 0.2, 200)
|
| 630 |
+
i = rt.component_cm(dict(kind='sphere_model', template_id=AU30, concentration_mg_ml=0.048), q, 293.15, 0.0)
|
| 631 |
+
m = q < 0.08
|
| 632 |
+
a, b = np.polyfit(q[m] ** 2, np.log(i[m]), 1)
|
| 633 |
+
rg = math.sqrt(-3 * a)
|
| 634 |
+
r = t['mean_diameter_nm'] / 2
|
| 635 |
+
z = 1 / t['schulz_rel_sigma'] ** 2 - 1
|
| 636 |
+
mom = lambda k: math.exp(math.lgamma(z + 1 + k) - math.lgamma(z + 1)) / (z + 1) ** k * r ** k # noqa: E731
|
| 637 |
+
rg_expected = math.sqrt(0.6 * mom(8) / mom(6))
|
| 638 |
+
self.assertAlmostEqual(rg, rg_expected, delta=0.05 * rg_expected)
|
| 639 |
+
|
| 640 |
+
def test_swaxs_reaches_60_degrees_and_the_water_halo(self):
|
| 641 |
+
h = ready(seed=8)
|
| 642 |
+
liquid(h, 'w')
|
| 643 |
+
load(h, 'w')
|
| 644 |
+
op = h.invoke('acquisition.swaxs_scan', arm_angles_rad=[0.0, 0.2, 0.4, 0.6, rt.ARM_MAX_RAD], exposure_s=60.0)['operation_id']
|
| 645 |
+
h.step(600.0)
|
| 646 |
+
rec = h.records[h.operations[op]['record_id']]
|
| 647 |
+
self.assertEqual(rec['status'], 'completed')
|
| 648 |
+
tt_max = max(max(s['two_theta_rad']) for s in rec['segments'])
|
| 649 |
+
q_max = max(max(s['q_per_m']) for s in rec['segments'])
|
| 650 |
+
self.assertAlmostEqual(math.degrees(tt_max), 60.0, delta=0.6)
|
| 651 |
+
self.assertGreater(q_max, 40.0e9)
|
| 652 |
+
red = h.invoke('data.reduce', record_id=rec['record_id'], background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False)
|
| 653 |
+
q, i, _ = reduced_arrays(red)
|
| 654 |
+
self.assertGreater(np.interp(20.0, q, i), 1.8 * np.interp(8.0, q, i)) # water structure peak near 20 nm^-1
|
| 655 |
+
|
| 656 |
+
def test_q_min_and_resolution(self):
|
| 657 |
+
h = calibrated(seed=9)
|
| 658 |
+
liquid(h, 'w')
|
| 659 |
+
load(h, 'w')
|
| 660 |
+
r = acquire(h, 60.0)
|
| 661 |
+
red = h.invoke('data.reduce', record_id=r, background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False)
|
| 662 |
+
self.assertLess(red['q_min_valid_per_m'], 0.035e9)
|
| 663 |
+
self.assertGreater(red['q_min_valid_per_m'], 0.015e9)
|
| 664 |
+
|
| 665 |
+
|
| 666 |
+
class FaultsAndStates(unittest.TestCase):
|
| 667 |
+
def test_vacuum_leak_keeps_the_path_above_3_mbar(self):
|
| 668 |
+
h = ready()
|
| 669 |
+
h.invoke('fault.inject', fault='vacuum_leak', active=True)
|
| 670 |
+
liquid(h, 'w')
|
| 671 |
+
load(h, 'w', align=False, pump_s=600.0)
|
| 672 |
+
self.assertFalse(h.read()['vacuum.ready'])
|
| 673 |
+
rejected(h, 'acquisition.start', 'VACUUM_NOT_READY', exposure_s=10.0, frames=1)
|
| 674 |
+
|
| 675 |
+
def test_aged_tube_and_misaligned_beamstop(self):
|
| 676 |
+
h = ready(seed=2)
|
| 677 |
+
liquid(h, 'w')
|
| 678 |
+
load(h, 'w')
|
| 679 |
+
p0 = h.records[acquire(h, 30.0)]['primary_beam_counts']
|
| 680 |
+
h.invoke('fault.inject', fault='tube_aged', active=True)
|
| 681 |
+
p1 = h.records[acquire(h, 30.0)]['primary_beam_counts']
|
| 682 |
+
self.assertAlmostEqual(p1 / p0, 0.6, delta=0.02)
|
| 683 |
+
h.invoke('fault.inject', fault='beamstop_misaligned', active=True)
|
| 684 |
+
op = h.invoke('acquisition.start', exposure_s=30.0, frames=1)['operation_id']
|
| 685 |
+
rec = h.records[h.operations[op]['record_id']]
|
| 686 |
+
self.assertEqual((rec['status'], rec['error_code']), ('failed', 'DETECTOR_OVEREXPOSURE'))
|
| 687 |
+
self.assertFalse(h.read()['shutter.open'])
|
| 688 |
+
|
| 689 |
+
def test_capillary_bubble_lowers_the_signal(self):
|
| 690 |
+
h = ready(seed=2)
|
| 691 |
+
liquid(h, 'w')
|
| 692 |
+
load(h, 'w')
|
| 693 |
+
g0 = h._geometry()
|
| 694 |
+
h.invoke('fault.inject', fault='capillary_bubble', active=True)
|
| 695 |
+
g1 = h._geometry()
|
| 696 |
+
self.assertLess(g1['scat_path_m'], 0.8 * g0['scat_path_m']) # path x transmission: 0.4 d exp(-0.4 mu d) against d exp(-mu d)
|
| 697 |
+
self.assertGreater(g1['t_total'], g0['t_total'])
|
| 698 |
+
|
| 699 |
+
def test_freezing_boiling_burst_and_aggregation(self):
|
| 700 |
+
h = ready(seed=3)
|
| 701 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 702 |
+
load(h, 'lys', temp=258.15, pump_s=300.0)
|
| 703 |
+
self.assertTrue(h.content['frozen'])
|
| 704 |
+
h.invoke('stage.set_temperature', temperature_k=343.15)
|
| 705 |
+
h.step(700.0)
|
| 706 |
+
self.assertFalse(h.content['frozen'])
|
| 707 |
+
a = h.content['agg'][LYS]
|
| 708 |
+
self.assertGreater(a, 0.1)
|
| 709 |
+
led0 = h.ledger()
|
| 710 |
+
h.invoke('stage.set_temperature', temperature_k=373.15)
|
| 711 |
+
h.step(400.0)
|
| 712 |
+
r = h.read('evaluator')
|
| 713 |
+
self.assertTrue(r['holder.broken'])
|
| 714 |
+
self.assertEqual(r['system.error_code'], 'SAMPLE_BURST')
|
| 715 |
+
led = h.ledger()
|
| 716 |
+
self.assertAlmostEqual(led['liquid_residual_m3'], 0.0, delta=1e-18)
|
| 717 |
+
self.assertAlmostEqual(led['solute_residual_kg'], 0.0, delta=1e-18)
|
| 718 |
+
self.assertGreater(led['liquid_waste_m3'], led0['liquid_waste_m3'])
|
| 719 |
+
rejected(h, 'system.acknowledge', 'HOLDER_BROKEN')
|
| 720 |
+
|
| 721 |
+
def test_aggregation_raises_the_apparent_rg(self):
|
| 722 |
+
q = np.geomspace(0.02, 0.5, 100)
|
| 723 |
+
base = dict(kind='curve', template_id=LYS, concentration_mg_ml=5.0)
|
| 724 |
+
i0 = rt.component_cm(dict(base, aggregated_fraction=0.0), q, 293.15, 0.0)
|
| 725 |
+
i1 = rt.component_cm(dict(base, aggregated_fraction=0.2), q, 293.15, 0.0)
|
| 726 |
+
self.assertGreater(i1[0], 5 * i0[0])
|
| 727 |
+
|
| 728 |
+
|
| 729 |
+
class Autosampler(unittest.TestCase):
|
| 730 |
+
def test_injection_carry_over_cleaning_and_conservation(self):
|
| 731 |
+
h = ready(seed=2)
|
| 732 |
+
liquid(h, 'bsa', [(BSA, 10.0)], volume=200e-9)
|
| 733 |
+
liquid(h, 'buf', volume=300e-9)
|
| 734 |
+
rejected(h, 'asx.load_well', 'ASX_DOOR_CLOSED', sample_id='bsa', well='AA01', volume_m3=100e-9)
|
| 735 |
+
h.invoke('asx.set_door', open=True)
|
| 736 |
+
h.invoke('asx.load_well', sample_id='bsa', well='AA01', volume_m3=100e-9)
|
| 737 |
+
h.invoke('asx.load_well', sample_id='buf', well='AA02', volume_m3=100e-9)
|
| 738 |
+
rejected(h, 'asx.inject', 'ASX_DOOR_OPEN', well='AA01')
|
| 739 |
+
h.invoke('asx.set_door', open=False)
|
| 740 |
+
h.invoke('asx.inject', well='AA01')
|
| 741 |
+
self.assertEqual(h.read()['asx.busy'], 'inject')
|
| 742 |
+
h.step(60.0)
|
| 743 |
+
self.assertIsNone(h.read()['asx.busy'])
|
| 744 |
+
self.assertAlmostEqual(h.flow_cell['conc'][BSA], 10.0, places=9)
|
| 745 |
+
h.invoke('asx.inject', well='AA02')
|
| 746 |
+
h.step(60.0)
|
| 747 |
+
self.assertAlmostEqual(h.flow_cell['conc'][BSA], 10.0 * rt.ASX_CARRY_OVER, places=9)
|
| 748 |
+
h.invoke('asx.clean')
|
| 749 |
+
h.step(150.0)
|
| 750 |
+
self.assertEqual(h.read()['asx.flow_cell_state'], 'rinsed')
|
| 751 |
+
h.invoke('asx.inject', well='AA02')
|
| 752 |
+
h.step(60.0)
|
| 753 |
+
self.assertAlmostEqual(h.flow_cell['conc'][BSA], 10.0 * rt.ASX_CARRY_OVER * rt.ASX_CARRY_OVER_CLEAN, delta=1e-12)
|
| 754 |
+
led = h.ledger()
|
| 755 |
+
self.assertAlmostEqual(led['liquid_residual_m3'], 0.0, delta=1e-18)
|
| 756 |
+
self.assertAlmostEqual(led['solute_residual_kg'], 0.0, delta=1e-18)
|
| 757 |
+
|
| 758 |
+
def test_flow_cell_measurement_and_cancel(self):
|
| 759 |
+
h = ready(seed=2)
|
| 760 |
+
liquid(h, 'bsa', [(BSA, 10.0)], volume=200e-9)
|
| 761 |
+
h.invoke('asx.set_door', open=True)
|
| 762 |
+
h.invoke('asx.load_well', sample_id='bsa', well='BA01', volume_m3=100e-9)
|
| 763 |
+
h.invoke('asx.set_door', open=False)
|
| 764 |
+
h.register_principal('e', 'evaluator')
|
| 765 |
+
s = h.session('e')
|
| 766 |
+
op = s.invoke(instance_id=h.instance_id, capability_id='asx.inject', arguments=dict(well='BA01'), request_id='i1')['operation_id']
|
| 767 |
+
h.step(12.0)
|
| 768 |
+
s.cancel(op, 'c1')
|
| 769 |
+
self.assertEqual(h.operations[op]['phase'], 'cancelled')
|
| 770 |
+
led = h.ledger()
|
| 771 |
+
self.assertAlmostEqual(led['liquid_residual_m3'], 0.0, delta=1e-18)
|
| 772 |
+
h.invoke('asx.inject', well='BA01')
|
| 773 |
+
h.step(60.0)
|
| 774 |
+
h.invoke('stage.select_position', position='flow_cell')
|
| 775 |
+
h.step(10.0)
|
| 776 |
+
self.assertEqual(h._beam_content()[0], 'flow_cell')
|
| 777 |
+
h.invoke('vacuum.set_pump', on=True)
|
| 778 |
+
h.step(220.0)
|
| 779 |
+
r = h.records[acquire(h, 60.0)]
|
| 780 |
+
self.assertEqual(r['sample_label'], 'BA01')
|
| 781 |
+
self.assertEqual(r['sample_position'], 'flow_cell')
|
| 782 |
+
|
| 783 |
+
|
| 784 |
+
class LedgersIsolationSessions(unittest.TestCase):
|
| 785 |
+
def test_photon_ledger_closes_and_scattering_comes_from_attenuation(self):
|
| 786 |
+
h = ready(seed=2)
|
| 787 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 788 |
+
load(h, 'lys')
|
| 789 |
+
acquire(h, 120.0)
|
| 790 |
+
led = h.ledger()
|
| 791 |
+
self.assertAlmostEqual(led['photons_residual'], 0.0, delta=1e-6 * led['photons_incident'])
|
| 792 |
+
self.assertLess(led['photons_scattered_detected'], led['photons_attenuated_sample'] + led['photons_attenuated_windows'] + led['photons_attenuated_air'])
|
| 793 |
+
self.assertAlmostEqual(led['tube_on_time_s'], h.time_s - 61.0, delta=1e-6)
|
| 794 |
+
self.assertGreater(led['tube_energy_j'], 0.9 * 40000.0 * 0.05 * (h.time_s - 61.0 - 20.0))
|
| 795 |
+
|
| 796 |
+
def test_two_instances_are_isolated(self):
|
| 797 |
+
a, b = ready(seed=1), ready(seed=1)
|
| 798 |
+
a.invoke('detector.move_arm', angle_rad=0.3)
|
| 799 |
+
a.step(10.0)
|
| 800 |
+
self.assertEqual(b.arm, 0.0)
|
| 801 |
+
self.assertNotEqual(a.arm, b.arm)
|
| 802 |
+
|
| 803 |
+
def test_agent_does_not_see_truth(self):
|
| 804 |
+
h = ready()
|
| 805 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 806 |
+
load(h, 'lys')
|
| 807 |
+
rid = acquire(h, 30.0)
|
| 808 |
+
h.register_principal('a', 'agent')
|
| 809 |
+
s = h.session('a')
|
| 810 |
+
obs = s.read(instance_id=h.instance_id)['observations']
|
| 811 |
+
self.assertFalse([k for k in obs if k.startswith('truth.')])
|
| 812 |
+
r = s.invoke(instance_id=h.instance_id, capability_id='acquisition.result', arguments=dict(record_id=rid), request_id='r1')
|
| 813 |
+
text = json.dumps(r)
|
| 814 |
+
self.assertNotIn('lysozyme', text.lower())
|
| 815 |
+
self.assertNotIn(LYS, text)
|
| 816 |
+
r = s.invoke(instance_id=h.instance_id, capability_id='provenance.read', arguments={}, request_id='r2')
|
| 817 |
+
self.assertEqual(r['error']['code'], 'ACCESS_DENIED')
|
| 818 |
+
d = s.describe(instance_id=h.instance_id)
|
| 819 |
+
self.assertFalse([k for k in d['state_slots'] if k.startswith('truth.')])
|
| 820 |
+
|
| 821 |
+
def test_records_and_control_belong_to_their_agent(self):
|
| 822 |
+
h = ready()
|
| 823 |
+
liquid(h, 'w')
|
| 824 |
+
load(h, 'w')
|
| 825 |
+
for p in ('a', 'b'):
|
| 826 |
+
h.register_principal(p, 'agent')
|
| 827 |
+
sa, sb = h.session('a'), h.session('b')
|
| 828 |
+
r = sa.invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments=dict(exposure_s=30.0, frames=1), request_id='x1')
|
| 829 |
+
self.assertEqual(r['status'], 'accepted')
|
| 830 |
+
rb = sb.invoke(instance_id=h.instance_id, capability_id='detector.move_arm', arguments=dict(angle_rad=0.2), request_id='y1')
|
| 831 |
+
self.assertEqual(rb['error']['code'], 'ACCESS_DENIED')
|
| 832 |
+
self.assertTrue(sb.read(instance_id=h.instance_id)['observations']['acquisition.started_by_other_agent']['value'])
|
| 833 |
+
h.step(40.0)
|
| 834 |
+
rid = h.operations[r['operation_id']]['record_id']
|
| 835 |
+
self.assertEqual(sb.invoke(instance_id=h.instance_id, capability_id='acquisition.result', arguments=dict(record_id=rid), request_id='y2')['error']['code'],
|
| 836 |
+
'ACCESS_DENIED')
|
| 837 |
+
self.assertEqual(sb.invoke(instance_id=h.instance_id, capability_id='data.reduce', arguments=dict(record_id=rid, background_record_id=None, calibration_id=None,
|
| 838 |
+
thickness_m=1e-3, desmear=False), request_id='y3')['error']['code'],
|
| 839 |
+
'ACCESS_DENIED')
|
| 840 |
+
self.assertEqual(sa.read(instance_id=h.instance_id)['observations']['result.last_record_id']['value'], rid)
|
| 841 |
+
again = sa.invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments=dict(exposure_s=30.0, frames=1), request_id='x1')
|
| 842 |
+
self.assertEqual(again['operation_id'], r['operation_id'])
|
| 843 |
+
conflict = sa.invoke(instance_id=h.instance_id, capability_id='acquisition.start', arguments=dict(exposure_s=31.0, frames=1), request_id='x1')
|
| 844 |
+
self.assertEqual(conflict['error']['code'], 'REQUEST_CONFLICT')
|
| 845 |
+
|
| 846 |
+
def test_cancel_keeps_finished_segments_and_power_off_fails(self):
|
| 847 |
+
h = ready()
|
| 848 |
+
liquid(h, 'w')
|
| 849 |
+
load(h, 'w')
|
| 850 |
+
h.register_principal('a', 'agent')
|
| 851 |
+
s = h.session('a')
|
| 852 |
+
r = s.invoke(instance_id=h.instance_id, capability_id='acquisition.swaxs_scan', arguments=dict(arm_angles_rad=[0.0, 0.4], exposure_s=30.0), request_id='s1')
|
| 853 |
+
h.step(45.0)
|
| 854 |
+
s.cancel(r['operation_id'], 'c1')
|
| 855 |
+
rec = h.records[h.operations[r['operation_id']]['record_id']]
|
| 856 |
+
self.assertEqual((rec['status'], rec['error_code'], len(rec['segments'])), ('cancelled', 'USER_CANCEL', 1))
|
| 857 |
+
self.assertEqual(h.arm_target, h.arm)
|
| 858 |
+
op = h.invoke('acquisition.start', exposure_s=60.0, frames=1)
|
| 859 |
+
h.step(5.0)
|
| 860 |
+
h.invoke('power.set', enabled=False)
|
| 861 |
+
rec = h.records[h.operations[op['operation_id']]['record_id']]
|
| 862 |
+
self.assertEqual((rec['status'], rec['error_code']), ('failed', 'POWER_OFF'))
|
| 863 |
+
led = h.ledger()
|
| 864 |
+
self.assertAlmostEqual(led['photons_residual'], 0.0, delta=1e-6 * led['photons_incident'])
|
| 865 |
+
|
| 866 |
+
def test_tray_well_xray_off_result_and_ledger_calls(self):
|
| 867 |
+
"""Capabilities otherwise reached only through helpers: tray temperature, well removal (liquid to waste), X-RAY OFF, data.result and
|
| 868 |
+
ledger.read, each through invoke with its declared output."""
|
| 869 |
+
h = ready(seed=11)
|
| 870 |
+
liquid(h, 'w', volume=300e-9)
|
| 871 |
+
h.invoke('asx.set_tray_temperature', temperature_k=277.15)
|
| 872 |
+
h.step(1500.0)
|
| 873 |
+
self.assertAlmostEqual(h.read('evaluator')['truth.tray_temperature_k'], 277.15, delta=0.2)
|
| 874 |
+
h.invoke('asx.set_door', open=True)
|
| 875 |
+
h.invoke('asx.load_well', sample_id='w', well='AB03', volume_m3=100e-9)
|
| 876 |
+
waste0 = h.invoke('ledger.read')['liquid_waste_m3']
|
| 877 |
+
h.invoke('asx.unload_well', well='AB03')
|
| 878 |
+
led = h.invoke('ledger.read')
|
| 879 |
+
self.assertAlmostEqual(led['liquid_waste_m3'] - waste0, 100e-9, delta=1e-15)
|
| 880 |
+
self.assertLessEqual(abs(led['liquid_residual_m3']), 1e-18)
|
| 881 |
+
self.assertEqual(h.read('evaluator')['asx.wells'], {})
|
| 882 |
+
h.invoke('asx.set_door', open=False)
|
| 883 |
+
load(h, 'w')
|
| 884 |
+
rid = acquire(h, 30.0)
|
| 885 |
+
red = h.invoke('data.reduce', record_id=rid, background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False)
|
| 886 |
+
again = h.invoke('data.result', reduced_id=red['reduced_id'])
|
| 887 |
+
self.assertEqual(again, red)
|
| 888 |
+
h.invoke('generator.xray_off')
|
| 889 |
+
v = h.read('evaluator')
|
| 890 |
+
self.assertFalse(v['generator.xray_on'])
|
| 891 |
+
self.assertEqual(v['truth.voltage_v'], 0.0)
|
| 892 |
+
self.assertFalse(v['panel.warning_lamp'])
|
| 893 |
+
|
| 894 |
+
def test_queries_and_bookkeeping(self):
|
| 895 |
+
h = ready()
|
| 896 |
+
self.assertEqual(h.invoke('records.list'), dict(records=[], reduced=[], calibrations=[]))
|
| 897 |
+
ev = h.invoke('events.read', since_s=0.0)
|
| 898 |
+
self.assertTrue(any(e['code'] == 'SOFTWARE_READY' for e in ev['events']))
|
| 899 |
+
self.assertEqual(h.invoke('provenance.read')['templates'], [])
|
| 900 |
+
self.assertEqual(h.invoke('sim.step', dt_s=1.0)['time_s'], h.time_s)
|
| 901 |
+
|
| 902 |
+
|
| 903 |
+
# ---------------------------------------------------------------- declared effects (scenario states for the effect discovery)
|
| 904 |
+
def _scenario(name):
|
| 905 |
+
if name == 'fresh':
|
| 906 |
+
return rt.AntonpaarSaxspaceRuntime()
|
| 907 |
+
if name == 'off':
|
| 908 |
+
h = configured()
|
| 909 |
+
liquid(h, 'w')
|
| 910 |
+
return h
|
| 911 |
+
if name == 'booting':
|
| 912 |
+
h = configured()
|
| 913 |
+
h.invoke('power.set', enabled=True)
|
| 914 |
+
h.step(10.0)
|
| 915 |
+
liquid(h, 'w')
|
| 916 |
+
return h
|
| 917 |
+
if name == 'ready':
|
| 918 |
+
h = ready(xray=False)
|
| 919 |
+
liquid(h, 'w')
|
| 920 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 921 |
+
return h
|
| 922 |
+
if name == 'xray_ramping':
|
| 923 |
+
h = ready(xray=False)
|
| 924 |
+
liquid(h, 'w')
|
| 925 |
+
h.invoke('generator.xray_on')
|
| 926 |
+
h.step(3.0)
|
| 927 |
+
return h
|
| 928 |
+
if name == 'door_open_loaded':
|
| 929 |
+
h = ready()
|
| 930 |
+
liquid(h, 'w')
|
| 931 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 932 |
+
solid(h, 'gc', GC, 1.055e-3)
|
| 933 |
+
h.invoke('chamber.set_door', open=True)
|
| 934 |
+
h.invoke('sample.load', sample_id='w', holder='capillary_1mm')
|
| 935 |
+
return h
|
| 936 |
+
if name == 'pumping':
|
| 937 |
+
h = ready()
|
| 938 |
+
liquid(h, 'w')
|
| 939 |
+
h.invoke('chamber.set_door', open=True)
|
| 940 |
+
h.invoke('sample.load', sample_id='w', holder='capillary_1mm')
|
| 941 |
+
h.invoke('chamber.set_door', open=False)
|
| 942 |
+
h.invoke('vacuum.set_pump', on=True)
|
| 943 |
+
h.step(20.0)
|
| 944 |
+
return h
|
| 945 |
+
if name == 'loaded_vacuum':
|
| 946 |
+
h = ready()
|
| 947 |
+
liquid(h, 'w')
|
| 948 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 949 |
+
load(h, 'lys', temp=283.15)
|
| 950 |
+
acquire(h, 5.0)
|
| 951 |
+
return h
|
| 952 |
+
if name == 'measuring':
|
| 953 |
+
h = _scenario('loaded_vacuum')
|
| 954 |
+
h.invoke('acquisition.start', exposure_s=60.0, frames=1)
|
| 955 |
+
h.step(2.3)
|
| 956 |
+
return h
|
| 957 |
+
if name == 'scanning':
|
| 958 |
+
h = _scenario('loaded_vacuum')
|
| 959 |
+
h.invoke('acquisition.swaxs_scan', arm_angles_rad=[0.0, 0.3], exposure_s=4.0)
|
| 960 |
+
h.step(5.5)
|
| 961 |
+
return h
|
| 962 |
+
if name == 'aligning':
|
| 963 |
+
h = ready()
|
| 964 |
+
liquid(h, 'w')
|
| 965 |
+
load(h, 'w', align=False)
|
| 966 |
+
h.invoke('stage.auto_align')
|
| 967 |
+
h.step(3.0)
|
| 968 |
+
return h
|
| 969 |
+
if name == 'asx_loaded':
|
| 970 |
+
h = ready()
|
| 971 |
+
liquid(h, 'w')
|
| 972 |
+
liquid(h, 'bsa', [(BSA, 10.0)])
|
| 973 |
+
h.invoke('asx.set_door', open=True)
|
| 974 |
+
h.invoke('asx.load_well', sample_id='bsa', well='AA01', volume_m3=100e-9)
|
| 975 |
+
h.invoke('asx.load_well', sample_id='w', well='AA02', volume_m3=100e-9)
|
| 976 |
+
h.invoke('asx.set_door', open=False)
|
| 977 |
+
h.invoke('asx.inject', well='AA01')
|
| 978 |
+
h.step(60.0)
|
| 979 |
+
return h
|
| 980 |
+
if name == 'asx_injecting':
|
| 981 |
+
h = _scenario('asx_loaded')
|
| 982 |
+
h.invoke('asx.inject', well='AA02')
|
| 983 |
+
h.step(7.5)
|
| 984 |
+
return h
|
| 985 |
+
if name == 'estop':
|
| 986 |
+
h = ready()
|
| 987 |
+
liquid(h, 'w')
|
| 988 |
+
h.invoke('generator.emergency_stop')
|
| 989 |
+
return h
|
| 990 |
+
if name == 'cooling_fault':
|
| 991 |
+
h = ready()
|
| 992 |
+
h.invoke('fault.inject', fault='chiller_failure', active=True)
|
| 993 |
+
h.step(1.0)
|
| 994 |
+
return h
|
| 995 |
+
if name == 'hot_protein':
|
| 996 |
+
h = ready()
|
| 997 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 998 |
+
load(h, 'lys', temp=353.15, pump_s=500.0)
|
| 999 |
+
return h
|
| 1000 |
+
if name == 'burst':
|
| 1001 |
+
h = _scenario('hot_protein')
|
| 1002 |
+
h.invoke('stage.set_temperature', temperature_k=378.15)
|
| 1003 |
+
h.step(300.0)
|
| 1004 |
+
return h
|
| 1005 |
+
if name == 'burst_cleared':
|
| 1006 |
+
h = _scenario('burst')
|
| 1007 |
+
h.invoke('vacuum.set_pump', on=False)
|
| 1008 |
+
h.step(700.0)
|
| 1009 |
+
h.invoke('chamber.set_door', open=True)
|
| 1010 |
+
h.invoke('sample.unload')
|
| 1011 |
+
h.invoke('system.acknowledge')
|
| 1012 |
+
h.invoke('stage.set_temperature', temperature_k=295.15)
|
| 1013 |
+
return h
|
| 1014 |
+
if name == 'door_open_empty':
|
| 1015 |
+
h = ready()
|
| 1016 |
+
liquid(h, 'w')
|
| 1017 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 1018 |
+
solid(h, 'gc', GC, 1.055e-3)
|
| 1019 |
+
h.invoke('chamber.set_door', open=True)
|
| 1020 |
+
return h
|
| 1021 |
+
if name == 'asx_door_open':
|
| 1022 |
+
h = ready()
|
| 1023 |
+
liquid(h, 'w')
|
| 1024 |
+
h.invoke('asx.set_door', open=True)
|
| 1025 |
+
h.invoke('asx.load_well', sample_id='w', well='AA02', volume_m3=100e-9)
|
| 1026 |
+
return h
|
| 1027 |
+
if name == 'estop_released':
|
| 1028 |
+
h = ready()
|
| 1029 |
+
h.invoke('generator.emergency_stop')
|
| 1030 |
+
h.invoke('generator.release_emergency_stop')
|
| 1031 |
+
return h
|
| 1032 |
+
if name == 'measuring_air':
|
| 1033 |
+
h = ready()
|
| 1034 |
+
liquid(h, 'lys', [(LYS, 5.0)])
|
| 1035 |
+
h.invoke('chamber.set_door', open=True)
|
| 1036 |
+
h.invoke('sample.load', sample_id='lys', holder='capillary_1mm')
|
| 1037 |
+
h.invoke('chamber.set_door', open=False)
|
| 1038 |
+
h.invoke('acquisition.start', exposure_s=60.0, frames=1)
|
| 1039 |
+
h.step(10.0)
|
| 1040 |
+
return h
|
| 1041 |
+
if name == 'door_open_pump_on':
|
| 1042 |
+
h = configured()
|
| 1043 |
+
h.invoke('power.set', enabled=True)
|
| 1044 |
+
h.step(65.0)
|
| 1045 |
+
h.invoke('vacuum.set_pump', on=True)
|
| 1046 |
+
h.invoke('power.set', enabled=False)
|
| 1047 |
+
h.invoke('chamber.set_door', open=True)
|
| 1048 |
+
h.invoke('power.set', enabled=True)
|
| 1049 |
+
h.step(65.0)
|
| 1050 |
+
return h
|
| 1051 |
+
if name == 'extended_hot_setpoint':
|
| 1052 |
+
h = ready()
|
| 1053 |
+
h.invoke('chamber.set_door', open=True)
|
| 1054 |
+
h.invoke('stage.mount', stage_type='tcstage_extended')
|
| 1055 |
+
h.invoke('stage.set_temperature', temperature_k=873.15)
|
| 1056 |
+
return h
|
| 1057 |
+
if name == 'vented_closed':
|
| 1058 |
+
h = ready()
|
| 1059 |
+
liquid(h, 'w')
|
| 1060 |
+
load(h, 'w', align=False)
|
| 1061 |
+
h.invoke('vacuum.set_pump', on=False)
|
| 1062 |
+
h.step(80.0)
|
| 1063 |
+
return h
|
| 1064 |
+
if name == 'solid_open':
|
| 1065 |
+
h = ready()
|
| 1066 |
+
solid(h, 'gc', GC, 1.055e-3)
|
| 1067 |
+
h.invoke('chamber.set_door', open=True)
|
| 1068 |
+
h.invoke('sample.load', sample_id='gc', holder='solid_holder')
|
| 1069 |
+
return h
|
| 1070 |
+
if name == 'burst_open':
|
| 1071 |
+
h = _scenario('burst')
|
| 1072 |
+
h.invoke('vacuum.set_pump', on=False)
|
| 1073 |
+
h.step(700.0)
|
| 1074 |
+
h.invoke('chamber.set_door', open=True)
|
| 1075 |
+
return h
|
| 1076 |
+
if name == 'burst_unloaded':
|
| 1077 |
+
h = _scenario('burst_open')
|
| 1078 |
+
h.invoke('sample.unload')
|
| 1079 |
+
return h
|
| 1080 |
+
if name == 'mains_fault_restored':
|
| 1081 |
+
h = ready()
|
| 1082 |
+
h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE, mains_voltage_v=180.0))
|
| 1083 |
+
h.invoke('plant.configure', **dict(rt.PLANT_EXAMPLE))
|
| 1084 |
+
return h
|
| 1085 |
+
if name == 'cooling_fault_cleared':
|
| 1086 |
+
h = _scenario('cooling_fault')
|
| 1087 |
+
h.invoke('fault.inject', fault='chiller_failure', active=False)
|
| 1088 |
+
return h
|
| 1089 |
+
if name == 'faults_measuring':
|
| 1090 |
+
h = ready()
|
| 1091 |
+
liquid(h, 'w')
|
| 1092 |
+
load(h, 'w')
|
| 1093 |
+
for f in ('vacuum_leak', 'tube_aged', 'capillary_bubble'):
|
| 1094 |
+
h.invoke('fault.inject', fault=f, active=True)
|
| 1095 |
+
h.invoke('acquisition.start', exposure_s=60.0, frames=1)
|
| 1096 |
+
h.step(5.0)
|
| 1097 |
+
return h
|
| 1098 |
+
if name == 'estop_unpowered':
|
| 1099 |
+
h = configured()
|
| 1100 |
+
h.invoke('generator.emergency_stop')
|
| 1101 |
+
return h
|
| 1102 |
+
if name == 'agbe_measured':
|
| 1103 |
+
h = ready()
|
| 1104 |
+
solid(h, 'agbe', 'silver_behenate', 1e-3, form='powder')
|
| 1105 |
+
load(h, 'agbe', holder='paste_cell')
|
| 1106 |
+
acquire(h, 30.0)
|
| 1107 |
+
return h
|
| 1108 |
+
raise KeyError(name)
|
| 1109 |
+
|
| 1110 |
+
|
| 1111 |
+
SCENARIOS = ['fresh', 'off', 'booting', 'ready', 'xray_ramping', 'door_open_loaded', 'door_open_empty', 'pumping', 'loaded_vacuum', 'measuring', 'scanning',
|
| 1112 |
+
'aligning', 'asx_loaded', 'asx_door_open', 'asx_injecting', 'estop', 'estop_released', 'cooling_fault', 'hot_protein', 'burst', 'burst_cleared',
|
| 1113 |
+
'agbe_measured', 'measuring_air', 'door_open_pump_on', 'extended_hot_setpoint', 'vented_closed', 'solid_open', 'burst_open', 'burst_unloaded',
|
| 1114 |
+
'mains_fault_restored', 'cooling_fault_cleared', 'faults_measuring', 'estop_unpowered']
|
| 1115 |
+
STEP_DTS = (0.4, 1.0, 3.0, 15.0, 120.0)
|
| 1116 |
+
|
| 1117 |
+
|
| 1118 |
+
def _variants(cap):
|
| 1119 |
+
V = {
|
| 1120 |
+
'plant.configure': [dict(rt.PLANT_EXAMPLE), dict(room_k=300.15, mains_voltage_v=180.0, noise_seed=2)],
|
| 1121 |
+
'sample.provide': [dict(rt.SAMPLE_EXAMPLE, sample_id='new')],
|
| 1122 |
+
'fault.inject': [dict(fault=f, active=True) for f in rt.FAULTS] + [dict(fault=f, active=False) for f in rt.FAULTS],
|
| 1123 |
+
'power.set': [dict(enabled=True), dict(enabled=False)], 'system.acknowledge': [{}],
|
| 1124 |
+
'generator.set_key': [dict(on=True), dict(on=False)], 'generator.xray_on': [{}], 'generator.xray_off': [{}], 'generator.acknowledge': [{}],
|
| 1125 |
+
'generator.emergency_stop': [{}], 'generator.release_emergency_stop': [{}],
|
| 1126 |
+
'generator.set_power': [dict(voltage_v=30000.0, current_a=0.03), dict(voltage_v=40000.0, current_a=0.05)],
|
| 1127 |
+
'vacuum.set_pump': [dict(on=True), dict(on=False)], 'chamber.set_door': [dict(open=True), dict(open=False)],
|
| 1128 |
+
'stage.mount': [dict(stage_type='tcstage_extended'), dict(stage_type='tcstage_peltier')], 'sample.load': [dict(sample_id='lys', holder='capillary_1mm'), dict(sample_id=None, holder='capillary_1mm'),
|
| 1129 |
+
dict(sample_id='gc', holder='solid_holder')],
|
| 1130 |
+
'sample.unload': [{}], 'stage.set_temperature': [dict(temperature_k=313.15), dict(temperature_k=253.15)],
|
| 1131 |
+
'stage.move': [dict(y_m=2e-3, z_m=1e-3)], 'stage.select_position': [dict(position='flow_cell'), dict(position='capillary')],
|
| 1132 |
+
'stage.auto_align': [{}], 'collimation.set_mode': [dict(mode='point'), dict(mode='line')], 'detector.move_arm': [dict(angle_rad=0.4), dict(angle_rad=0.0)],
|
| 1133 |
+
'acquisition.start': [dict(exposure_s=2.0, frames=2)], 'acquisition.swaxs_scan': [dict(arm_angles_rad=[0.0, 0.2], exposure_s=2.0)],
|
| 1134 |
+
'asx.set_door': [dict(open=True), dict(open=False)], 'asx.load_well': [dict(sample_id='w', well='AB01', volume_m3=50e-9)],
|
| 1135 |
+
'asx.unload_well': [dict(well='AA02')], 'asx.set_tray_temperature': [dict(temperature_k=277.15)], 'asx.inject': [dict(well='AA02')],
|
| 1136 |
+
'asx.clean': [{}], 'calibration.zero_angle': [dict(record_id='sx-1')], 'calibration.q_scale': [dict(record_id='sx-1', calibrant='silver_behenate')],
|
| 1137 |
+
'sim.step': [dict(dt_s=0.5), dict(dt_s=30.0)],
|
| 1138 |
+
}
|
| 1139 |
+
return V.get(cap, [])
|
| 1140 |
+
|
| 1141 |
+
|
| 1142 |
+
def _num(x):
|
| 1143 |
+
return isinstance(x, (int, float)) and not isinstance(x, bool)
|
| 1144 |
+
|
| 1145 |
+
|
| 1146 |
+
def _flat(v, prefix=''):
|
| 1147 |
+
out = {}
|
| 1148 |
+
if isinstance(v, dict):
|
| 1149 |
+
for k, x in v.items():
|
| 1150 |
+
out.update(_flat(x, f'{prefix}.{k}'))
|
| 1151 |
+
elif isinstance(v, list) and len(v) <= 64:
|
| 1152 |
+
for i, x in enumerate(v):
|
| 1153 |
+
out.update(_flat(x, f'{prefix}[{i}]'))
|
| 1154 |
+
else:
|
| 1155 |
+
out[prefix] = json.dumps(v, sort_keys=True, default=str) if isinstance(v, list) else v
|
| 1156 |
+
return out
|
| 1157 |
+
|
| 1158 |
+
|
| 1159 |
+
def _changed(a, b, scale=None):
|
| 1160 |
+
"""Relative comparison (no absolute floor)."""
|
| 1161 |
+
if _num(a) and _num(b):
|
| 1162 |
+
return abs(a - b) > 1e-9 * (max(abs(a), abs(b)) if scale is None else scale) + 1e-300
|
| 1163 |
+
return a != b
|
| 1164 |
+
|
| 1165 |
+
|
| 1166 |
+
def _step_differs(v1, a2, v0, b2):
|
| 1167 |
+
"""Does the step change the value differently with the call (v1 -> a2) than without it (v0 -> b2)? (leaf-wise, numeric increments)"""
|
| 1168 |
+
f1, fa, f0, fb = _flat(v1), _flat(a2), _flat(v0), _flat(b2)
|
| 1169 |
+
for leaf in set(f1) | set(fa) | set(f0) | set(fb):
|
| 1170 |
+
x1, xa, x0, xb = (f.get(leaf, '<absent>') for f in (f1, fa, f0, fb))
|
| 1171 |
+
ca, cb = _changed(x1, xa), _changed(x0, xb)
|
| 1172 |
+
if not (ca or cb):
|
| 1173 |
+
continue
|
| 1174 |
+
if ca and cb and all(_num(x) for x in (x1, xa, x0, xb)) and not _changed(xa - x1, xb - x0, max(abs(x1), abs(xa), abs(x0), abs(xb))):
|
| 1175 |
+
continue
|
| 1176 |
+
if ca and cb and (x1, xa) == (x0, xb):
|
| 1177 |
+
continue
|
| 1178 |
+
return True
|
| 1179 |
+
return False
|
| 1180 |
+
|
| 1181 |
+
|
| 1182 |
+
|
| 1183 |
+
class ReviewRound1Regressions(unittest.TestCase):
|
| 1184 |
+
"""Regression tests for the findings of the first independent runtime review (F01-F19)."""
|
| 1185 |
+
|
| 1186 |
+
def _session_invoke(self, h, principal, cap, args, rid):
|
| 1187 |
+
return h.session(principal).invoke(instance_id=h.instance_id, capability_id=cap, arguments=args, request_id=rid)
|
| 1188 |
+
|
| 1189 |
+
def test_f01_agent_events_hide_faults_and_the_frozen_state(self):
|
| 1190 |
+
h = ready(seed=21)
|
| 1191 |
+
h.register_principal('ag', 'agent')
|
| 1192 |
+
h.register_principal('ev', 'evaluator')
|
| 1193 |
+
h.invoke('fault.inject', fault='tube_aged', active=True)
|
| 1194 |
+
liquid(h, 's1')
|
| 1195 |
+
load(h, 's1', align=False)
|
| 1196 |
+
h.invoke('stage.set_temperature', temperature_k=253.15)
|
| 1197 |
+
h.step(900.0)
|
| 1198 |
+
self.assertTrue(h.read('evaluator')['truth.samples']['holder']['frozen'])
|
| 1199 |
+
ag = {e['code'] for e in self._session_invoke(h, 'ag', 'events.read', dict(since_s=0.0), 'e1')['result']['events']}
|
| 1200 |
+
ev = {e['code'] for e in self._session_invoke(h, 'ev', 'events.read', dict(since_s=0.0), 'e2')['result']['events']}
|
| 1201 |
+
self.assertFalse([c for c in ag if c.startswith('FAULT_')] + [c for c in ag if c == 'SAMPLE_FROZEN'])
|
| 1202 |
+
self.assertIn('FAULT_TUBE_AGED', ev)
|
| 1203 |
+
self.assertIn('SAMPLE_FROZEN', ev)
|
| 1204 |
+
|
| 1205 |
+
def test_f02_records_do_not_reveal_the_composition(self):
|
| 1206 |
+
h = ready(seed=22)
|
| 1207 |
+
liquid(h, 'buf')
|
| 1208 |
+
liquid(h, 'mix', [(LYS, 5.0), (BSA, 2.0)])
|
| 1209 |
+
rs = []
|
| 1210 |
+
for sid in ('buf', 'mix'):
|
| 1211 |
+
load(h, sid)
|
| 1212 |
+
rs.append(h.records[acquire(h, 10.0)]['template_source'])
|
| 1213 |
+
self.assertEqual(rs[0], rs[1])
|
| 1214 |
+
self.assertEqual(set(rs[0]), {'library', 'note_zh'})
|
| 1215 |
+
|
| 1216 |
+
def test_f03_f04_ledger_split_by_optical_depth_and_real_closure(self):
|
| 1217 |
+
h = ready(seed=23)
|
| 1218 |
+
load(h, None)
|
| 1219 |
+
rid = acquire(h, 60.0)
|
| 1220 |
+
led = h.invoke('ledger.read')
|
| 1221 |
+
self.assertEqual(led['photons_attenuated_sample'], 0.0) # an empty capillary absorbs only in its quartz walls
|
| 1222 |
+
self.assertGreater(led['photons_attenuated_windows'], 0.0)
|
| 1223 |
+
self.assertLess(abs(led['photons_residual']), 1e-9 * led['photons_incident'])
|
| 1224 |
+
self.assertGreater(led['photons_direct_off_detector'], 0.0) # 20 mm line beam vs 8 mm strips
|
| 1225 |
+
self.assertGreater(led['photons_direct_stopped'], led['photons_direct_detected'])
|
| 1226 |
+
g = h._geometry()
|
| 1227 |
+
liquid(h, 'w')
|
| 1228 |
+
load(h, 'w')
|
| 1229 |
+
g = h._geometry()
|
| 1230 |
+
# 1 mm water in a 10 um quartz capillary: windows take ~14 % of the absorbed share at the beam centre, not a fixed 35 %
|
| 1231 |
+
share = g['att_window'] / (g['att_window'] + g['att_sample'])
|
| 1232 |
+
self.assertLess(share, 0.25)
|
| 1233 |
+
self.assertGreater(share, 0.05)
|
| 1234 |
+
self.assertTrue(rid)
|
| 1235 |
+
|
| 1236 |
+
def test_f05_water_calibration_in_air_equals_vacuum(self):
|
| 1237 |
+
"""Air and collimator scattering pass through the sample: after normalising by the transmitted primary beam and subtracting the empty
|
| 1238 |
+
capillary, the water scale measured in air equals the one measured under vacuum."""
|
| 1239 |
+
def measure(h, sid, vac):
|
| 1240 |
+
if h.pump_on:
|
| 1241 |
+
h.invoke('vacuum.set_pump', on=False)
|
| 1242 |
+
h.step(80.0)
|
| 1243 |
+
if not h.door_open:
|
| 1244 |
+
h.invoke('chamber.set_door', open=True)
|
| 1245 |
+
if h.holder is not None:
|
| 1246 |
+
h.invoke('sample.unload')
|
| 1247 |
+
h.invoke('sample.load', sample_id=sid, holder='capillary_1mm')
|
| 1248 |
+
h.invoke('chamber.set_door', open=False)
|
| 1249 |
+
if vac:
|
| 1250 |
+
h.invoke('vacuum.set_pump', on=True)
|
| 1251 |
+
h.step(220.0)
|
| 1252 |
+
h.invoke('stage.auto_align')
|
| 1253 |
+
h.step(rt.ALIGN_S + 4.0)
|
| 1254 |
+
return acquire(h, 600.0)
|
| 1255 |
+
f = {}
|
| 1256 |
+
for vac in (True, False):
|
| 1257 |
+
h = ready(seed=24)
|
| 1258 |
+
liquid(h, 'w')
|
| 1259 |
+
rw = measure(h, 'w', vac)
|
| 1260 |
+
re_ = measure(h, None, vac)
|
| 1261 |
+
f[vac] = h.invoke('calibration.absolute', record_id=rw, background_record_id=re_, standard='water', thickness_m=1e-3)['factor']
|
| 1262 |
+
self.assertAlmostEqual(f[False] / f[True], 1.0, delta=0.05)
|
| 1263 |
+
|
| 1264 |
+
def test_f06_primary_normalisation_does_not_depend_on_the_zero_calibration(self):
|
| 1265 |
+
h = ready(seed=1)
|
| 1266 |
+
load(h, None)
|
| 1267 |
+
r_empty = acquire(h, 300.0)
|
| 1268 |
+
liquid(h, 'w')
|
| 1269 |
+
load(h, 'w')
|
| 1270 |
+
r_w = acquire(h, 300.0)
|
| 1271 |
+
before = h.invoke('calibration.absolute', record_id=r_w, background_record_id=r_empty, standard='water', thickness_m=1e-3)['factor']
|
| 1272 |
+
h.invoke('calibration.zero_angle', record_id=r_empty)
|
| 1273 |
+
after = h.invoke('calibration.absolute', record_id=r_w, background_record_id=r_empty, standard='water', thickness_m=1e-3)['factor']
|
| 1274 |
+
self.assertAlmostEqual(after / before, 1.0, delta=0.02)
|
| 1275 |
+
|
| 1276 |
+
def test_f07_overexposure_during_an_exposure_fails_the_acquisition(self):
|
| 1277 |
+
h = ready(seed=25)
|
| 1278 |
+
liquid(h, 'w')
|
| 1279 |
+
load(h, 'w')
|
| 1280 |
+
op = h.invoke('acquisition.start', exposure_s=300.0, frames=1)['operation_id']
|
| 1281 |
+
h.step(10.0)
|
| 1282 |
+
h.invoke('fault.inject', fault='beamstop_misaligned', active=True)
|
| 1283 |
+
rid = h.operations[op]['record_id']
|
| 1284 |
+
self.assertEqual(h.records[rid]['status'], 'failed')
|
| 1285 |
+
self.assertEqual(h.records[rid]['error_code'], 'DETECTOR_OVEREXPOSURE')
|
| 1286 |
+
self.assertFalse(h.read('evaluator')['shutter.open'])
|
| 1287 |
+
|
| 1288 |
+
def test_f08_model_spheres_carry_over_one_percent(self):
|
| 1289 |
+
h = ready(seed=26)
|
| 1290 |
+
sph = dict(radius_m=10e-9, rel_sigma=0.1, volume_fraction=0.01, material='silica', matrix='water')
|
| 1291 |
+
h.invoke('sample.provide', sample_id='sph', form='dispersion', solvent='water', volume_m3=200e-9, thickness_m=None,
|
| 1292 |
+
components=[dict(template_id='model_spheres', concentration_kg_m3=None, model_parameters=sph)])
|
| 1293 |
+
liquid(h, 'buf', volume=200e-9)
|
| 1294 |
+
h.invoke('asx.set_door', open=True)
|
| 1295 |
+
h.invoke('asx.load_well', sample_id='sph', well='AA01', volume_m3=100e-9)
|
| 1296 |
+
h.invoke('asx.load_well', sample_id='buf', well='AA02', volume_m3=100e-9)
|
| 1297 |
+
h.invoke('asx.set_door', open=False)
|
| 1298 |
+
for well in ('AA01', 'AA02'):
|
| 1299 |
+
h.invoke('asx.inject', well=well)
|
| 1300 |
+
h.step(60.0)
|
| 1301 |
+
comps = [c for c in h.flow_cell['components'] if c['kind'] == 'model_spheres']
|
| 1302 |
+
self.assertEqual(len(comps), 1)
|
| 1303 |
+
self.assertAlmostEqual(comps[0]['parameters']['volume_fraction'], 0.01 * rt.ASX_CARRY_OVER, delta=1e-12)
|
| 1304 |
+
|
| 1305 |
+
def test_f09_stage_mount_on_step_effects_are_declared(self):
|
| 1306 |
+
h = ready(seed=27)
|
| 1307 |
+
h.invoke('chamber.set_door', open=True)
|
| 1308 |
+
h.invoke('stage.mount', stage_type='tcstage_extended')
|
| 1309 |
+
h.invoke('stage.set_temperature', temperature_k=773.15)
|
| 1310 |
+
a, b = copy.deepcopy(h), copy.deepcopy(h)
|
| 1311 |
+
a.invoke('stage.mount', stage_type='tcstage_peltier')
|
| 1312 |
+
a.step(1500.0)
|
| 1313 |
+
b.step(1500.0)
|
| 1314 |
+
va, vb = a.read('evaluator'), b.read('evaluator')
|
| 1315 |
+
changed = {k for k in ('truth.stage_temperature_k', 'stage.temperature_indicated_k') if va[k] != vb[k]}
|
| 1316 |
+
self.assertEqual(changed, {'truth.stage_temperature_k', 'stage.temperature_indicated_k'})
|
| 1317 |
+
self.assertLessEqual(changed, set(rt.ON_STEP['stage.mount']))
|
| 1318 |
+
|
| 1319 |
+
def test_f13_emergency_stop_pressed_unpowered_needs_standby(self):
|
| 1320 |
+
h = configured(seed=28)
|
| 1321 |
+
h.invoke('generator.emergency_stop')
|
| 1322 |
+
h.invoke('power.set', enabled=True)
|
| 1323 |
+
h.step(61.0)
|
| 1324 |
+
h.invoke('generator.set_key', on=True)
|
| 1325 |
+
h.invoke('generator.release_emergency_stop')
|
| 1326 |
+
self.assertTrue(rejected(h, 'generator.xray_on', 'GENERATOR_FAULT'))
|
| 1327 |
+
h.invoke('generator.acknowledge')
|
| 1328 |
+
h.invoke('generator.xray_on')
|
| 1329 |
+
|
| 1330 |
+
def test_f14_zero_angle_from_silver_behenate_is_unbiased(self):
|
| 1331 |
+
h = ready(seed=29)
|
| 1332 |
+
solid(h, 'agbe', 'silver_behenate', 1e-3, form='powder')
|
| 1333 |
+
load(h, 'agbe', holder='paste_cell')
|
| 1334 |
+
z = h.invoke('calibration.zero_angle', record_id=acquire(h, 60.0))['zero_m']
|
| 1335 |
+
self.assertLess(abs(z - h.zero_true), 3e-6)
|
| 1336 |
+
|
| 1337 |
+
def test_f17_point_collimation_desmear_and_molecular_weight(self):
|
| 1338 |
+
h = ready(seed=30)
|
| 1339 |
+
h.invoke('collimation.set_mode', mode='point')
|
| 1340 |
+
liquid(h, 'bsa', [(BSA, 5.0)])
|
| 1341 |
+
liquid(h, 'buf')
|
| 1342 |
+
load(h, 'bsa')
|
| 1343 |
+
rs = acquire(h, 1800.0)
|
| 1344 |
+
load(h, 'buf')
|
| 1345 |
+
rb = acquire(h, 1800.0)
|
| 1346 |
+
liquid(h, 'water_std')
|
| 1347 |
+
load(h, 'water_std')
|
| 1348 |
+
rw = acquire(h, 1800.0)
|
| 1349 |
+
load(h, None)
|
| 1350 |
+
re_ = acquire(h, 1800.0)
|
| 1351 |
+
cal = h.invoke('calibration.absolute', record_id=rw, background_record_id=re_, standard='water', thickness_m=1e-3)['calibration_id']
|
| 1352 |
+
smeared = h.invoke('data.reduce', record_id=rs, background_record_id=rb, calibration_id=cal, thickness_m=1e-3, desmear=False)
|
| 1353 |
+
self.assertTrue(rejected(h, 'analysis.molecular_weight', 'DESMEAR_REQUIRED', reduced_id=smeared['reduced_id'], concentration_kg_m3=5.0,
|
| 1354 |
+
drho_m_m_kg=rt.DRHO_M_PROTEIN_M_KG))
|
| 1355 |
+
red = h.invoke('data.reduce', record_id=rs, background_record_id=rb, calibration_id=cal, thickness_m=1e-3, desmear=True)
|
| 1356 |
+
mw = h.invoke('analysis.molecular_weight', reduced_id=red['reduced_id'], concentration_kg_m3=5.0, drho_m_m_kg=rt.DRHO_M_PROTEIN_M_KG)
|
| 1357 |
+
m_template = rt.template(BSA)['abs_scale']['mass_da'] / 1000.0
|
| 1358 |
+
self.assertAlmostEqual(mw['molecular_weight_kg_mol'] / m_template, 1.0, delta=0.12)
|
| 1359 |
+
|
| 1360 |
+
def test_f18_truefocus_finds_the_empty_flow_cell(self):
|
| 1361 |
+
h = ready(seed=31)
|
| 1362 |
+
h.invoke('stage.select_position', position='flow_cell')
|
| 1363 |
+
h.step(10.0)
|
| 1364 |
+
op = h.invoke('stage.auto_align')['operation_id']
|
| 1365 |
+
h.step(rt.ALIGN_S + 4.0)
|
| 1366 |
+
self.assertEqual(h.operations[op]['phase'], 'completed')
|
| 1367 |
+
self.assertIsNone(h.operations[op].get('reason'))
|
| 1368 |
+
self.assertAlmostEqual(h.stage['y'], rt.FLOW_CELL_Y_M + h.fc_offset, delta=3e-5)
|
| 1369 |
+
|
| 1370 |
+
def test_f19_room_temperature_change_is_not_cache_dependent(self):
|
| 1371 |
+
h = ready(seed=32)
|
| 1372 |
+
load(h, None)
|
| 1373 |
+
h.invoke('vacuum.set_pump', on=False)
|
| 1374 |
+
h.step(80.0)
|
| 1375 |
+
h.invoke('acquisition.start', exposure_s=60.0, frames=1)
|
| 1376 |
+
h.step(20.0)
|
| 1377 |
+
a, b = copy.deepcopy(h), copy.deepcopy(h)
|
| 1378 |
+
for x in (a, b):
|
| 1379 |
+
x.invoke('plant.configure', room_k=305.15, mains_voltage_v=230.0, noise_seed=1)
|
| 1380 |
+
b.invoke('fault.inject', fault='chiller_failure', active=False) # a no-op call that used to clear the rate cache
|
| 1381 |
+
a.step(45.0)
|
| 1382 |
+
b.step(45.0)
|
| 1383 |
+
self.assertEqual(a.records['sx-1']['segments'][0]['counts'], b.records['sx-1']['segments'][0]['counts'])
|
| 1384 |
+
|
| 1385 |
+
|
| 1386 |
+
|
| 1387 |
+
class ReviewRound2Regressions(unittest.TestCase):
|
| 1388 |
+
"""Regression tests for the second independent runtime review (F20-F22)."""
|
| 1389 |
+
|
| 1390 |
+
def _spheres_solid(self, h, sid, radius, phi, thick):
|
| 1391 |
+
h.invoke('sample.provide', sample_id=sid, form='solid', solvent='none', volume_m3=0.0, thickness_m=thick,
|
| 1392 |
+
components=[dict(template_id='model_spheres', concentration_kg_m3=None,
|
| 1393 |
+
model_parameters=dict(radius_m=radius, rel_sigma=0.1, volume_fraction=phi, material='silica', matrix='polystyrene'))])
|
| 1394 |
+
|
| 1395 |
+
def test_f20_primary_peak_is_found_or_refused_never_misplaced(self):
|
| 1396 |
+
for seed, radius, phi, thick in ((51, 50e-9, 0.02, 1e-3), (52, 10e-9, 0.3, 2e-3)):
|
| 1397 |
+
h = ready(seed=seed)
|
| 1398 |
+
self._spheres_solid(h, 's', radius, phi, thick)
|
| 1399 |
+
load(h, 's', holder='solid_holder')
|
| 1400 |
+
rid = acquire(h, 30.0)
|
| 1401 |
+
pc = h.records[rid]['primary_beam_counts']
|
| 1402 |
+
g = h._geometry()
|
| 1403 |
+
expected = h._flux() * g['t_total'] * rt.detector_efficiency() * rt.STRIP_LENGTH_M / rt.LINE_LENGTH_M * rt.BEAMSTOP_T * 30.0
|
| 1404 |
+
self.assertIsNotNone(pc) # the attenuated peak is beam-shaped even when weaker than the scattering outside
|
| 1405 |
+
self.assertAlmostEqual(pc / expected, 1.0, delta=0.05)
|
| 1406 |
+
z = h.invoke('calibration.zero_angle', record_id=rid)['zero_m']
|
| 1407 |
+
self.assertLess(abs(z - h.zero_true), 10e-6)
|
| 1408 |
+
|
| 1409 |
+
def test_f20_ordinary_samples_keep_their_primary_beam(self):
|
| 1410 |
+
h = ready(seed=54)
|
| 1411 |
+
solid(h, 'gc', GC, 1.055e-3)
|
| 1412 |
+
load(h, 'gc', holder='solid_holder')
|
| 1413 |
+
rid = acquire(h, 60.0)
|
| 1414 |
+
self.assertIsNotNone(h.records[rid]['primary_beam_counts'])
|
| 1415 |
+
z = h.invoke('calibration.zero_angle', record_id=rid)['zero_m']
|
| 1416 |
+
self.assertLess(abs(z - h.zero_true), 5e-6)
|
| 1417 |
+
|
| 1418 |
+
def test_f23_zero_beyond_three_sigma_is_still_found(self):
|
| 1419 |
+
"""Instruments whose true zero lies 0.15-0.21 mm from nominal (seeds 1377 and 129 of the review) still find their primary beam before
|
| 1420 |
+
the first zero calibration, and after it the normalisation uses the calibrated zero."""
|
| 1421 |
+
for seed in (1377, 129):
|
| 1422 |
+
h = ready(seed=seed)
|
| 1423 |
+
self.assertGreater(abs(h.zero_true), 0.14e-3)
|
| 1424 |
+
empty_beam(h)
|
| 1425 |
+
rid = acquire(h, 60.0)
|
| 1426 |
+
self.assertIsNotNone(h.records[rid]['primary_beam_counts'])
|
| 1427 |
+
z = h.invoke('calibration.zero_angle', record_id=rid)['zero_m']
|
| 1428 |
+
self.assertLess(abs(z - h.zero_true), 5e-6)
|
| 1429 |
+
h.invoke('data.reduce', record_id=rid, background_record_id=None, calibration_id=None, thickness_m=1e-3, desmear=False)
|
| 1430 |
+
|
| 1431 |
+
def test_f24_far_zero_with_steep_scatterers(self):
|
| 1432 |
+
"""Far-zero instruments before the zero calibration with steeply scattering solids (review round 4): the attenuated primary, not a scatter
|
| 1433 |
+
maximum near the hint, is found."""
|
| 1434 |
+
for seed, radius, phi in ((129, 100e-9, 0.003), (129, 80e-9, 0.01), (1377, 100e-9, 0.003)):
|
| 1435 |
+
h = ready(seed=seed)
|
| 1436 |
+
self._spheres_solid(h, 's', radius, phi, 1e-3)
|
| 1437 |
+
load(h, 's', holder='solid_holder')
|
| 1438 |
+
rid = acquire(h, 30.0)
|
| 1439 |
+
g = h._geometry()
|
| 1440 |
+
expected = h._flux() * g['t_total'] * rt.detector_efficiency() * rt.STRIP_LENGTH_M / rt.LINE_LENGTH_M * rt.BEAMSTOP_T * 30.0
|
| 1441 |
+
self.assertAlmostEqual(h.records[rid]['primary_beam_counts'] / expected, 1.0, delta=0.05)
|
| 1442 |
+
z = h.invoke('calibration.zero_angle', record_id=rid)['zero_m']
|
| 1443 |
+
self.assertLess(abs(z - h.zero_true), 5e-6)
|
| 1444 |
+
|
| 1445 |
+
def test_f21_alignment_is_protected_against_overexposure(self):
|
| 1446 |
+
h = ready(seed=53)
|
| 1447 |
+
liquid(h, 'l', [(LYS, 5.0)])
|
| 1448 |
+
load(h, 'l', align=False)
|
| 1449 |
+
h.invoke('fault.inject', fault='beamstop_misaligned', active=True)
|
| 1450 |
+
op = h.invoke('stage.auto_align')['operation_id']
|
| 1451 |
+
h.step(2.0)
|
| 1452 |
+
self.assertEqual(h.operations[op]['phase'], 'failed')
|
| 1453 |
+
self.assertEqual(h.operations[op]['reason'], 'DETECTOR_OVEREXPOSURE')
|
| 1454 |
+
self.assertFalse(h.read('evaluator')['shutter.open'])
|
| 1455 |
+
|
| 1456 |
+
def test_f22_model_spheres_leave_the_rinse_residue(self):
|
| 1457 |
+
h = ready(seed=55)
|
| 1458 |
+
h.invoke('sample.provide', sample_id='sph', form='dispersion', solvent='water', volume_m3=200e-9, thickness_m=None,
|
| 1459 |
+
components=[dict(template_id='model_spheres', concentration_kg_m3=None,
|
| 1460 |
+
model_parameters=dict(radius_m=10e-9, rel_sigma=0.1, volume_fraction=0.01, material='silica', matrix='water'))])
|
| 1461 |
+
liquid(h, 'buf', volume=200e-9)
|
| 1462 |
+
h.invoke('asx.set_door', open=True)
|
| 1463 |
+
h.invoke('asx.load_well', sample_id='sph', well='AA01', volume_m3=50e-9)
|
| 1464 |
+
h.invoke('asx.load_well', sample_id='buf', well='AA02', volume_m3=50e-9)
|
| 1465 |
+
h.invoke('asx.set_door', open=False)
|
| 1466 |
+
h.invoke('asx.inject', well='AA01')
|
| 1467 |
+
h.step(60.0)
|
| 1468 |
+
h.invoke('asx.clean')
|
| 1469 |
+
h.step(130.0)
|
| 1470 |
+
h.invoke('asx.inject', well='AA02')
|
| 1471 |
+
h.step(60.0)
|
| 1472 |
+
comps = [c for c in h.flow_cell['components'] if c['kind'] == 'model_spheres']
|
| 1473 |
+
self.assertEqual(len(comps), 1)
|
| 1474 |
+
self.assertAlmostEqual(comps[0]['parameters']['volume_fraction'], 0.01 * rt.ASX_CARRY_OVER_CLEAN, delta=1e-15)
|
| 1475 |
+
|
| 1476 |
+
|
| 1477 |
+
class DeclaredEffects(unittest.TestCase):
|
| 1478 |
+
def test_on_step_effects_cover_what_the_process_changes(self):
|
| 1479 |
+
"""For every capability accepted in any scenario state: the slots it changes at once are declared effects, the slots whose change during the
|
| 1480 |
+
following step differs from an identical run without the call are declared on_step effects, and the step itself only changes slots declared
|
| 1481 |
+
as on_step effects of sim.step (noise-free and noisy runs; both runs draw identical noise during the step)."""
|
| 1482 |
+
missing_imm, missing_step = {}, {}
|
| 1483 |
+
states = {n: _scenario(n) for n in SCENARIOS}
|
| 1484 |
+
for noisy in (False, True):
|
| 1485 |
+
for n, S in states.items():
|
| 1486 |
+
for i, name in enumerate(RNGS):
|
| 1487 |
+
setattr(S, name, random.Random(7 + i) if noisy else QuietRng())
|
| 1488 |
+
for cap in rt.CAPS:
|
| 1489 |
+
if cap in rt.UNSUPPORTED or rt.CAPS[cap]['kind'] in ('query', 'analysis'):
|
| 1490 |
+
continue
|
| 1491 |
+
for sname, S in states.items():
|
| 1492 |
+
for args in _variants(cap):
|
| 1493 |
+
A = copy.deepcopy(S)
|
| 1494 |
+
v0 = A.read('evaluator')
|
| 1495 |
+
try:
|
| 1496 |
+
_orig_invoke(A, cap, **args)
|
| 1497 |
+
except rt.ActionRejected:
|
| 1498 |
+
continue
|
| 1499 |
+
v1 = A.read('evaluator')
|
| 1500 |
+
if cap == 'sim.step':
|
| 1501 |
+
for k in v0:
|
| 1502 |
+
if _changed(v0[k], v1[k]) and k not in rt.ON_STEP['sim.step'] + rt.EFFECTS['sim.step']:
|
| 1503 |
+
missing_step.setdefault('sim.step', set()).add(k)
|
| 1504 |
+
continue
|
| 1505 |
+
for k in v0:
|
| 1506 |
+
if json.dumps(v0[k], sort_keys=True, default=str) != json.dumps(v1[k], sort_keys=True, default=str) and _changed(v0[k], v1[k]) \
|
| 1507 |
+
and k not in rt.EFFECTS[cap]:
|
| 1508 |
+
missing_imm.setdefault(cap, set()).add(k)
|
| 1509 |
+
for dt in STEP_DTS:
|
| 1510 |
+
A2, B2 = copy.deepcopy(A), copy.deepcopy(S)
|
| 1511 |
+
for name in RNGS:
|
| 1512 |
+
setattr(A2, name, copy.deepcopy(getattr(B2, name)))
|
| 1513 |
+
A2.step(dt)
|
| 1514 |
+
B2.step(dt)
|
| 1515 |
+
a2, b2 = A2.read('evaluator'), B2.read('evaluator')
|
| 1516 |
+
for k in v0:
|
| 1517 |
+
if k not in rt.ON_STEP.get(cap, []) and _step_differs(v1[k], a2[k], v0[k], b2[k]):
|
| 1518 |
+
missing_step.setdefault(cap, set()).add(k)
|
| 1519 |
+
if k not in rt.ON_STEP['sim.step'] + ['clock.time_s'] and _changed(v0[k], b2[k]):
|
| 1520 |
+
missing_step.setdefault('sim.step', set()).add(k)
|
| 1521 |
+
self.assertEqual(missing_imm, {})
|
| 1522 |
+
self.assertEqual(missing_step, {})
|
| 1523 |
+
self.assertFalse([s for v in rt.ON_STEP.values() for s in v if rt.SLOTS[s]['origin'] == 'setpoint'])
|
| 1524 |
+
|
| 1525 |
+
def test_units_and_sampling(self):
|
| 1526 |
+
meta = _meta()
|
| 1527 |
+
si = {'1', 's', 'm', 'rad', 'Pa', 'V', 'A', 'K', 'J', 'W', 'kg', 'm^3', '1/s', 'Pa*m^3/s', 'm^3/s', 'm/s', 'V/s', 'A/s', 'K/s', 'rad/s', '1/m', 'kg/m^3',
|
| 1528 |
+
'kg/mol', 'm^2/kg', 'm/kg', '1/sr'}
|
| 1529 |
+
units = {v['unit'] for v in meta['state_slots'].values()}
|
| 1530 |
+
for mech in meta['mechanisms'].values():
|
| 1531 |
+
units |= {p_['unit'] for p_ in mech['parameters'].values()}
|
| 1532 |
+
self.assertEqual(units - si, set(), units - si)
|
| 1533 |
+
h = ready()
|
| 1534 |
+
h.register_principal('e', 'evaluator')
|
| 1535 |
+
h.invoke('detector.move_arm', angle_rad=0.3)
|
| 1536 |
+
h.step(0.5)
|
| 1537 |
+
obs = h.session('e').read(instance_id=h.instance_id)['observations']
|
| 1538 |
+
self.assertIsNone(obs['detector.arm_indicated_rad']['sample_window_s'])
|
| 1539 |
+
self.assertGreater(obs['detector.arm_indicated_rad']['value'], 0.0)
|
| 1540 |
+
self.assertEqual(obs['vacuum.pressure_indicated_pa']['sample_window_s'], rt.CYCLE_S)
|
| 1541 |
+
g0 = h.read()['vacuum.pressure_indicated_pa']
|
| 1542 |
+
h.step(0.2)
|
| 1543 |
+
self.assertEqual(h.read()['vacuum.pressure_indicated_pa'], g0)
|
| 1544 |
+
|
| 1545 |
+
|
| 1546 |
+
if __name__ == '__main__':
|
| 1547 |
+
unittest.main()
|
tests/test_asset_antonpaar_trb.py
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM128 real-pair finite tribology and protocol regression tests."""
|
| 2 |
+
import copy,hashlib,importlib.util,json,math,sys,unittest
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
from unittest import mock
|
| 5 |
+
import numpy as np
|
| 6 |
+
ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts'))
|
| 7 |
+
from asset_runtime import antonpaar_trb as rt
|
| 8 |
+
OBSERVED=[];STATES=[]
|
| 9 |
+
def canonical(v):
|
| 10 |
+
if isinstance(v,dict):return {str(k):canonical(x) for k,x in v.items()}
|
| 11 |
+
if isinstance(v,(list,tuple)):return [canonical(x) for x in v]
|
| 12 |
+
if isinstance(v,np.ndarray):return v.tolist()
|
| 13 |
+
return v
|
| 14 |
+
def state(h):return json.dumps(canonical(h.__dict__),sort_keys=True,allow_nan=False)
|
| 15 |
+
def call(h,k,**a):
|
| 16 |
+
before=h.read();r=h.invoke(k,**a);after=h.read();OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));STATES.append(after)
|
| 17 |
+
changed={x for x in before if before[x]!=after[x]};declared=set(rt.CAPS[k]['effects'])
|
| 18 |
+
if not changed<=declared:raise AssertionError((k,'undeclared changed state',changed-declared))
|
| 19 |
+
return r
|
| 20 |
+
def setup(name='trb_test',plant=None,sample=None,pin=None,drive=None,method=None,lubricant=None,load=10.,radius=.01):
|
| 21 |
+
h=rt.AntonpaarTrbRuntime(name)
|
| 22 |
+
for k,a in [('plant.configure',dict(rt.PLANT_EXAMPLE,**(plant or {}))),('specimen.load',dict(rt.SAMPLE_EXAMPLE,**(sample or {}))),('pin.load',dict(rt.PIN_EXAMPLE,**(pin or {}))),('normal_load.set',{'force_n':load}),('radius.set',{'radius_m':radius}),('drive.configure',dict(rt.DRIVE_EXAMPLE,**(drive or {})))]:call(h,k,**a)
|
| 23 |
+
if lubricant is not None:call(h,'lubricant.load',**dict(rt.LUBRICANT_EXAMPLE,**lubricant))
|
| 24 |
+
call(h,'power.set',enabled=True);call(h,'sensor.zero');call(h,'contact.set',engaged=True);call(h,'lid.set',opened=False);call(h,'method.configure',**dict(dict(rt.METHOD_EXAMPLE,duration_s=2.),**(method or {})));return h
|
| 25 |
+
def run(h,seconds=None):
|
| 26 |
+
call(h,'acquisition.start');h.step(h.method['duration_s'] if seconds is None else seconds);return call(h,'acquisition.result')
|
| 27 |
+
def access(h):
|
| 28 |
+
if h.phase=='running':call(h,'acquisition.stop')
|
| 29 |
+
call(h,'lid.set',opened=True);call(h,'contact.set',engaged=False)
|
| 30 |
+
def cleanup(h):
|
| 31 |
+
access(h)
|
| 32 |
+
for k in ['specimen','pin','lubricant']:
|
| 33 |
+
if getattr(h,k) is not None:call(h,k+'.remove')
|
| 34 |
+
call(h,'debris.collect');call(h,'power.set',enabled=False)
|
| 35 |
+
class TestTRB(unittest.TestCase):
|
| 36 |
+
def rejected(self,h,k,error='.',**a):
|
| 37 |
+
before=state(h)
|
| 38 |
+
with self.assertRaisesRegex(rt.ActionRejected,error):h.invoke(k,**a)
|
| 39 |
+
self.assertEqual(before,state(h))
|
| 40 |
+
def ledger(self,h):
|
| 41 |
+
l=call(h,'ledger.read')
|
| 42 |
+
for k in ['specimen_error_kg','pin_error_kg','lubricant_error_kg']:self.assertLess(abs(l[k]),1e-13,k)
|
| 43 |
+
self.assertLess(abs(l['thermal_error_j']),1e-7);return l
|
| 44 |
+
def test_01_real_pair_sources_and_integrated_work(self):
|
| 45 |
+
energies=[]
|
| 46 |
+
for rid in ['cr100_leadbronze_dry_003','cr100_leadbronze_dry_005']:
|
| 47 |
+
h=setup(sample={'reference_id':rid});original=copy.deepcopy(h.reference);r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(len(r['rows']),21);self.assertAlmostEqual(r['sliding_distance_m'],.2);x=np.array(original['values']['sliding_distance_m']);y=np.array(original['values']['friction_coefficient']);q=np.r_[0,x[(x>0)&(x<.2)],.2];expected=10*np.trapz(np.interp(q,x,y),q);self.assertAlmostEqual(h.friction_energy,expected,places=10);self.assertEqual(original,h.reference);self.assertEqual(len(x),5002);self.assertEqual(original['conditions']['normal_force_n'],10);self.assertAlmostEqual(original['conditions']['counterbody_radius_m'],.00476);energies.append(h.friction_energy);self.ledger(h)
|
| 48 |
+
self.assertNotEqual(*energies)
|
| 49 |
+
def test_02_high_speed_rotary_full_turns_not_endpoint_alias(self):
|
| 50 |
+
h=setup(drive={'angular_speed_rad_s':rt.OMEGA_MAX},method={'duration_s':.3});r=run(h);self.assertAlmostEqual(r['sliding_distance_m'],2*math.pi*.01*10,places=11);self.assertAlmostEqual(h.disk_angle,0.,places=9);self.assertGreater(h.friction_energy,0)
|
| 51 |
+
def test_03_linear_10hz_reversals_have_nonzero_distance(self):
|
| 52 |
+
h=setup(drive={'mode':'linear','frequency_hz':10.,'stroke_m':.01},method={'duration_s':.3});r=run(h);self.assertAlmostEqual(r['sliding_distance_m'],.06,places=11);self.assertAlmostEqual(h.linear_position,0.,places=10);self.assertGreater(h.friction_energy,0);self.ledger(h)
|
| 53 |
+
def test_04_angular_reciprocal_signed_force_and_path(self):
|
| 54 |
+
h=setup(drive={'mode':'angular','frequency_hz':1.,'angular_amplitude_rad':.5},method={'duration_s':1.});r=run(h);self.assertAlmostEqual(r['sliding_distance_m'],.02,places=11);self.assertLess(min(x['friction_force_n'] for x in r['rows'] if x['friction_force_n'] is not None),0);self.assertGreater(min(x['friction_coefficient'] for x in r['rows'] if x['friction_coefficient'] is not None),0);self.ledger(h)
|
| 55 |
+
def test_05_exact_turning_point_zero_speed_no_fake_mu(self):
|
| 56 |
+
h=setup(drive={'mode':'linear','frequency_hz':2.5,'stroke_m':.01});call(h,'acquisition.start');h.step(.1);self.assertAlmostEqual(h.signed_speed,0.,places=10);self.assertIsNone(h.read()['friction.coefficient']);self.assertEqual(h.read()['friction.unavailable_reason'],'REVERSAL_ZERO_SPEED')
|
| 57 |
+
def test_06_combined_limits_and_atomic_reject(self):
|
| 58 |
+
h=setup();access(h)
|
| 59 |
+
for args,error in [(dict(rt.DRIVE_EXAMPLE,mode='linear',frequency_hz=10.,stroke_m=.06),'LINEAR_SPEED_RANGE'),(dict(rt.DRIVE_EXAMPLE,mode='angular',frequency_hz=8.),'ANGULAR_COMBINATION_RANGE'),(dict(rt.DRIVE_EXAMPLE,mode='angular',frequency_hz=.01,angular_amplitude_rad=math.pi/36),'ANGULAR_COMBINATION_RANGE')]:self.rejected(h,'drive.configure',error,**args)
|
| 60 |
+
self.rejected(h,'normal_load.set',force_n=60.0001);self.rejected(h,'radius.set',radius_m=.040001);self.rejected(h,'drive.configure',**dict(rt.DRIVE_EXAMPLE,angular_speed_rad_s=rt.OMEGA_MAX+1))
|
| 61 |
+
def test_07_deadweight_manual_access_and_actual_force_limit(self):
|
| 62 |
+
h=setup();self.rejected(h,'normal_load.set','ARM_LOADED',force_n=5.);call(h,'acquisition.start');self.rejected(h,'contact.set','BUSY',engaged=False);self.rejected(h,'normal_load.set','BUSY',force_n=5.);access(h);call(h,'normal_load.set',force_n=4.);self.assertEqual(h._normal_true(),0.);call(h,'contact.set',engaged=True);self.assertEqual(h._normal_true(),4.)
|
| 63 |
+
h=setup(plant={'normal_force_factor':2.});access(h);self.rejected(h,'normal_load.set','NORMAL_FORCE_RANGE',force_n=31.)
|
| 64 |
+
def test_08_torque_start_and_first_crossing_terminal(self):
|
| 65 |
+
h=setup(load=60.,radius=.04,method={'source_start_distance_m':2.});self.rejected(h,'acquisition.start','DRIVE_FORCE_RANGE')
|
| 66 |
+
h=setup(radius=.04);h.ref_x=np.array([0.,.1,1.]);h.ref_mu=np.array([.1,2.,2.]);r=run(h);self.assertEqual(r['phase'],'failed');self.assertEqual(r['error_code'],'DRIVE_FORCE_RANGE');self.assertAlmostEqual(r['sliding_distance_m'],(.45/(10*.04)-.1)/1.9*.1,places=11);self.assertGreater(r['elapsed_s'],0);self.assertEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s']);self.ledger(h)
|
| 67 |
+
def test_09_source_endpoint_finite_and_no_extrapolation(self):
|
| 68 |
+
h=setup(method={'source_start_distance_m':500.});r=run(h);self.assertEqual(r['phase'],'failed');self.assertEqual(r['error_code'],'REFERENCE_DISTANCE_RANGE');self.assertAlmostEqual(r['sliding_distance_m'],.009,places=9);self.rejected(h,'acquisition.start','REFERENCE_DISTANCE_RANGE');self.ledger(h)
|
| 69 |
+
def test_10_origin_history_survives_restart_and_method(self):
|
| 70 |
+
h=setup();run(h);distance=h.sample_distance;call(h,'method.configure',**dict(h.method,duration_s=.5));run(h);self.assertAlmostEqual(h.sample_distance,distance+.05);self.rejected(h,'method.configure','SOURCE_ORIGIN_LOCKED',**dict(h.method,source_start_distance_m=1.))
|
| 71 |
+
def test_11_finite_both_wear_inventories_and_recovery(self):
|
| 72 |
+
h=setup();run(h);l=self.ledger(h);self.assertAlmostEqual(l['specimen_wear_volume_m3'],1e-5*10*.2/2e9,places=20);self.assertAlmostEqual(l['pin_wear_volume_m3'],1e-6*10*.2/4e9,places=20);self.assertGreater(l['specimen_debris_kg'],0);cleanup(h);l=self.ledger(h);self.assertEqual(l['specimen_remaining_kg'],0);self.assertEqual(l['pin_remaining_kg'],0);self.assertEqual(l['specimen_debris_kg'],0);self.assertGreater(l['specimen_debris_recovered_kg'],0)
|
| 73 |
+
def test_12_extremely_small_specimen_and_pin_stop(self):
|
| 74 |
+
for item,label in [('sample','SPECIMEN_EXHAUSTED'),('pin','PIN_EXHAUSTED')]:
|
| 75 |
+
h=setup(**{item:{'volume_m3':1e-15,'hardness_pa':1e3,'archard_coefficient':.1}});r=run(h);self.assertEqual(r['phase'],'failed');self.assertEqual(r['error_code'],label);self.assertLess(r['elapsed_s'],1e-9);self.assertLessEqual(getattr(h,'specimen_volume' if item=='sample' else 'pin_volume'),1e-28);self.ledger(h)
|
| 76 |
+
def test_13_finite_lubricant_preserves_catch_inventory(self):
|
| 77 |
+
h=setup(lubricant={'volume_m3':1e-12,'loss_per_distance_m2':1e-6});r=run(h);self.assertEqual(r['error_code'],'LUBRICANT_EXHAUSTED');self.assertAlmostEqual(r['sliding_distance_m'],1e-6,places=15);self.assertLess(h.lubricant_volume,1e-24);l=self.ledger(h);self.assertAlmostEqual(l['lubricant_loaded_kg'],l['lubricant_dragout_kg'],places=18);cleanup(h);self.ledger(h)
|
| 78 |
+
def test_14_differential_common_mode_rejection(self):
|
| 79 |
+
a=setup();b=setup(plant={'common_drift_n_s':.7,'thermal_common_drift_n_k':.4});run(a);run(b);self.assertGreater(abs(a.left-b.left),1.);self.assertAlmostEqual(a.observed_work,b.observed_work,places=11)
|
| 80 |
+
for x,y in zip(a.rows,b.rows):
|
| 81 |
+
if x['friction_force_n'] is not None:self.assertAlmostEqual(x['friction_force_n'],y['friction_force_n'],places=11)
|
| 82 |
+
def test_15_observed_load_and_sensor_gain_not_true_mu(self):
|
| 83 |
+
h=setup(plant={'normal_read_gain':2.,'friction_gain_left':1.5,'friction_gain_right':1.5});call(h,'acquisition.start');h.step(1.);s=h.read();self.assertAlmostEqual(s['friction.coefficient'],abs(s['friction.indicated_n'])/20.);self.assertNotAlmostEqual(s['friction.coefficient'],h._mu(),places=4);self.assertEqual(s['truth.normal_force_n'],10.)
|
| 84 |
+
def test_16_low_load_and_sensor_overrange_are_unavailable(self):
|
| 85 |
+
h=setup(load=.001);call(h,'acquisition.start');h.step(.1);self.assertIsNone(h.read()['friction.coefficient']);self.assertEqual(h.read()['friction.unavailable_reason'],'LOW_LOAD')
|
| 86 |
+
h=setup(plant={'friction_gain_left':100.,'friction_gain_right':100.});r=run(h);self.assertEqual(r['error_code'],'FRICTION_SENSOR_OVER_RANGE');self.assertIsNone(r['rows'][-1]['friction_force_n']);self.assertGreater(h.friction_energy,0);self.ledger(h)
|
| 87 |
+
def test_17_external_calibration_zero_and_optional_wear(self):
|
| 88 |
+
h=setup(plant={'friction_offset_left_n':.5,'wear_sensor_enabled':True,'temperature_sensor_offset_k':2.});access(h);h.step(.1);call(h,'sensor.zero');self.assertAlmostEqual(h.calibration['friction_zero_n'],.5);cal=dict(rt.CAPS['sensor.calibrate']['example_arguments'],temperature_zero_k=2.,friction_zero_n=.5);call(h,'sensor.calibrate',**cal);call(h,'contact.set',engaged=True);call(h,'lid.set',opened=False);run(h);self.assertGreater(h.rows[-1]['wear_depth_m'],0);self.assertAlmostEqual(h.rows[-1]['temperature_k'],h.temperature);self.assertIsNone(setup().read()['wear.indicated_m'])
|
| 89 |
+
def test_18_stiff_optional_heater_exact_and_finite(self):
|
| 90 |
+
h=setup(plant={'thermal_capacity_j_k':.01,'heater_installed':True,'heater_max_w':1000.,'heater_gain_w_k':1e6});call(h,'thermal.set_temperature',temperature_k=303.15);self.assertEqual(h.temperature,296.15);h.step(1.);expected=(1e6*303.15+296.15)/(1e6+1);self.assertAlmostEqual(h.temperature,expected,places=8);self.assertLess(h.temperature,303.15);self.ledger(h)
|
| 91 |
+
def test_19_friction_heat_adiabatic_energy_and_passive_cooling(self):
|
| 92 |
+
h=setup(plant={'heat_loss_w_k':0.});run(h);self.assertAlmostEqual(h.temperature,296.15+h.friction_energy/100.,places=9);self.assertEqual(h.heater_energy,0);self.ledger(h)
|
| 93 |
+
h=setup(plant={'thermal_capacity_j_k':10.});run(h);start=h.temperature;call(h,'power.set',enabled=False);h.step(3.);self.assertAlmostEqual(h.temperature,296.15+(start-296.15)*math.exp(-.3),places=10);self.ledger(h)
|
| 94 |
+
def test_20_thermal_permissions_and_liquid_limits_atomic(self):
|
| 95 |
+
h=setup();self.rejected(h,'thermal.set_temperature','HEATER_NOT_INSTALLED',temperature_k=300.);self.rejected(h,'thermal.set_temperature','NO_ACTIVE_COOLING',temperature_k=295.)
|
| 96 |
+
h=setup(plant={'heater_installed':True,'heater_max_w':100.,'temperature_max_k':723.15},lubricant={});self.rejected(h,'thermal.set_temperature','LIQUID_TEMPERATURE_RANGE',temperature_k=423.16)
|
| 97 |
+
def test_21_hot_access_and_temperature_terminal_preserve_work(self):
|
| 98 |
+
h=setup(plant={'thermal_capacity_j_k':.01,'heat_loss_w_k':0.,'temperature_max_k':296.16,'safe_access_temperature_k':296.151});r=run(h);self.assertEqual(r['error_code'],'THERMAL_MODEL_RANGE');self.assertGreater(h.temperature,296.16);self.assertGreater(h.friction_energy,0);access(h);self.rejected(h,'specimen.remove','HOT_SPECIMEN');self.ledger(h)
|
| 99 |
+
def test_22_profile_loss_pileup_net_and_radial_weight(self):
|
| 100 |
+
h=setup();a=dict(rt.CAPS['analysis.wear_profile']['example_arguments'],geometry='linear',x_m=[0.,.001,.002],height_m=[.0001,0.,-.0001],track_length_m=.01);r=call(h,'analysis.wear_profile',**a);self.assertAlmostEqual(r['loss_volume_m3'],5e-10,places=18);self.assertAlmostEqual(r['pileup_volume_m3'],5e-10,places=18);self.assertAlmostEqual(r['net_volume_m3'],0.,places=18)
|
| 101 |
+
a.update(geometry='circular');r=call(h,'analysis.wear_profile',**a);self.assertGreater(r['net_volume_m3'],0.);self.assertAlmostEqual(r['net_volume_m3'],2*math.pi*(.002**3/(12)*.1),places=18);self.rejected(h,'analysis.wear_profile','MODEL_NOT_ACCEPTED',**dict(a,accept_uniform_profile=False));self.rejected(h,'analysis.wear_profile','PROFILE_GRID',**dict(a,x_m=[0.,0.,.002]))
|
| 102 |
+
def test_23_hertz_force_contact_and_pressure_integral(self):
|
| 103 |
+
h=setup();a=rt.CAPS['analysis.hertz']['example_arguments'];r=call(h,'analysis.hertz',**a);radius=r['contact_radius_m'];self.assertAlmostEqual(4*r['effective_modulus_pa']*radius**3/(3*a['radius_m']),a['normal_force_n'],places=11);self.assertAlmostEqual(2*math.pi*r['peak_pressure_pa']*radius**2/3,a['normal_force_n'],places=11);self.rejected(h,'analysis.hertz','MODEL_NOT_ACCEPTED',**dict(a,accept_elastic_homogeneous=False));self.rejected(h,'analysis.hertz','HERTZ_MODEL_DOMAIN',**dict(a,young_sample_pa=1e5,young_pin_pa=1e5,radius_m=1e-5))
|
| 104 |
+
def test_24_noquerytime_owner_result_and_freeze(self):
|
| 105 |
+
h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='s')['operation_id'];h.step(.4);before=state(h);h.read();h.describe();call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);call(h,'ledger.read');s.read(instance_id=h.instance_id);s.poll(op);self.assertEqual(state(h),before);q=s.invoke(instance_id=h.instance_id,capability_id='acquisition.result',arguments={},request_id='r');self.assertIsNone(q['operation_id']);self.assertEqual(h._owners[op],'agent');s.cancel(op,'cancel');frozen=s.poll(op);mass=h.specimen_volume;h.step(1.);self.assertEqual(mass,h.specimen_volume);cleanup(h);self.assertEqual(s.poll(op),frozen)
|
| 106 |
+
def test_25_owner_poll_result_cancel_and_idempotence(self):
|
| 107 |
+
h=setup();h.register_principal('other');a=h.session();b=h.session('other');args=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='one');r=a.invoke(**args);self.assertEqual(r,a.invoke(**args));op=r['operation_id'];self.assertEqual(h._counter,1)
|
| 108 |
+
for k in ['acquisition.result','acquisition.stop']:self.assertEqual(b.invoke(instance_id=h.instance_id,capability_id=k,arguments={},request_id=k)['error']['code'],'ACCESS_DENIED')
|
| 109 |
+
for method in [lambda:b.poll(op),lambda:b.cancel(op,'bad')]:
|
| 110 |
+
with self.assertRaises(rt.ActionRejected):method()
|
| 111 |
+
self.assertEqual(a.invoke(**dict(args,capability_id='acquisition.result'))['error']['code'],'REQUEST_CONFLICT');self.assertEqual(a.cancel(op,'cancel')['status'],'succeeded');self.assertEqual(a.cancel(op,'cancel')['status'],'succeeded')
|
| 112 |
+
def test_26_truth_recovery_and_simclock_permissions(self):
|
| 113 |
+
h=setup();s=h.session();d=s.describe(instance_id=h.instance_id);self.assertFalse(any(k.startswith('truth.') for k in d['state_slots']));self.assertFalse(any(k.startswith('truth.') for k in s.read(instance_id=h.instance_id)['observations']))
|
| 114 |
+
for k in ['plant.configure','specimen.load','specimen.remove','pin.load','pin.remove','lubricant.load','lubricant.remove','debris.collect','ledger.read','sim.step']:
|
| 115 |
+
before=state(h);r=s.invoke(instance_id=h.instance_id,capability_id=k,arguments=rt.CAPS[k]['example_arguments'],request_id=k);self.assertEqual(r['error']['code'],'ACCESS_DENIED');self.assertEqual(state(h),before)
|
| 116 |
+
with self.assertRaises(rt.ActionRejected):s.read(instance_id=h.instance_id,state_ids=['truth.specimen_volume_m3'])
|
| 117 |
+
run(h);text=json.dumps(h._result());self.assertNotIn('hardness_pa',text);self.assertNotIn('archard_coefficient',text);self.assertNotIn('specimen_volume_m3',text)
|
| 118 |
+
def test_27_two_instances_fixed_host_partition(self):
|
| 119 |
+
a=setup(name='same');b=setup(name='same');call(a,'acquisition.start');call(b,'acquisition.start');a.step(1.)
|
| 120 |
+
for _ in range(100):b.step(.01)
|
| 121 |
+
self.assertEqual(a.read(),b.read());self.assertEqual(a.rows,b.rows);before=state(b);a.step(.1);self.assertEqual(before,state(b));before=state(a);a.step(0.);self.assertEqual(before,state(a))
|
| 122 |
+
def test_28_emergency_and_manual_home_after_cancel(self):
|
| 123 |
+
h=setup(drive={'mode':'linear','frequency_hz':1.});call(h,'acquisition.start');h.step(.1);pos=h.linear_position;call(h,'emergency.stop');self.assertEqual(h.phase,'failed');frozen=h._result();h.step(1.);self.assertEqual(pos,h.linear_position);self.assertEqual(frozen,h._result());call(h,'emergency.reset');self.rejected(h,'acquisition.start','HOME_REQUIRED');access(h);call(h,'motion.home');self.assertEqual(h.linear_position,pos);h.step(.1);self.assertLess(abs(h.linear_position),abs(pos));h.step(.2);self.assertFalse(h.homing);call(h,'contact.set',engaged=True);call(h,'lid.set',opened=False);run(h)
|
| 124 |
+
def test_29_strict_source_conditions_and_reference_eligibility(self):
|
| 125 |
+
h=setup(sample={'accept_condition_transfer':False});run(h);h=setup(sample={'accept_condition_transfer':False},drive={'mode':'linear'});self.rejected(h,'acquisition.start','REFERENCE_CONDITIONS')
|
| 126 |
+
h=setup(sample={'accept_condition_transfer':False},lubricant={});self.rejected(h,'acquisition.start','REFERENCE_LUBRICATION')
|
| 127 |
+
h=setup();access(h);call(h,'specimen.remove');record=next(v for v in rt.library()['substances'].values() if not v.get('runtime_usable'));self.rejected(h,'specimen.load','INVALID_REFERENCE',**dict(rt.SAMPLE_EXAMPLE,reference_id=next(k for k,v in rt.library()['substances'].items() if v==record)))
|
| 128 |
+
def test_30_unknown_temperature_requires_explicit_acceptance(self):
|
| 129 |
+
h=setup(sample={'accept_unknown_conditions':False});h.reference['conditions']['temperature_k']=None;self.rejected(h,'acquisition.start','UNKNOWN_REFERENCE_CONDITIONS')
|
| 130 |
+
def test_31_zero_radius_stop_distance_and_sampling(self):
|
| 131 |
+
h=setup(radius=0.);self.rejected(h,'acquisition.start','ZERO_TRACK_RADIUS');h=setup(method={'stop_distance_m':.012345});r=run(h);self.assertEqual(r['phase'],'succeeded');self.assertAlmostEqual(r['sliding_distance_m'],.012345,places=12);self.assertAlmostEqual(r['elapsed_s'],.12345,places=10);self.assertEqual(r['rows'][-1]['elapsed_s'],r['elapsed_s']);self.assertGreater(h.time_s,r['elapsed_s']);self.rejected(h,'method.configure','SAMPLING_GRID',**dict(h.method,sample_interval_s=.15))
|
| 132 |
+
def test_32_schema_input_nonfinite_and_unsupported(self):
|
| 133 |
+
h=setup()
|
| 134 |
+
for v in [float('nan'),float('inf'),-1,True]:
|
| 135 |
+
before=state(h)
|
| 136 |
+
with self.assertRaises(rt.ActionRejected):h.step(v)
|
| 137 |
+
self.assertEqual(state(h),before)
|
| 138 |
+
for k in rt.UNSUPPORTED:self.rejected(h,k,'UNSUPPORTED')
|
| 139 |
+
self.rejected(h,'method.configure',**dict(rt.METHOD_EXAMPLE,bogus=1));self.rejected(h,'power.set',enabled=1)
|
| 140 |
+
def test_33_history_stable_on_new_sample_and_new_operation(self):
|
| 141 |
+
h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='a')['operation_id'];h.step(2.);old=s.poll(op);access(h);call(h,'specimen.remove');call(h,'specimen.load',**dict(rt.SAMPLE_EXAMPLE,reference_id='cr100_leadbronze_dry_005'));call(h,'contact.set',engaged=True);call(h,'lid.set',opened=False);s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='b');h.step(.1);self.assertEqual(s.poll(op),old)
|
| 142 |
+
def test_34_negative_source_not_silently_made_dissipative(self):
|
| 143 |
+
r=copy.deepcopy(rt.library()['substances'][rt.SAMPLE_EXAMPLE['reference_id']]);r['values']['friction_coefficient'][0]=-.1
|
| 144 |
+
with self.assertRaisesRegex(rt.ActionRejected,'INVALID_REFERENCE'):rt.curve(r)
|
| 145 |
+
def test_35_plant_initial_only_and_explicit_assumptions(self):
|
| 146 |
+
h=setup();self.rejected(h,'plant.configure','INITIALIZATION_ONLY',**rt.PLANT_EXAMPLE)
|
| 147 |
+
h=rt.AntonpaarTrbRuntime();self.rejected(h,'plant.configure','MODEL_NOT_ACCEPTED',**dict(rt.PLANT_EXAMPLE,accept_engineering=False));self.rejected(h,'plant.configure','THERMAL_CONFIGURATION',**dict(rt.PLANT_EXAMPLE,heater_max_w=10.))
|
| 148 |
+
def test_35b_strict_temperature_is_checked_during_friction(self):
|
| 149 |
+
h=setup(plant={'thermal_capacity_j_k':.01,'heat_loss_w_k':0.},sample={'accept_condition_transfer':False},method={'temperature_tolerance_k':.01});r=run(h);self.assertEqual(r['error_code'],'REFERENCE_CONDITIONS');self.assertEqual(r['phase'],'failed');self.assertGreater(h.friction_energy,0);self.ledger(h)
|
| 150 |
+
def test_35c_cancel_retry_old_operation_cannot_cancel_new(self):
|
| 151 |
+
h=setup();s=h.session();first=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='first')['operation_id'];h.step(.2);r=s.cancel(first,'cancel');second=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='second')['operation_id'];before=state(h);self.assertEqual(s.cancel(first,'cancel'),r);self.assertEqual(state(h),before);self.assertEqual(h.phase,'running')
|
| 152 |
+
with self.assertRaisesRegex(rt.ActionRejected,'REQUEST_CONFLICT'):s.cancel(second,'cancel')
|
| 153 |
+
self.assertEqual(state(h),before)
|
| 154 |
+
def test_36_actual_all_api_outputs_and_state_schema(self):
|
| 155 |
+
h=setup();call(h,'sim.step',dt_s=.1);call(h,'acquisition.start');h.step(.3);call(h,'acquisition.stop');access(h);call(h,'motion.home');h.step(4.);call(h,'thermal.set_temperature',temperature_k=296.15);call(h,'sensor.calibrate',**rt.CAPS['sensor.calibrate']['example_arguments']);call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);call(h,'analysis.hertz',**rt.CAPS['analysis.hertz']['example_arguments']);call(h,'analysis.wear_profile',**rt.CAPS['analysis.wear_profile']['example_arguments']);call(h,'emergency.stop');call(h,'emergency.reset');cleanup(h)
|
| 156 |
+
h=setup(lubricant={});cleanup(h);call(h,'ledger.read');call(h,'acquisition.result');meta=rt.export_antonpaar_trb_contract_metadata();seen={k for k,a,r in OBSERVED};self.assertEqual(set(rt.CAPS)-set(rt.UNSUPPORTED)-seen,set())
|
| 157 |
+
p=ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py';sp=importlib.util.spec_from_file_location('trb_asset_tool',p);m=importlib.util.module_from_spec(sp);sys.modules[sp.name]=m;sp.loader.exec_module(m)
|
| 158 |
+
for k,a,r in OBSERVED:
|
| 159 |
+
errors=m.validate_value(a,meta['capabilities'][k]['input_schema'],path=k+'.input')+m.validate_value(r,meta['capabilities'][k]['output_schema'],path=k+'.output');self.assertEqual(errors,[],k)
|
| 160 |
+
for snapshot in STATES:
|
| 161 |
+
self.assertEqual(set(snapshot),set(meta['state_slots']))
|
| 162 |
+
for k,v in snapshot.items():
|
| 163 |
+
errors=m.validate_value(v,meta['state_slots'][k]['value_schema'],path=k);self.assertEqual(errors,[],k)
|
| 164 |
+
for k,c in meta['capabilities'].items():
|
| 165 |
+
errors=m.lint_schema(c['input_schema'],path=k+'.input')+m.lint_schema(c['output_schema'],path=k+'.output');self.assertEqual(errors,[],k)
|
| 166 |
+
for e in c['state_effects']:self.assertIn(e['state_id'],meta['state_slots'])
|
| 167 |
+
|
| 168 |
+
if __name__=='__main__':unittest.main()
|
tests/test_asset_bd_facsariaiii.py
ADDED
|
@@ -0,0 +1,1220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM-168 BD FACSAria III cell sorter: runtime tests (python3 -m unittest tests/test_asset_bd_facsariaiii.py, matterix env)."""
|
| 2 |
+
import copy
|
| 3 |
+
import json
|
| 4 |
+
import math
|
| 5 |
+
import sys
|
| 6 |
+
import unittest
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 10 |
+
sys.path.insert(0, str(ROOT / 'scripts'))
|
| 11 |
+
sys.path.insert(0, str(ROOT / 'skills/chemistry-lab-assets/scripts'))
|
| 12 |
+
from asset_runtime import bd_facsariaiii as m # noqa: E402
|
| 13 |
+
import asset_tool # noqa: E402
|
| 14 |
+
|
| 15 |
+
rt = m
|
| 16 |
+
PSI = m.PSI
|
| 17 |
+
SEEN = set() # (capability, rejection code) pairs produced by the tests
|
| 18 |
+
CHECKS, PROCESS_EVIDENCE, REJECTIONS = [], {}, {}
|
| 19 |
+
_META = {}
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def _meta():
|
| 23 |
+
if not _META:
|
| 24 |
+
_META.update(m.export_bd_facsariaiii_contract_metadata())
|
| 25 |
+
return _META
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def _changed(a, b):
|
| 29 |
+
return json.dumps(a, sort_keys=True, default=str) != json.dumps(b, sort_keys=True, default=str)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
_orig_invoke = m.BdFacsariaiiiRuntime.invoke
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def _instrumented_invoke(self, capability_id, **a):
|
| 36 |
+
"""Every successful call is checked against its declared output schema, the clock and the declared immediate effects; every rejection code is
|
| 37 |
+
recorded."""
|
| 38 |
+
before = self.read('evaluator') if capability_id != 'sim.step' else None
|
| 39 |
+
t0 = self.t
|
| 40 |
+
try:
|
| 41 |
+
out = _orig_invoke(self, capability_id, **a)
|
| 42 |
+
except m.ActionRejected as exc:
|
| 43 |
+
REJECTIONS.setdefault(capability_id, set()).add(str(exc))
|
| 44 |
+
if before is not None:
|
| 45 |
+
after = self.read('evaluator')
|
| 46 |
+
ch = {k for k in after if _changed(before[k], after[k])}
|
| 47 |
+
if ch:
|
| 48 |
+
raise AssertionError(f'{capability_id} rejected but changed state: {sorted(ch)}')
|
| 49 |
+
raise
|
| 50 |
+
meta = _meta()['capabilities'][capability_id]
|
| 51 |
+
errs = asset_tool.validate_value(out, meta['output_schema'])
|
| 52 |
+
if errs:
|
| 53 |
+
raise AssertionError(f'{capability_id} output violates its schema: {errs[:3]}')
|
| 54 |
+
if before is not None:
|
| 55 |
+
assert self.t == t0, capability_id
|
| 56 |
+
after = self.read('evaluator')
|
| 57 |
+
undeclared = {k for k in after if _changed(before[k], after[k])} - set(m.EFFECTS.get(capability_id, []))
|
| 58 |
+
if undeclared:
|
| 59 |
+
raise AssertionError(f'{capability_id} changed undeclared state immediately: {sorted(undeclared)}')
|
| 60 |
+
PROCESS_EVIDENCE.setdefault(capability_id, []).append(dict(arguments=json.loads(json.dumps(a, default=str)), result_keys=sorted(out)))
|
| 61 |
+
return out
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
m.BdFacsariaiiiRuntime.invoke = _instrumented_invoke
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
class Rig:
|
| 68 |
+
def __init__(self, seed=7, room=295.15):
|
| 69 |
+
self.R = m.BdFacsariaiiiRuntime()
|
| 70 |
+
self.R.register_principal('agent', 'agent')
|
| 71 |
+
self.R.register_principal('other', 'agent')
|
| 72 |
+
self.R.register_principal('ev', 'evaluator')
|
| 73 |
+
self.A, self.B, self.E = self.R.session('agent'), self.R.session('other'), self.R.session('ev')
|
| 74 |
+
self.I = self.R.instance_id
|
| 75 |
+
self.n = 0
|
| 76 |
+
self.call(self.E, 'plant.configure', room_k=room, mains_voltage_v=230.0, noise_seed=seed)
|
| 77 |
+
|
| 78 |
+
def call(self, s, cap, expect=None, **a):
|
| 79 |
+
self.n += 1
|
| 80 |
+
r = s.invoke(instance_id=self.I, capability_id=cap, arguments=a, request_id=f'q{self.n}')
|
| 81 |
+
if expect is None:
|
| 82 |
+
assert r['status'] in ('succeeded', 'accepted'), (cap, r['error'])
|
| 83 |
+
else:
|
| 84 |
+
assert r['status'] in ('rejected', 'unsupported') and r['error']['code'] == expect, (cap, expect, r['status'], r['error'])
|
| 85 |
+
SEEN.add((cap, expect))
|
| 86 |
+
return r
|
| 87 |
+
|
| 88 |
+
def rd(self, *ids):
|
| 89 |
+
return {k: v['value'] for k, v in self.E.read(instance_id=self.I, state_ids=list(ids))['observations'].items()}
|
| 90 |
+
|
| 91 |
+
def v(self, k):
|
| 92 |
+
return self.rd(k)[k]
|
| 93 |
+
|
| 94 |
+
def step(self, dt):
|
| 95 |
+
self.call(self.E, 'sim.step', dt_s=float(dt))
|
| 96 |
+
|
| 97 |
+
def ready(self, warm=True, sweet=True, preset=None):
|
| 98 |
+
A = self.A
|
| 99 |
+
self.call(A, 'power.press_switch')
|
| 100 |
+
for L in m.LASERS:
|
| 101 |
+
self.call(A, 'lasers.set', laser=L, enabled=True)
|
| 102 |
+
if preset:
|
| 103 |
+
self.call(A, 'door.set', door='flow_cell', angle_rad=1.2)
|
| 104 |
+
self.call(A, 'nozzle.install', nozzle=m._cal()['presets'][preset]['nozzle_um'])
|
| 105 |
+
self.call(A, 'door.set', door='flow_cell', angle_rad=0.0)
|
| 106 |
+
self.call(A, 'sort_setup.select', preset=preset)
|
| 107 |
+
self.call(A, 'fluidics.startup')
|
| 108 |
+
self.step(m.STARTUP_S + 1)
|
| 109 |
+
self.call(A, 'stream.set', on=True)
|
| 110 |
+
self.step(30)
|
| 111 |
+
if sweet:
|
| 112 |
+
self.call(A, 'sweet_spot.set', enabled=True)
|
| 113 |
+
if warm:
|
| 114 |
+
self.step(m.WARMUP_S)
|
| 115 |
+
|
| 116 |
+
def provide(self, sid, pops, vol=3e-6):
|
| 117 |
+
self.call(self.E, 'sample.provide', sample_id=sid, volume_m3=vol, populations=pops)
|
| 118 |
+
|
| 119 |
+
def tube(self, tid, sources, buf=0.0, s=None, ttype='12x75'):
|
| 120 |
+
self.call(s or self.A, 'tube.prepare', tube_id=tid, tube_type=ttype, sources=sources, buffer_volume_m3=buf)
|
| 121 |
+
|
| 122 |
+
def load(self, tid, s=None, wait=5.0):
|
| 123 |
+
self.call(s or self.A, 'tube.install', tube_id=tid)
|
| 124 |
+
self.call(s or self.A, 'sample.load')
|
| 125 |
+
self.step(wait)
|
| 126 |
+
|
| 127 |
+
def unload(self, s=None):
|
| 128 |
+
self.call(s or self.A, 'sample.unload')
|
| 129 |
+
self.step(4)
|
| 130 |
+
self.call(s or self.A, 'tube.remove')
|
| 131 |
+
|
| 132 |
+
def stats(self, source='live', gates=None, params=None, comp=None):
|
| 133 |
+
a = dict(source=source)
|
| 134 |
+
if comp is not None:
|
| 135 |
+
a['compensation'] = comp
|
| 136 |
+
if gates is not None:
|
| 137 |
+
a['gates'] = gates
|
| 138 |
+
if params is not None:
|
| 139 |
+
a['parameters'] = params
|
| 140 |
+
return self.call(self.A, 'statistics.read', **a)['result']
|
| 141 |
+
|
| 142 |
+
def record(self, rid, n):
|
| 143 |
+
op = self.call(self.A, 'acquisition.record', record_id=rid, events=n)['operation_id']
|
| 144 |
+
for _ in range(600):
|
| 145 |
+
if self.A.poll(op)['status'] != 'running':
|
| 146 |
+
break
|
| 147 |
+
self.step(0.5)
|
| 148 |
+
return self.A.poll(op)
|
| 149 |
+
|
| 150 |
+
def install(self, device, prefill=5e-7):
|
| 151 |
+
self.call(self.A, 'door.set', door='sort_chamber', angle_rad=1.6)
|
| 152 |
+
self.call(self.A, 'collection.install', device=device, prefill_m3=prefill)
|
| 153 |
+
self.call(self.A, 'door.set', door='sort_chamber', angle_rad=0.0)
|
| 154 |
+
|
| 155 |
+
def sort(self, lid, max_s=120.0):
|
| 156 |
+
op = self.call(self.A, 'sort.start', layout_id=lid)['operation_id']
|
| 157 |
+
t = 0.0
|
| 158 |
+
while self.A.poll(op)['status'] == 'running' and t < max_s:
|
| 159 |
+
self.step(1.0)
|
| 160 |
+
t += 1.0
|
| 161 |
+
return op
|
| 162 |
+
|
| 163 |
+
def collected(self):
|
| 164 |
+
out = {}
|
| 165 |
+
for loc in self.call(self.E, 'collection.inspect')['result']['locations']:
|
| 166 |
+
out[loc['location']] = {p['population_id'].split('/')[-1]: p['particles'] for p in loc['populations']}
|
| 167 |
+
return out
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
PBMC = [dict(population_id='cd4', particle_id='human_t_cell_cd4', concentration_per_m3=6e12, stains=[dict(dye='fluorescein_fitc', molecules=45000.0, cv=0.35)]),
|
| 171 |
+
dict(population_id='bcell', particle_id='human_b_cell', concentration_per_m3=4e12, stains=[dict(dye='fluorescein_fitc', molecules=300.0, cv=0.5)])]
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
def set_true_drop_delay(rig):
|
| 175 |
+
rig.call(rig.A, 'drop_delay.set', drops=round(rig.v('truth.drop_delay_drops'), 2)) # as found by Accudrop (tested separately)
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
def purity(c, loc, pop):
|
| 179 |
+
tot = sum(c.get(loc, {}).values())
|
| 180 |
+
return c[loc].get(pop, 0.0) / tot if tot else 0.0
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def two_way(rig, mode='purity', n=8000, lid='two'):
|
| 184 |
+
A = rig.A
|
| 185 |
+
rig.call(A, 'gate.define', gate_id='cells', kind='rectangle', x='FSC-A', y='SSC-A', x_range=[20000.0, 262143.0], y_range=[0.0, 262143.0])
|
| 186 |
+
rig.call(A, 'gate.define', gate_id='singlets', parent='cells', kind='interval', x='FSC-W', x_range=[0.0, 85000.0]) # doublet discrimination
|
| 187 |
+
rig.call(A, 'gate.define', gate_id='pos', parent='singlets', kind='interval', x='B530_30-A', x_range=[3000.0, 262143.0])
|
| 188 |
+
rig.call(A, 'gate.define', gate_id='neg', parent='singlets', kind='interval', x='B530_30-A', x_range=[-2000.0, 1500.0])
|
| 189 |
+
rig.install('2way_12x75')
|
| 190 |
+
rig.call(A, 'deflection.set', voltage_on=True)
|
| 191 |
+
rig.call(A, 'sort.layout', layout_id=lid, device='2way_12x75', precision_mode=mode, targets={'left': 'pos', 'right': 'neg'},
|
| 192 |
+
target_events={'left': n, 'right': n})
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
# ---------------------------------------------------------------- libraries, calibration, contract
|
| 196 |
+
class ContractAndLibraries(unittest.TestCase):
|
| 197 |
+
def test_contract_metadata_and_examples(self):
|
| 198 |
+
meta = m.export_bd_facsariaiii_contract_metadata()
|
| 199 |
+
self.assertEqual(meta['asset_type_id'], 'instrument.bd_facsariaiii')
|
| 200 |
+
self.assertGreaterEqual(len(meta['capabilities']), 60)
|
| 201 |
+
for k, c in meta['capabilities'].items():
|
| 202 |
+
m.validate(c['input_schema'], c['example_arguments'])
|
| 203 |
+
for e in c['state_effects']:
|
| 204 |
+
self.assertIn(e['state_id'], meta['state_slots'])
|
| 205 |
+
for k, s in meta['state_slots'].items():
|
| 206 |
+
self.assertIn(s['unit'], ('1', 's', 'm', 'rad', 'K', 'Pa', 'V', 'Hz', 'W', 'm3', '1/s', 'm/s', 'K/s', '1/min', '°C', 'J', 'm3/s'), k)
|
| 207 |
+
agent_caps = [k for k, c in meta['capabilities'].items() if c['visibility'] == 'agent']
|
| 208 |
+
for k in agent_caps:
|
| 209 |
+
for e in meta['capabilities'][k]['observes']:
|
| 210 |
+
self.assertEqual(meta['state_slots'][e]['visibility'], 'agent', (k, e))
|
| 211 |
+
|
| 212 |
+
def test_libraries_real_data(self):
|
| 213 |
+
fl, pl = m.fluorochromes(), m.particles()
|
| 214 |
+
self.assertGreaterEqual(len(fl), 50)
|
| 215 |
+
self.assertGreaterEqual(len(pl), 25)
|
| 216 |
+
self.assertTrue(all('FPbase' in d['source'] for d in fl.values()))
|
| 217 |
+
self.assertTrue(all(len(p['scatter']['fsc_cross_section_m2']) == len(p['scatter']['diameter_um']) for p in pl.values()))
|
| 218 |
+
pb = m._photon()
|
| 219 |
+
i = pb['didx']['fluorescein_fitc']
|
| 220 |
+
j = m.FL_DETS.index('B530_30')
|
| 221 |
+
q = pb['q'][i, j]
|
| 222 |
+
self.assertAlmostEqual(q, m.optics()['detectors']['B530_30']['q_pe_per_mesf'], places=9)
|
| 223 |
+
# documented 85 MESF-FITC = 3 sqrt(background) / Q
|
| 224 |
+
self.assertAlmostEqual(3 * math.sqrt(pb['bg'][j]) / q, 85.0, places=6)
|
| 225 |
+
|
| 226 |
+
def test_fluidics_calibration_reproduces_table_3_1(self):
|
| 227 |
+
cal = m._cal()['presets']
|
| 228 |
+
for name, dd in (('70_high', 44.0), ('70_medium', 45.0), ('100', 29.0), ('85', 37.0), ('130', 24.0)):
|
| 229 |
+
c = cal[name]
|
| 230 |
+
q = m._q_sheath(c['a'] * 2, c['v'])
|
| 231 |
+
self.assertAlmostEqual(c['frequency_hz'] * c['vdead'] / q + c['nb_ref'], dd, places=9)
|
| 232 |
+
self.assertTrue(4.0 < c['lambda_over_d'] < 4.6, (name, c['lambda_over_d'])) # near the Rayleigh optimum 4.51
|
| 233 |
+
# the documented High (60 V, attenuation off) and Medium (50 V, attenuation on) defaults give one coupling of the 70 um nozzle
|
| 234 |
+
self.assertAlmostEqual(cal['70_high']['G'] / cal['70_medium']['G'], 1.0, delta=0.01)
|
| 235 |
+
r = Rig()
|
| 236 |
+
r.ready(warm=False, sweet=False, preset='70_medium')
|
| 237 |
+
d = r.v('truth.laser_delays_s')
|
| 238 |
+
self.assertAlmostEqual(d['violet'] * 1e6, 54.0, delta=0.6)
|
| 239 |
+
self.assertAlmostEqual(d['red'] * 1e6, -54.0, delta=0.6)
|
| 240 |
+
|
| 241 |
+
def test_water_properties(self):
|
| 242 |
+
self.assertAlmostEqual(m.water_surface_tension(293.15), 0.07274, delta=2e-5)
|
| 243 |
+
self.assertAlmostEqual(m.water_density(277.13), 999.97, delta=0.01)
|
| 244 |
+
self.assertAlmostEqual(m.water_viscosity(293.15), 1.002e-3, delta=1.5e-5)
|
| 245 |
+
|
| 246 |
+
|
| 247 |
+
# ---------------------------------------------------------------- fluidics, breakoff, Sweet Spot
|
| 248 |
+
class Fluidics(unittest.TestCase):
|
| 249 |
+
def test_startup_stream_and_cart(self):
|
| 250 |
+
r = Rig()
|
| 251 |
+
A = r.A
|
| 252 |
+
r.call(A, 'stream.set', 'POWER_OFF', on=True)
|
| 253 |
+
r.call(A, 'power.press_switch')
|
| 254 |
+
r.call(A, 'stream.set', 'FLUIDICS_NOT_READY', on=True)
|
| 255 |
+
op = r.call(A, 'fluidics.startup')['operation_id']
|
| 256 |
+
r.call(A, 'fluidics.startup', 'FLUIDICS_BUSY')
|
| 257 |
+
r.step(m.STARTUP_S - 1)
|
| 258 |
+
self.assertEqual(A.poll(op)['status'], 'running')
|
| 259 |
+
r.step(2)
|
| 260 |
+
self.assertEqual(A.poll(op)['status'], 'succeeded')
|
| 261 |
+
self.assertAlmostEqual(r.v('cart.air_pressure_pa') / PSI, 88.0, delta=0.5)
|
| 262 |
+
self.assertAlmostEqual(r.v('cart.gauge_angle_rad'), 88.0 / 160.0 * 1.5 * math.pi, delta=0.02)
|
| 263 |
+
sheath0 = r.v('truth.cart_sheath_m3')
|
| 264 |
+
r.call(A, 'stream.set', on=True)
|
| 265 |
+
r.step(60)
|
| 266 |
+
self.assertAlmostEqual(r.v('sheath.pressure_pa') / PSI, 70.0, delta=0.05)
|
| 267 |
+
used = sheath0 - r.v('truth.cart_sheath_m3')
|
| 268 |
+
q = r.v('truth.jet_speed_m_s') * math.pi * 35e-6 ** 2
|
| 269 |
+
self.assertAlmostEqual(used / 60.0, q, delta=0.05 * q) # ~6.5 ml/min at 70 psi
|
| 270 |
+
self.assertAlmostEqual(q * 6e7, 6.46, delta=0.1)
|
| 271 |
+
r.call(A, 'cart.refill_sheath', 'STREAM_ON', volume_m3=0.001)
|
| 272 |
+
r.call(A, 'fluidics.shutdown', 'STREAM_ON')
|
| 273 |
+
r.call(A, 'stream.set', on=False)
|
| 274 |
+
r.call(A, 'fluidics.shutdown', 'CLOSED_LOOP_NOZZLE_REQUIRED')
|
| 275 |
+
r.call(A, 'nozzle.install', 'DOOR_CLOSED', nozzle='closed_loop')
|
| 276 |
+
r.call(A, 'door.set', door='flow_cell', angle_rad=1.2)
|
| 277 |
+
r.call(A, 'nozzle.install', nozzle='closed_loop')
|
| 278 |
+
op = r.call(A, 'fluidics.shutdown')['operation_id']
|
| 279 |
+
r.step(m.SHUTDOWN_S + 1)
|
| 280 |
+
self.assertEqual(A.poll(op)['status'], 'succeeded')
|
| 281 |
+
self.assertEqual(r.v('fluidics.state'), 'shutdown')
|
| 282 |
+
|
| 283 |
+
def test_drop1_jumps_by_the_drop_spacing_and_gap_is_continuous(self):
|
| 284 |
+
r = Rig()
|
| 285 |
+
r.ready(warm=False, sweet=False)
|
| 286 |
+
A = r.A
|
| 287 |
+
rows = []
|
| 288 |
+
for amp in [50.0 + 0.5 * k for k in range(41)]:
|
| 289 |
+
r.call(A, 'breakoff.set', amplitude_v=amp)
|
| 290 |
+
o = r.rd('breakoff.drop1_px', 'breakoff.gap_px', 'breakoff.drop_spacing_px', 'truth.breakoff_length_m')
|
| 291 |
+
rows.append((amp, o['breakoff.drop1_px'], o['breakoff.gap_px'], o['breakoff.drop_spacing_px'], o['truth.breakoff_length_m']))
|
| 292 |
+
d1 = sorted({round(x[1], 1) for x in rows})
|
| 293 |
+
self.assertGreaterEqual(len(d1), 2)
|
| 294 |
+
for a, b in zip(d1, d1[1:]):
|
| 295 |
+
self.assertAlmostEqual(b - a, rows[0][3], delta=0.2) # documented ~57 px jumps
|
| 296 |
+
self.assertTrue(all(rows[i][4] > rows[i + 1][4] for i in range(len(rows) - 1))) # higher amplitude: shorter breakoff
|
| 297 |
+
self.assertTrue(all(0 < x[2] <= x[3] + 1e-6 for x in rows))
|
| 298 |
+
|
| 299 |
+
def test_sweet_spot_holds_breakoff_and_drop_delay_while_sheath_warms(self):
|
| 300 |
+
drift = {}
|
| 301 |
+
for sweet in (False, True):
|
| 302 |
+
r = Rig()
|
| 303 |
+
r.ready(warm=False, sweet=sweet)
|
| 304 |
+
r.step(300) # Sweet Spot first pulls the Gap to its 6-px target
|
| 305 |
+
a0 = r.rd('breakoff.drop1_px', 'truth.drop_delay_drops', 'breakoff.amplitude_v')
|
| 306 |
+
r.step(1800)
|
| 307 |
+
a1 = r.rd('breakoff.drop1_px', 'breakoff.gap_px', 'truth.drop_delay_drops', 'breakoff.amplitude_v', 'truth.sheath_temperature_k', 'sweet_spot.paused')
|
| 308 |
+
drift[sweet] = (a0, a1)
|
| 309 |
+
off0, off1 = drift[False]
|
| 310 |
+
on0, on1 = drift[True]
|
| 311 |
+
self.assertGreater(abs(off1['truth.drop_delay_drops'] - off0['truth.drop_delay_drops']), 0.1) # unattended stream drifts (~1 K warm-up)
|
| 312 |
+
self.assertLess(abs(on1['truth.drop_delay_drops'] - on0['truth.drop_delay_drops']), 0.05)
|
| 313 |
+
self.assertNotEqual(on1['breakoff.amplitude_v'], on0['breakoff.amplitude_v'])
|
| 314 |
+
self.assertLessEqual(abs(on1['breakoff.gap_px'] - 6.0), 2.0)
|
| 315 |
+
self.assertFalse(on1['sweet_spot.paused'])
|
| 316 |
+
|
| 317 |
+
def test_sweet_spot_locks_controls_and_attenuation(self):
|
| 318 |
+
r = Rig()
|
| 319 |
+
r.ready(warm=False)
|
| 320 |
+
A = r.A
|
| 321 |
+
r.call(A, 'breakoff.set', 'SWEET_SPOT_ON', amplitude_v=40.0)
|
| 322 |
+
r.call(A, 'sheath.set_pressure', 'SWEET_SPOT_ON', pressure_pa=60 * PSI)
|
| 323 |
+
r.call(A, 'sort_setup.select', 'STREAM_ON', preset='100')
|
| 324 |
+
b0 = r.v('truth.breakoff_length_m')
|
| 325 |
+
r.call(A, 'sweet_spot.set', enabled=False)
|
| 326 |
+
r.call(A, 'breakoff.set', attenuation=True)
|
| 327 |
+
self.assertGreater(r.v('truth.breakoff_length_m'), b0 + 1e-3) # attenuated drive: much longer breakoff
|
| 328 |
+
|
| 329 |
+
def test_cart_air_leak_limits_sheath_pressure(self):
|
| 330 |
+
r = Rig()
|
| 331 |
+
r.ready(warm=False, sweet=False)
|
| 332 |
+
r.call(r.E, 'fault.inject', fault='cart_air_leak', active=True)
|
| 333 |
+
r.step(300)
|
| 334 |
+
o = r.rd('cart.air_pressure_pa', 'sheath.pressure_pa', 'warnings.active')
|
| 335 |
+
self.assertLess(o['cart.air_pressure_pa'] / PSI, 41.0)
|
| 336 |
+
self.assertLess(o['sheath.pressure_pa'] / PSI, 36.0)
|
| 337 |
+
self.assertIn('SHEATH_PRESSURE_LOW', o['warnings.active'])
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
# ---------------------------------------------------------------- acquisition physics
|
| 341 |
+
class Acquisition(unittest.TestCase):
|
| 342 |
+
def test_event_rate_follows_concentration_and_flow(self):
|
| 343 |
+
r = Rig()
|
| 344 |
+
r.ready(sweet=False)
|
| 345 |
+
r.provide('s', PBMC)
|
| 346 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 347 |
+
conc = (6e12 + 4e12) * 2e-6 / 3e-6
|
| 348 |
+
r.load('t')
|
| 349 |
+
for setting in (1.0, 6.0):
|
| 350 |
+
r.call(r.A, 'acquisition.flow_rate', setting=setting)
|
| 351 |
+
r.step(3)
|
| 352 |
+
q = r.R._flow_m3_s()
|
| 353 |
+
self.assertAlmostEqual(r.v('acquisition.threshold_rate_eps'), conc * q, delta=0.06 * conc * q)
|
| 354 |
+
self.assertAlmostEqual(r.R._flow_m3_s() * 6e10, 65.0, delta=0.01) # setting 6: 65 ul/min (linear 10-120)
|
| 355 |
+
|
| 356 |
+
def test_cv_rises_with_flow_rate_core_width(self):
|
| 357 |
+
cv = {}
|
| 358 |
+
for setting in (1.0, 11.0):
|
| 359 |
+
r = Rig()
|
| 360 |
+
r.ready(sweet=False)
|
| 361 |
+
r.tube('b', [dict(bead_id='cst_bead_bright', volume_m3=3e-7)], 7e-7)
|
| 362 |
+
r.call(r.A, 'acquisition.flow_rate', setting=setting)
|
| 363 |
+
r.load('b', wait=8.0)
|
| 364 |
+
st = r.stats(params=['B530_30-A'])
|
| 365 |
+
cv[setting] = st['rows'][0]['parameters'][0]['rcv']
|
| 366 |
+
self.assertLess(cv[1.0], 0.04)
|
| 367 |
+
self.assertGreater(cv[11.0], cv[1.0] + 0.015)
|
| 368 |
+
|
| 369 |
+
def test_shutter_lasers_warmup_and_threshold(self):
|
| 370 |
+
r = Rig()
|
| 371 |
+
r.ready(warm=False, sweet=False)
|
| 372 |
+
r.provide('s', PBMC)
|
| 373 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 374 |
+
r.load('t')
|
| 375 |
+
self.assertIn('LASERS_WARMING', r.v('warnings.active'))
|
| 376 |
+
p_cold = r.v('lasers.power_w')['blue']
|
| 377 |
+
cold = r.stats(params=['B530_30-A'])['rows'][0]['parameters'][0]['median']
|
| 378 |
+
r.call(r.A, 'door.set', door='flow_cell', angle_rad=0.5)
|
| 379 |
+
r.step(2)
|
| 380 |
+
self.assertEqual(r.v('acquisition.threshold_rate_eps'), 0.0) # shutter blocks the lasers
|
| 381 |
+
r.call(r.A, 'door.set', door='flow_cell', angle_rad=0.0)
|
| 382 |
+
r.step(1800)
|
| 383 |
+
r.step(2)
|
| 384 |
+
warm = r.stats(params=['B530_30-A'])['rows'][0]['parameters'][0]['median']
|
| 385 |
+
self.assertGreater(r.v('lasers.power_w')['blue'], p_cold * 1.04) # power rises during the 30-min warm-up
|
| 386 |
+
self.assertGreater(warm, cold * 1.02)
|
| 387 |
+
self.assertNotIn('LASERS_WARMING', r.v('warnings.active'))
|
| 388 |
+
rate = r.v('acquisition.threshold_rate_eps')
|
| 389 |
+
r.call(r.A, 'cytometer.settings', thresholds=[dict(parameter='FSC', value=150000.0)])
|
| 390 |
+
r.step(2)
|
| 391 |
+
self.assertLess(r.v('acquisition.threshold_rate_eps'), 0.2 * rate)
|
| 392 |
+
|
| 393 |
+
def test_doublets_widen_and_double_area(self):
|
| 394 |
+
r = Rig()
|
| 395 |
+
r.ready(sweet=False)
|
| 396 |
+
r.provide('c', [dict(population_id='cen', particle_id='chicken_erythrocyte_nucleus', concentration_per_m3=4e12, doublet_fraction=0.2,
|
| 397 |
+
stains=[dict(dye='propidium_iodide', molecules=8.0e8, cv=0.015)])])
|
| 398 |
+
r.tube('t', [dict(sample_id='c', volume_m3=2e-6)], 1e-6)
|
| 399 |
+
r.call(r.A, 'cytometer.settings', voltages={'B695_40': 420.0})
|
| 400 |
+
r.load('t', wait=10)
|
| 401 |
+
p = r.call(r.A, 'record.read', record_id=r.record('cen', 4000)['result']['record_id'], parameters=['B695_40-A', 'FSC-W'], max_events=4000)['result']
|
| 402 |
+
import numpy as np
|
| 403 |
+
X = np.array(p['events'])
|
| 404 |
+
a = X[:, 0]
|
| 405 |
+
med = np.median(a)
|
| 406 |
+
single = (a > 0.8 * med) & (a < 1.25 * med)
|
| 407 |
+
double = (a > 1.6 * med) & (a < 2.5 * med)
|
| 408 |
+
ratio = np.median(a[double]) / np.median(a[single])
|
| 409 |
+
self.assertTrue(1.95 <= ratio <= 2.05, ratio) # documented linearity 1.95-2.05
|
| 410 |
+
self.assertGreater(np.median(X[double, 1]), 1.15 * np.median(X[single, 1]))
|
| 411 |
+
self.assertLess(np.std(a[single]) / np.mean(a[single]), 0.03) # documented PI-CEN CV < 3 %
|
| 412 |
+
|
| 413 |
+
def test_dim_bead_sensitivity_matches_85_mesf(self):
|
| 414 |
+
r = Rig()
|
| 415 |
+
r.ready(sweet=False)
|
| 416 |
+
r.tube('b', [dict(bead_id='ps_bead_3um', volume_m3=2e-7, stains=[dict(dye='fluorescein_fitc', molecules=85.0, cv=0.02)]),
|
| 417 |
+
dict(bead_id='ps_bead_3um', volume_m3=2e-7)], 6e-7)
|
| 418 |
+
r.call(r.A, 'cytometer.settings', voltages={'B530_30': 650.0})
|
| 419 |
+
r.load('b', wait=6)
|
| 420 |
+
import numpy as np
|
| 421 |
+
rec = r.record('dim', 6000)['result']['record_id']
|
| 422 |
+
X = np.array(r.call(r.A, 'record.read', record_id=rec, parameters=['B530_30-A'], max_events=5000)['result']['events'])[:, 0]
|
| 423 |
+
lo, hi = np.percentile(X, [25, 75])
|
| 424 |
+
# two populations: blank and 85 MESF; the separation is ~3 SD of the blank (definition of the documented sensitivity)
|
| 425 |
+
blank = X[X < np.median(X)]
|
| 426 |
+
dim = X[X >= np.median(X)]
|
| 427 |
+
sep = (np.median(dim) - np.median(blank)) / np.std(blank)
|
| 428 |
+
self.assertTrue(2.0 < sep < 4.5, sep)
|
| 429 |
+
|
| 430 |
+
def test_rate_limit_and_aborts(self):
|
| 431 |
+
r = Rig()
|
| 432 |
+
r.ready(sweet=False)
|
| 433 |
+
self.assertAlmostEqual(r.v('cytometer.max_event_rate_eps'), 70000.0, delta=1.0) # documented maximum (not extrapolated above it)
|
| 434 |
+
S = {d: {d: 1.0} for d in m.FL_DETS}
|
| 435 |
+
pairs = [('V450_50', 'V510_50'), ('B530_30', 'YG582_15'), ('YG582_15', 'YG610_20'), ('YG610_20', 'YG582_15'), ('YG582_15', 'YG710_50'), ('YG710_50', 'YG780_60'),
|
| 436 |
+
('R660_20', 'R780_60'), ('R780_60', 'R660_20'), ('YG780_60', 'R780_60'), ('B695_40', 'YG710_50'), ('V510_50', 'B530_30'), ('B530_30', 'V510_50')]
|
| 437 |
+
for a, b in pairs:
|
| 438 |
+
S[a][b] = 0.1
|
| 439 |
+
r.call(r.A, 'compensation.set', enabled=True, spillover=S)
|
| 440 |
+
self.assertAlmostEqual(r.v('cytometer.max_event_rate_eps'), 70000.0 * 14 / 18, delta=1.0) # 12 detectors + 12 pairs: fewer events (assumption)
|
| 441 |
+
r.call(r.A, 'cytometer.settings', detectors_enabled=['FSC', 'SSC', 'V450_50', 'B530_30', 'YG582_15', 'YG610_20', 'R660_20', 'R780_60'])
|
| 442 |
+
self.assertAlmostEqual(r.v('cytometer.max_event_rate_eps'), 70000.0, delta=1.0) # documented: 8 parameters, 12 pairs
|
| 443 |
+
r.provide('s', [dict(population_id='p', particle_id='jurkat', concentration_per_m3=1.6e14)], vol=1e-5)
|
| 444 |
+
r.tube('t', [dict(sample_id='s', volume_m3=1.5e-6)], 0.0)
|
| 445 |
+
r.call(r.A, 'acquisition.flow_rate', setting=8.0)
|
| 446 |
+
r.load('t', wait=5)
|
| 447 |
+
o = r.rd('acquisition.threshold_rate_eps', 'acquisition.processed_rate_eps', 'acquisition.abort_rate_eps')
|
| 448 |
+
self.assertGreater(o['acquisition.threshold_rate_eps'], 72000.0)
|
| 449 |
+
self.assertAlmostEqual(o['acquisition.processed_rate_eps'], 70000.0, delta=100.0)
|
| 450 |
+
self.assertGreater(o['acquisition.abort_rate_eps'], 1000.0)
|
| 451 |
+
|
| 452 |
+
|
| 453 |
+
# ---------------------------------------------------------------- compensation, gates
|
| 454 |
+
class CompensationAndGates(unittest.TestCase):
|
| 455 |
+
def test_single_stain_compensation(self):
|
| 456 |
+
r = Rig()
|
| 457 |
+
r.ready(sweet=False)
|
| 458 |
+
A = r.A
|
| 459 |
+
r.tube('u', [dict(bead_id='ps_bead_6um', volume_m3=3e-7)], 7e-7)
|
| 460 |
+
r.tube('pe', [dict(bead_id='ps_bead_6um', volume_m3=3e-7, stains=[dict(dye='pe_r_pe_r_phycoerythrin', molecules=5.0e4, cv=0.1)])], 7e-7)
|
| 461 |
+
r.call(A, 'cytometer.settings', voltages={'YG582_15': 420.0, 'YG610_20': 420.0})
|
| 462 |
+
r.load('u')
|
| 463 |
+
r.record('unst', 3000)
|
| 464 |
+
r.unload()
|
| 465 |
+
r.load('pe')
|
| 466 |
+
r.record('pe_ctrl', 3000)
|
| 467 |
+
r.unload()
|
| 468 |
+
res = r.call(A, 'compensation.calculate', unstained_record='unst', controls={'YG582_15': 'pe_ctrl'})['result']
|
| 469 |
+
spill = res['spillover']['YG582_15']['YG610_20']
|
| 470 |
+
fl = m.fluorochromes()['pe_r_pe_r_phycoerythrin']['detector_response']
|
| 471 |
+
self.assertAlmostEqual(spill, fl['YG610_20'] / fl['YG582_15'], delta=0.03) # spectral spill from FPbase x band-pass
|
| 472 |
+
st = r.stats(source='pe_ctrl', params=['YG610_20-A'], comp='current')
|
| 473 |
+
un = r.stats(source='unst', params=['YG610_20-A'], comp='current')
|
| 474 |
+
self.assertAlmostEqual(st['rows'][0]['parameters'][0]['median'], un['rows'][0]['parameters'][0]['median'], delta=80.0)
|
| 475 |
+
raw = r.stats(source='pe_ctrl', params=['YG610_20-A']) # default: the compensation stored with the (uncompensated) record
|
| 476 |
+
self.assertFalse(raw['compensated'])
|
| 477 |
+
self.assertGreater(raw['rows'][0]['parameters'][0]['median'], st['rows'][0]['parameters'][0]['median'] + 500.0)
|
| 478 |
+
rd = r.call(A, 'record.read', record_id='pe_ctrl', parameters=['YG610_20-A'], max_events=200)['result']
|
| 479 |
+
rc = r.call(A, 'record.read', record_id='pe_ctrl', parameters=['YG610_20-A'], max_events=200, compensation='current')['result']
|
| 480 |
+
self.assertEqual((rd['compensated'], rc['compensated']), (False, True))
|
| 481 |
+
self.assertFalse(r.call(A, 'data.export', record_id='pe_ctrl', kind='fcs_csv')['result']['compensated'])
|
| 482 |
+
r.load('pe')
|
| 483 |
+
r.record('pe_after', 1000) # recorded with compensation on: stored with the record
|
| 484 |
+
self.assertTrue(r.stats(source='pe_after', params=['YG610_20-A'])['compensated'])
|
| 485 |
+
self.assertTrue([x for x in r.call(A, 'records.list')['result']['records'] if x['record_id'] == 'pe_after'][0]['compensated'])
|
| 486 |
+
r.call(A, 'compensation.set', 'INVALID_SPILLOVER', enabled=True, spillover={'B530_30': {'B530_30': 0.5}})
|
| 487 |
+
offd = [v for d, row in res['spillover'].items() for e, v in row.items() if e != d]
|
| 488 |
+
self.assertTrue(offd and min(offd) >= m.SPILL_MIN) # noise-level spillover is not a compensation pair
|
| 489 |
+
self.assertEqual(res['pairs'], len(offd))
|
| 490 |
+
|
| 491 |
+
def test_gate_hierarchy_polygon_and_errors(self):
|
| 492 |
+
r = Rig()
|
| 493 |
+
r.ready(sweet=False)
|
| 494 |
+
A = r.A
|
| 495 |
+
r.provide('s', PBMC)
|
| 496 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 497 |
+
r.load('t', wait=4)
|
| 498 |
+
r.call(A, 'gate.define', gate_id='p1', kind='polygon', x='FSC-A', y='SSC-A', vertices=[[1.0, 1.0], [262000.0, 1.0], [262000.0, 262000.0], [1.0, 262000.0]])
|
| 499 |
+
r.call(A, 'gate.define', gate_id='pos', parent='p1', kind='interval', x='B530_30-A', x_range=[3000.0, 262143.0])
|
| 500 |
+
r.call(A, 'gate.define', 'INVALID_GATE', gate_id='bad', kind='rectangle', x='FSC-A', x_range=[0.0, 1.0])
|
| 501 |
+
r.call(A, 'gate.define', 'UNKNOWN_GATE', gate_id='orphan', parent='nope', kind='interval', x='FSC-A', x_range=[0.0, 1.0])
|
| 502 |
+
st = r.stats(gates=['p1', 'pos'])
|
| 503 |
+
rows = {x['gate']: x for x in st['rows']}
|
| 504 |
+
self.assertAlmostEqual(rows['pos']['pct_parent'], 60.0, delta=3.0) # 6e12 : 4e12 populations
|
| 505 |
+
r.call(A, 'gate.delete', 'GATE_IN_USE', gate_id='p1')
|
| 506 |
+
r.call(A, 'gate.delete', gate_id='pos')
|
| 507 |
+
r.call(A, 'gate.delete', gate_id='p1')
|
| 508 |
+
|
| 509 |
+
|
| 510 |
+
# ---------------------------------------------------------------- sorting
|
| 511 |
+
class Sorting(unittest.TestCase):
|
| 512 |
+
def test_purity_mode_two_way_and_post_sort_check(self):
|
| 513 |
+
r = Rig()
|
| 514 |
+
r.ready()
|
| 515 |
+
set_true_drop_delay(r)
|
| 516 |
+
r.provide('s', PBMC)
|
| 517 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 518 |
+
r.call(r.A, 'acquisition.flow_rate', setting=3.0)
|
| 519 |
+
r.load('t')
|
| 520 |
+
two_way(r, n=6000)
|
| 521 |
+
op = r.sort('two')
|
| 522 |
+
self.assertEqual(r.A.poll(op)['status'], 'succeeded')
|
| 523 |
+
o = r.rd('sort.counts', 'sort.state', 'sort.drawer_open')
|
| 524 |
+
self.assertEqual(o['sort.counts'], {'left': 6000, 'right': 6000})
|
| 525 |
+
self.assertEqual(o['sort.state'], 'completed')
|
| 526 |
+
self.assertFalse(o['sort.drawer_open'])
|
| 527 |
+
c = r.collected()
|
| 528 |
+
self.assertGreater(purity(c, 'left', 'cd4'), 0.97)
|
| 529 |
+
self.assertGreater(purity(c, 'right', 'bcell'), 0.97)
|
| 530 |
+
# post-sort purity check: the sorted fraction is a new sample
|
| 531 |
+
r.unload()
|
| 532 |
+
r.call(r.A, 'door.set', door='sort_chamber', angle_rad=1.6)
|
| 533 |
+
samples = r.call(r.A, 'collection.remove')['result']['samples']
|
| 534 |
+
left = [s for s in samples if s.endswith('_left')][0]
|
| 535 |
+
r.tube('chk', [dict(sample_id=left, volume_m3=4.5e-7)], 0.0)
|
| 536 |
+
r.call(r.A, 'acquisition.flow_rate', setting=11.0)
|
| 537 |
+
r.load('chk', wait=20)
|
| 538 |
+
st = r.stats(gates=['cells', 'singlets', 'pos'])
|
| 539 |
+
rows = {x['gate']: x for x in st['rows']}
|
| 540 |
+
self.assertGreater(rows['pos']['events'], 100)
|
| 541 |
+
self.assertGreater(rows['pos']['pct_parent'], 94.0)
|
| 542 |
+
|
| 543 |
+
def test_yield_vs_purity_mode_tradeoff(self):
|
| 544 |
+
res = {}
|
| 545 |
+
for mode in ('yield', 'purity', '4way_purity'):
|
| 546 |
+
r = Rig(seed=3)
|
| 547 |
+
r.ready()
|
| 548 |
+
set_true_drop_delay(r)
|
| 549 |
+
r.provide('s', [dict(population_id='rare', particle_id='human_t_cell_cd4', concentration_per_m3=2e12, stains=[dict(dye='fluorescein_fitc', molecules=45000.0)]),
|
| 550 |
+
dict(population_id='bulk', particle_id='human_b_cell', concentration_per_m3=2.0e13)], vol=4e-6)
|
| 551 |
+
r.tube('t', [dict(sample_id='s', volume_m3=3e-6)], 0.0)
|
| 552 |
+
r.call(r.A, 'acquisition.flow_rate', setting=6.0)
|
| 553 |
+
r.load('t')
|
| 554 |
+
two_way(r, mode=mode, n=3000)
|
| 555 |
+
r.sort('two', max_s=60)
|
| 556 |
+
c = r.collected()
|
| 557 |
+
led = r.call(r.E, 'ledger.read')['result']['ledger']
|
| 558 |
+
res[mode] = (purity(c, 'left', 'rare'), c['left'].get('rare', 0.0) / max(1.0, r.v('sort.counts')['left']), r.v('sort.efficiency'))
|
| 559 |
+
self.assertGreater(res['purity'][0], res['yield'][0] + 0.03) # yield mode: extra drops carry bulk cells
|
| 560 |
+
self.assertGreater(res['4way_purity'][0], 0.97)
|
| 561 |
+
self.assertGreater(res['yield'][2], res['purity'][2]) # purity mode rejects conflicts
|
| 562 |
+
|
| 563 |
+
def test_conflicts_grow_with_event_rate_poisson(self):
|
| 564 |
+
eff = {}
|
| 565 |
+
for conc in (3e12, 3e13):
|
| 566 |
+
r = Rig(seed=5)
|
| 567 |
+
r.ready()
|
| 568 |
+
set_true_drop_delay(r)
|
| 569 |
+
r.provide('s', [dict(population_id='cd4', particle_id='human_t_cell_cd4', concentration_per_m3=conc * 0.5, stains=[dict(dye='fluorescein_fitc', molecules=45000.0)]),
|
| 570 |
+
dict(population_id='bcell', particle_id='human_b_cell', concentration_per_m3=conc * 0.5)], vol=4e-6)
|
| 571 |
+
r.tube('t', [dict(sample_id='s', volume_m3=3e-6)], 0.0)
|
| 572 |
+
r.call(r.A, 'acquisition.flow_rate', setting=6.0)
|
| 573 |
+
r.load('t')
|
| 574 |
+
two_way(r, mode='4way_purity', n=4000)
|
| 575 |
+
r.sort('two', max_s=60)
|
| 576 |
+
rate = r.v('acquisition.threshold_rate_eps')
|
| 577 |
+
eff[conc] = (r.v('sort.efficiency'), rate)
|
| 578 |
+
lo, hi = eff[3e12], eff[3e13]
|
| 579 |
+
self.assertGreater(lo[0], hi[0])
|
| 580 |
+
# 4-way purity (1 drop, purity mask 32): the drop and the adjacent half-drops (2 drop periods) must be free of events of the other population
|
| 581 |
+
# (half of the events); pulse pile-up merges neighbours closer than ~5 us, so the free window is effectively 2 / f - 5 us
|
| 582 |
+
r_o = 0.5 * hi[1]
|
| 583 |
+
self.assertGreater(hi[0], math.exp(-2.0 * r_o / 90000.0) - 0.02)
|
| 584 |
+
self.assertLess(hi[0], math.exp(-r_o * (2.0 / 90000.0 - 6e-6)) + 0.03)
|
| 585 |
+
|
| 586 |
+
def test_drop_delay_error_and_auto_drop_delay(self):
|
| 587 |
+
r = Rig(seed=11)
|
| 588 |
+
r.ready()
|
| 589 |
+
A = r.A
|
| 590 |
+
true_dd = r.v('truth.drop_delay_drops')
|
| 591 |
+
self.assertGreater(abs(true_dd - 44.0), 0.05) # this instrument differs from the factory default
|
| 592 |
+
r.tube('acc', [dict(bead_id='accudrop_bead', volume_m3=1e-6)], 0.0)
|
| 593 |
+
r.call(A, 'sort.auto_drop_delay', 'PLATES_OFF')
|
| 594 |
+
r.call(A, 'deflection.set', voltage_on=True)
|
| 595 |
+
r.call(A, 'sort.auto_drop_delay', 'ACCUDROP_BEADS_REQUIRED')
|
| 596 |
+
r.call(A, 'tube.install', tube_id='acc')
|
| 597 |
+
r.call(A, 'sample.load')
|
| 598 |
+
r.call(A, 'sort.auto_drop_delay', 'NOT_ACQUIRING') # the port is still rising
|
| 599 |
+
r.step(5)
|
| 600 |
+
op = r.call(A, 'sort.auto_drop_delay')['operation_id']
|
| 601 |
+
seen = []
|
| 602 |
+
for _ in range(19):
|
| 603 |
+
r.step(5.0)
|
| 604 |
+
seen.append(r.v('accudrop.left_stream_fraction'))
|
| 605 |
+
r.step(4.5)
|
| 606 |
+
self.assertEqual(A.poll(op)['status'], 'running')
|
| 607 |
+
r.step(1.0) # 7 + 13 points x 5 s = 100 s
|
| 608 |
+
self.assertGreater(max(x for x in seen if x is not None), 0.7) # the camera sees the beads move into the left stream
|
| 609 |
+
self.assertLess(min(x for x in seen if x is not None), 0.3)
|
| 610 |
+
p = A.poll(op)
|
| 611 |
+
self.assertEqual(p['status'], 'succeeded')
|
| 612 |
+
self.assertAlmostEqual(r.v('drop_delay.drops'), r.v('truth.drop_delay_drops'), delta=0.1)
|
| 613 |
+
# manual Accudrop check: fine tune mode, left stream fraction at the found delay vs. one drop off
|
| 614 |
+
r.call(A, 'gate.define', gate_id='all', kind='interval', x='FSC-A', x_range=[-2000.0, 262143.0])
|
| 615 |
+
r.install('2way_12x75')
|
| 616 |
+
r.call(A, 'sort.layout', layout_id='acc', device='2way_12x75', precision_mode='fine_tune', targets={'left': 'all'})
|
| 617 |
+
r.call(A, 'deflection.set', optical_filter_in=True)
|
| 618 |
+
sop = r.call(A, 'sort.start', layout_id='acc')['operation_id']
|
| 619 |
+
r.step(3)
|
| 620 |
+
good = r.v('accudrop.left_stream_fraction')
|
| 621 |
+
r.call(A, 'drop_delay.set', drops=r.v('drop_delay.drops') + 0.5)
|
| 622 |
+
r.step(2)
|
| 623 |
+
half = r.v('accudrop.left_stream_fraction')
|
| 624 |
+
self.assertGreater(good, 0.93)
|
| 625 |
+
self.assertAlmostEqual(half, 0.5, delta=0.12) # fine tune: 1 - |error|
|
| 626 |
+
r.R.step(0.0)
|
| 627 |
+
A.cancel(sop, 'c1')
|
| 628 |
+
self.assertEqual(A.poll(sop)['status'], 'cancelled')
|
| 629 |
+
|
| 630 |
+
def test_single_cell_plate_sort_counts(self):
|
| 631 |
+
r = Rig()
|
| 632 |
+
r.ready()
|
| 633 |
+
set_true_drop_delay(r)
|
| 634 |
+
r.provide('s', PBMC)
|
| 635 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 636 |
+
r.call(r.A, 'acquisition.flow_rate', setting=1.0)
|
| 637 |
+
r.load('t')
|
| 638 |
+
r.call(r.A, 'gate.define', gate_id='pos', kind='interval', x='B530_30-A', x_range=[3000.0, 262143.0])
|
| 639 |
+
r.call(r.A, 'door.set', door='sort_chamber', angle_rad=1.6)
|
| 640 |
+
r.call(r.A, 'collection.install', device='plate_96', prefill_m3=1e-7)
|
| 641 |
+
r.call(r.A, 'deflection.set', voltage_on=True)
|
| 642 |
+
r.call(r.A, 'sort.layout', layout_id='pl', device='plate_96', precision_mode='single_cell', targets={'plate': 'pos'}, events_per_well=1, wells=['A1', 'A2', 'A3', 'B1'])
|
| 643 |
+
r.call(r.A, 'sort.start', 'DOOR_OPEN', layout_id='pl')
|
| 644 |
+
r.call(r.A, 'door.set', door='sort_chamber', angle_rad=0.0)
|
| 645 |
+
op = r.sort('pl', max_s=30)
|
| 646 |
+
self.assertEqual(r.A.poll(op)['status'], 'succeeded')
|
| 647 |
+
c = {w: x for w, x in r.collected().items() if sum(x.values()) > 0}
|
| 648 |
+
self.assertEqual(sorted(c), ['A1', 'A2', 'A3', 'B1'])
|
| 649 |
+
n1 = sum(1 for w in c.values() if sum(w.values()) == 1)
|
| 650 |
+
self.assertGreaterEqual(n1, 3) # single-cell mode: one cell per well (rare doublets aside)
|
| 651 |
+
self.assertTrue(all(set(w) <= {'cd4'} for w in c.values()))
|
| 652 |
+
|
| 653 |
+
def test_side_stream_aim_drawer_and_sub_threshold_contamination(self):
|
| 654 |
+
r = Rig()
|
| 655 |
+
r.ready()
|
| 656 |
+
set_true_drop_delay(r)
|
| 657 |
+
A = r.A
|
| 658 |
+
r.provide('s', PBMC + [dict(population_id='debris', particle_id='human_platelet', concentration_per_m3=2e13)], vol=3e-6)
|
| 659 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 660 |
+
r.call(A, 'acquisition.flow_rate', setting=3.0)
|
| 661 |
+
r.load('t')
|
| 662 |
+
two_way(r, n=3000)
|
| 663 |
+
r.call(A, 'deflection.set', test_sort=True)
|
| 664 |
+
ss = {x['stream']: x for x in r.call(A, 'sort.side_streams')['result']['streams']}
|
| 665 |
+
self.assertLess(abs(ss['left']['offset_from_target_m']), 1e-3)
|
| 666 |
+
self.assertTrue(r.call(A, 'sort.side_streams')['result']['centre_in_aspirator'])
|
| 667 |
+
r.call(A, 'deflection.set', test_sort=False, side_stream_fraction={'left': 0.25})
|
| 668 |
+
op = r.sort('two', max_s=60)
|
| 669 |
+
c = r.collected()
|
| 670 |
+
self.assertLess(sum(c.get('left', {}).values()), 0.1 * r.v('sort.counts')['left']) # mis-aimed left stream misses the tube
|
| 671 |
+
self.assertGreater(c['right'].get('debris', 0.0), 0.0) # platelets below the FSC threshold ride along unseen
|
| 672 |
+
self.assertEqual(r.A.poll(op)['status'], 'succeeded')
|
| 673 |
+
|
| 674 |
+
def test_clog_protection_and_partial_clog_contamination(self):
|
| 675 |
+
r = Rig()
|
| 676 |
+
r.ready()
|
| 677 |
+
r.provide('s', PBMC)
|
| 678 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 679 |
+
r.load('t')
|
| 680 |
+
two_way(r, n=10 ** 6)
|
| 681 |
+
op = r.call(r.A, 'sort.start', layout_id='two')['operation_id']
|
| 682 |
+
r.step(3)
|
| 683 |
+
r.call(r.E, 'fault.inject', fault='clog_full', active=True)
|
| 684 |
+
r.step(1)
|
| 685 |
+
o = r.rd('stream.on', 'deflection.voltage_on', 'sort.drawer_open', 'sample.port_state', 'errors.active')
|
| 686 |
+
self.assertEqual((o['stream.on'], o['deflection.voltage_on'], o['sort.drawer_open']), (False, False, False)) # documented Sweet Spot response
|
| 687 |
+
self.assertEqual(o['sample.port_state'], 'unloading')
|
| 688 |
+
self.assertIn('CLOG', o['errors.active'])
|
| 689 |
+
self.assertEqual(r.A.poll(op)['status'], 'failed')
|
| 690 |
+
self.assertEqual(r.A.poll(op)['result']['error'], 'CLOG')
|
| 691 |
+
r.step(4)
|
| 692 |
+
r.call(r.A, 'door.set', door='flow_cell', angle_rad=1.2)
|
| 693 |
+
r.call(r.A, 'nozzle.install', nozzle='70') # sonicated / new nozzle
|
| 694 |
+
self.assertNotIn('CLOG', r.v('errors.active'))
|
| 695 |
+
# a partial clog is not detected: the bent centre stream runs into the right tube
|
| 696 |
+
r2 = Rig()
|
| 697 |
+
r2.ready()
|
| 698 |
+
r2.provide('s', PBMC)
|
| 699 |
+
r2.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 700 |
+
r2.load('t')
|
| 701 |
+
two_way(r2, n=10 ** 6)
|
| 702 |
+
r2.call(r2.A, 'sort.start', layout_id='two')
|
| 703 |
+
r2.step(3)
|
| 704 |
+
before = r2.collected().get('right', {}).get('cd4', 0.0)
|
| 705 |
+
r2.call(r2.E, 'fault.inject', fault='clog_partial', active=True)
|
| 706 |
+
r2.step(5)
|
| 707 |
+
self.assertTrue(r2.v('stream.on'))
|
| 708 |
+
self.assertGreater(r2.collected()['right'].get('cd4', 0.0), before + 200)
|
| 709 |
+
|
| 710 |
+
def test_emergency_stop(self):
|
| 711 |
+
r = Rig()
|
| 712 |
+
r.ready(warm=False)
|
| 713 |
+
r.provide('s', PBMC)
|
| 714 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 715 |
+
r.call(r.A, 'tube.install', tube_id='t')
|
| 716 |
+
r.call(r.A, 'sample.load')
|
| 717 |
+
r.step(1)
|
| 718 |
+
self.assertTrue(r.v('lamp.estop_light')) # lit while a tube is loading
|
| 719 |
+
r.step(3)
|
| 720 |
+
self.assertFalse(r.v('lamp.estop_light'))
|
| 721 |
+
r.call(r.A, 'deflection.set', voltage_on=True)
|
| 722 |
+
r.call(r.A, 'safety.emergency_stop')
|
| 723 |
+
o = r.rd('safety.estop_latched', 'safety.estop_position_m', 'stream.on', 'deflection.voltage_on', 'sample.port_state', 'lasers.on', 'power.enabled')
|
| 724 |
+
self.assertEqual((o['safety.estop_latched'], o['stream.on'], o['deflection.voltage_on']), (True, False, False))
|
| 725 |
+
self.assertAlmostEqual(o['safety.estop_position_m'], m.ESTOP_TRAVEL)
|
| 726 |
+
self.assertTrue(o['power.enabled'] and all(o['lasers.on'].values())) # lasers and main power stay on
|
| 727 |
+
self.assertTrue(r.v('lamp.estop_light')) # User's Guide p.42-43: lit while latched
|
| 728 |
+
r.step(5)
|
| 729 |
+
self.assertTrue(r.v('lamp.estop_light'))
|
| 730 |
+
r.call(r.A, 'stream.set', 'EMERGENCY_STOP_LATCHED', on=True)
|
| 731 |
+
r.call(r.A, 'safety.reset_emergency_stop')
|
| 732 |
+
self.assertFalse(r.v('lamp.estop_light')) # turning the button clockwise: light off
|
| 733 |
+
r.call(r.A, 'stream.set', on=True)
|
| 734 |
+
r.step(30)
|
| 735 |
+
r.call(r.A, 'sample.load') # the tube stayed on the lowered port
|
| 736 |
+
r.step(4)
|
| 737 |
+
op = r.call(r.A, 'acquisition.record', record_id='e1', events=10 ** 5)['operation_id']
|
| 738 |
+
r.step(1)
|
| 739 |
+
r.call(r.B, 'safety.emergency_stop') # another agent may always press the hardware button
|
| 740 |
+
self.assertEqual((r.A.poll(op)['status'], r.A.poll(op)['result']['error']), ('failed', 'EMERGENCY_STOP'))
|
| 741 |
+
self.assertTrue(any(e['code'] == 'EMERGENCY_STOP' and 'agent按下' in e['message_zh'] for e in r.call(r.A, 'events.read', since_s=0.0)['result']['events']))
|
| 742 |
+
r.call(r.B, 'safety.reset_emergency_stop')
|
| 743 |
+
|
| 744 |
+
|
| 745 |
+
# ---------------------------------------------------------------- temperatures, cart warnings, CS&T, power
|
| 746 |
+
class Instrument(unittest.TestCase):
|
| 747 |
+
def test_sample_and_collection_temperature(self):
|
| 748 |
+
r = Rig()
|
| 749 |
+
r.ready(warm=False, sweet=False)
|
| 750 |
+
r.provide('s', PBMC)
|
| 751 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 752 |
+
r.load('t')
|
| 753 |
+
r.call(r.A, 'acquisition.set', acquiring=False)
|
| 754 |
+
r.call(r.A, 'sample.temperature', 'INVALID_ARGUMENT', setpoint_k='277.15')
|
| 755 |
+
r.call(r.A, 'sample.temperature', 'INVALID_ARGUMENT', setpoint_k=280.0) # only the four software set points
|
| 756 |
+
r.call(r.A, 'sample.temperature', setpoint_k=277.15)
|
| 757 |
+
r.call(r.A, 'collection.temperature', setpoint_k=277.15)
|
| 758 |
+
r.step(2700)
|
| 759 |
+
o = r.rd('sample.chamber_temperature_k', 'collection.temperature_k', 'truth.sample_temperature_k')
|
| 760 |
+
self.assertLess(abs(o['sample.chamber_temperature_k'] - 277.15), 0.06 * (295.15 - 277.15)) # ~45 min (documented)
|
| 761 |
+
self.assertLess(abs(o['collection.temperature_k'] - 277.15), 0.2)
|
| 762 |
+
self.assertLess(o['truth.sample_temperature_k'], 279.0)
|
| 763 |
+
|
| 764 |
+
def test_level_warning_auto_stream_off(self):
|
| 765 |
+
r = Rig()
|
| 766 |
+
r.ready(warm=False, sweet=False)
|
| 767 |
+
r.R.cart['waste'] = 0.0095
|
| 768 |
+
r.step(1)
|
| 769 |
+
self.assertIn('WASTE_FULL', r.v('warnings.active'))
|
| 770 |
+
r.step(600)
|
| 771 |
+
r.call(r.A, 'warnings.dismiss')
|
| 772 |
+
r.step(600)
|
| 773 |
+
self.assertTrue(r.v('stream.on'))
|
| 774 |
+
r.step(900)
|
| 775 |
+
self.assertFalse(r.v('stream.on')) # documented: 15 min without dismissal turns the stream off
|
| 776 |
+
r.call(r.A, 'stream.set', on=True) # still full: a fresh warning period, not an immediate stop
|
| 777 |
+
r.step(60)
|
| 778 |
+
self.assertTrue(r.v('stream.on'))
|
| 779 |
+
r.step(900)
|
| 780 |
+
self.assertFalse(r.v('stream.on'))
|
| 781 |
+
r.R.cart['waste'] = 0.0101 # overflow
|
| 782 |
+
r.call(r.A, 'stream.set', on=True)
|
| 783 |
+
r.step(1)
|
| 784 |
+
self.assertIn('WASTE_OVERFLOW', r.v('errors.active'))
|
| 785 |
+
r.call(r.A, 'stream.set', on=False)
|
| 786 |
+
r.call(r.A, 'cart.empty_waste', bleach_m3=0.001)
|
| 787 |
+
self.assertAlmostEqual(r.v('cart.waste_level_fraction'), 0.1, delta=1e-9)
|
| 788 |
+
self.assertNotIn('WASTE_OVERFLOW', r.v('errors.active'))
|
| 789 |
+
r.R.cart['sheath'] = 1.2e-5 # runs dry (~0.1 ml/s at 70 psi)
|
| 790 |
+
r.call(r.A, 'stream.set', on=True)
|
| 791 |
+
r.step(150)
|
| 792 |
+
self.assertIn('SHEATH_EMPTY', r.v('errors.active'))
|
| 793 |
+
self.assertFalse(r.v('stream.on'))
|
| 794 |
+
r.call(r.A, 'cart.refill_sheath', volume_m3=0.009)
|
| 795 |
+
self.assertNotIn('SHEATH_EMPTY', r.v('errors.active'))
|
| 796 |
+
|
| 797 |
+
def test_cst_check(self):
|
| 798 |
+
r = Rig()
|
| 799 |
+
r.ready()
|
| 800 |
+
r.tube('cst', [dict(bead_id='cst_bead_bright', volume_m3=2e-7), dict(bead_id='cst_bead_mid', volume_m3=2e-7), dict(bead_id='cst_bead_dim', volume_m3=2e-7)], 4e-7)
|
| 801 |
+
r.call(r.A, 'cst.performance_check', 'CST_BEADS_REQUIRED')
|
| 802 |
+
r.call(r.A, 'tube.install', tube_id='cst')
|
| 803 |
+
r.call(r.A, 'sample.load')
|
| 804 |
+
r.call(r.A, 'cst.performance_check', 'NOT_ACQUIRING')
|
| 805 |
+
r.step(5)
|
| 806 |
+
r.call(r.A, 'cytometer.settings', laser_delays_s={'violet': 30e-6})
|
| 807 |
+
op = r.call(r.A, 'cst.performance_check')['operation_id']
|
| 808 |
+
r.step(301)
|
| 809 |
+
self.assertEqual(r.A.poll(op)['status'], 'succeeded')
|
| 810 |
+
self.assertEqual(r.v('cst.status'), 'passed')
|
| 811 |
+
self.assertAlmostEqual(r.v('cytometer.laser_delays_s')['violet'], r.v('truth.laser_delays_s')['violet'], delta=1e-6)
|
| 812 |
+
r.call(r.E, 'fault.inject', fault='laser_failure_red', active=True)
|
| 813 |
+
op = r.call(r.A, 'cst.performance_check')['operation_id']
|
| 814 |
+
r.step(301)
|
| 815 |
+
self.assertEqual(r.v('cst.status'), 'failed')
|
| 816 |
+
self.assertIn('LASER_FAILURE_RED', r.v('errors.active'))
|
| 817 |
+
|
| 818 |
+
def test_power_loss_and_restore(self):
|
| 819 |
+
r = Rig()
|
| 820 |
+
r.ready(warm=True, sweet=True)
|
| 821 |
+
r.call(r.E, 'fault.inject', fault='power_loss', active=True)
|
| 822 |
+
o = r.rd('power.enabled', 'stream.on', 'lasers.on', 'fluidics.state', 'cart.air_pressure_pa')
|
| 823 |
+
self.assertFalse(o['power.enabled'] or o['stream.on'] or any(o['lasers.on'].values()))
|
| 824 |
+
self.assertEqual(o['fluidics.state'], 'ready')
|
| 825 |
+
r.call(r.E, 'fault.inject', fault='power_loss', active=False)
|
| 826 |
+
self.assertTrue(r.v('power.enabled'))
|
| 827 |
+
self.assertFalse(any(r.v('lasers.warm').values())) # lasers must be switched on and warmed again
|
| 828 |
+
|
| 829 |
+
def test_settling_without_agitation(self):
|
| 830 |
+
r = Rig()
|
| 831 |
+
r.ready(sweet=False)
|
| 832 |
+
r.tube('si', [dict(bead_id='silica_bead_1um', volume_m3=1e-6)], 0.0)
|
| 833 |
+
tb = r.R.tubes['si']
|
| 834 |
+
tb['settle'] = {k: 0.0 for k in tb['counts']}
|
| 835 |
+
k = list(tb['counts'])[0]
|
| 836 |
+
r.R.popspec[k]['diameter_m'] = 2e-5 # heavy particle: settles in minutes
|
| 837 |
+
r.R.popspec[k]['density_kg_m3'] = 2200.0
|
| 838 |
+
r.load('si')
|
| 839 |
+
r.step(2)
|
| 840 |
+
rate0 = r.v('acquisition.threshold_rate_eps')
|
| 841 |
+
r.step(900)
|
| 842 |
+
self.assertLess(r.v('acquisition.threshold_rate_eps'), 0.1 * rate0)
|
| 843 |
+
r.call(r.A, 'sample.agitation', 'INVALID_ARGUMENT', speed='250_rpm')
|
| 844 |
+
r.call(r.A, 'sample.agitation', speed='300_rpm')
|
| 845 |
+
self.assertAlmostEqual(r.v('sample.agitation_rate_hz'), 5.0)
|
| 846 |
+
r.step(120)
|
| 847 |
+
self.assertLess(r.v('acquisition.threshold_rate_eps'), 0.1 * rate0) # facility: agitation even at 300 rpm is pretty ineffective
|
| 848 |
+
d0 = r.call(r.E, 'tube.inspect', tube_id='si')['result']['settled_depth_m'][k]
|
| 849 |
+
r.step(10)
|
| 850 |
+
d1 = r.call(r.E, 'tube.inspect', tube_id='si')['result']['settled_depth_m'][k]
|
| 851 |
+
v_s = 2.0 / 9.0 * (2200.0 - m.water_density(r.R.tubes['si']['T'])) * 9.80665 * 1e-10 / m.water_viscosity(r.R.tubes['si']['T'])
|
| 852 |
+
self.assertLess(d1 - d0, 0.45 * v_s * 10.0) # agitation only slows the settling front (40 % of Stokes)
|
| 853 |
+
self.assertGreater(d1 - d0, 0.35 * v_s * 10.0) # ... and does not stop it (no resuspension)
|
| 854 |
+
r.call(r.A, 'tube.mix', 'TUBE_NOT_ON_BENCH', tube_id='si')
|
| 855 |
+
r.unload()
|
| 856 |
+
r.call(r.A, 'tube.mix', tube_id='si') # pause, take the tube out and mix it (facility advice)
|
| 857 |
+
self.assertEqual(max(r.call(r.E, 'tube.inspect', tube_id='si')['result']['settled_depth_m'].values()), 0.0)
|
| 858 |
+
r.load('si', wait=5)
|
| 859 |
+
self.assertGreater(r.v('acquisition.threshold_rate_eps'), 0.5 * rate0)
|
| 860 |
+
|
| 861 |
+
|
| 862 |
+
class ReviewRound1(unittest.TestCase):
|
| 863 |
+
def test_unload_ends_sort_and_records(self):
|
| 864 |
+
r = Rig()
|
| 865 |
+
r.ready()
|
| 866 |
+
set_true_drop_delay(r)
|
| 867 |
+
r.provide('s', PBMC, vol=4e-6)
|
| 868 |
+
r.tube('t', [dict(sample_id='s', volume_m3=1.5e-6)], 5e-7)
|
| 869 |
+
r.tube('t2', [dict(sample_id='s', volume_m3=1.5e-6)], 5e-7)
|
| 870 |
+
r.load('t')
|
| 871 |
+
two_way(r, n=10 ** 6)
|
| 872 |
+
op = r.call(r.A, 'sort.start', layout_id='two')['operation_id']
|
| 873 |
+
rec = r.call(r.A, 'acquisition.record', record_id='rr', events=10 ** 5)['operation_id']
|
| 874 |
+
r.step(3)
|
| 875 |
+
n0 = r.v('sort.counts')['left']
|
| 876 |
+
self.assertGreater(n0, 100)
|
| 877 |
+
r.call(r.A, 'sample.unload')
|
| 878 |
+
o = r.rd('sort.state', 'sort.drawer_open', 'operations.running')
|
| 879 |
+
self.assertEqual((o['sort.state'], o['sort.drawer_open']), ('stopped', False))
|
| 880 |
+
self.assertEqual((r.A.poll(op)['status'], r.A.poll(op)['result']['error']), ('failed', 'SAMPLE_UNLOADED'))
|
| 881 |
+
self.assertEqual(r.A.poll(rec)['status'], 'failed')
|
| 882 |
+
r.step(4)
|
| 883 |
+
r.call(r.A, 'tube.remove')
|
| 884 |
+
r.load('t2')
|
| 885 |
+
r.step(3)
|
| 886 |
+
self.assertEqual(r.v('sort.counts')['left'], n0) # nothing continues on the next tube
|
| 887 |
+
op2 = r.call(r.A, 'sort.start', layout_id='two')['operation_id']
|
| 888 |
+
r.step(2)
|
| 889 |
+
self.assertLess(r.v('sort.counts')['left'], n0) # a new sort counts from zero
|
| 890 |
+
r.A.cancel(op2, 'c2')
|
| 891 |
+
|
| 892 |
+
def test_overflow_spill_ledger_and_truth_event(self):
|
| 893 |
+
r = Rig()
|
| 894 |
+
r.ready()
|
| 895 |
+
set_true_drop_delay(r)
|
| 896 |
+
r.provide('s', PBMC, vol=4e-6)
|
| 897 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 898 |
+
r.load('t')
|
| 899 |
+
two_way(r, n=10 ** 6)
|
| 900 |
+
r.call(r.A, 'door.set', door='sort_chamber', angle_rad=1.6)
|
| 901 |
+
r.call(r.A, 'collection.remove')
|
| 902 |
+
r.call(r.A, 'collection.install', device='2way_12x75', prefill_m3=5.0e-6) # full tubes
|
| 903 |
+
r.call(r.A, 'door.set', door='sort_chamber', angle_rad=0.0)
|
| 904 |
+
led0 = r.call(r.E, 'ledger.read')['result']['ledger']
|
| 905 |
+
op = r.call(r.A, 'sort.start', layout_id='two')['operation_id']
|
| 906 |
+
r.step(5)
|
| 907 |
+
led = {k: v - led0[k] for k, v in r.call(r.E, 'ledger.read')['result']['ledger'].items()}
|
| 908 |
+
self.assertGreater(led['particles_spilled_from_collection'], 0.0)
|
| 909 |
+
resid = led['particles_drawn'] - led['particles_sorted'] - led['particles_to_waste'] - led['particles_lost_off_target'] - led['particles_leaked_into_collection']
|
| 910 |
+
self.assertAlmostEqual(resid, 0.0, delta=1e-6)
|
| 911 |
+
tot = sum(sum(x.values()) for x in r.collected().values())
|
| 912 |
+
self.assertAlmostEqual(tot, led['particles_sorted'] - led['particles_spilled_from_collection'], delta=1e-6)
|
| 913 |
+
self.assertAlmostEqual(led['collection_spilled_m3'], led['collection_added_m3'], delta=1e-12) # full tubes: every added drop spills over
|
| 914 |
+
frac = led['collection_spilled_m3'] / (2 * 5.0e-6)
|
| 915 |
+
self.assertLess(led['particles_spilled_from_collection'], 3.0 * frac * tot + 30.0) # proportional (binomial), not >= 1 per population per tick
|
| 916 |
+
ev_a = [e for e in r.call(r.A, 'events.read', since_s=0.0)['result']['events'] if e['code'] == 'COLLECTION_OVERFLOW']
|
| 917 |
+
ev_e = [e for e in r.call(r.E, 'events.read', since_s=0.0)['result']['events'] if e['code'] == 'COLLECTION_OVERFLOW']
|
| 918 |
+
self.assertEqual(ev_a, []) # truth: the instrument has no level sensor
|
| 919 |
+
self.assertEqual(len(ev_e), 2) # once per location
|
| 920 |
+
r.A.cancel(op, 'c3')
|
| 921 |
+
|
| 922 |
+
def test_custom_non_sorting_setup_and_plates(self):
|
| 923 |
+
r = Rig()
|
| 924 |
+
r.call(r.A, 'power.press_switch')
|
| 925 |
+
for L in m.LASERS:
|
| 926 |
+
r.call(r.A, 'lasers.set', laser=L, enabled=True)
|
| 927 |
+
r.call(r.A, 'sort_setup.select', preset='70_custom') # Table 3-1 Custom: 70 um non-sorting, high sensitivity
|
| 928 |
+
o = r.rd('sheath.pressure_setpoint_pa', 'breakoff.frequency_hz', 'breakoff.amplitude_v', 'deflection.plate_voltage_v', 'cytometer.laser_delays_s',
|
| 929 |
+
'cytometer.window_extension_s', 'cytometer.area_scaling', 'deflection.side_stream_fraction', 'breakoff.attenuation')
|
| 930 |
+
self.assertAlmostEqual(o['sheath.pressure_setpoint_pa'] / PSI, 20.0, places=3)
|
| 931 |
+
self.assertEqual((o['breakoff.frequency_hz'], o['breakoff.amplitude_v'], o['deflection.plate_voltage_v'], o['breakoff.attenuation']), (30000.0, 10.0, 0.0, False))
|
| 932 |
+
self.assertAlmostEqual(o['cytometer.laser_delays_s']['violet'], 82e-6)
|
| 933 |
+
self.assertAlmostEqual(o['cytometer.laser_delays_s']['red'], -82e-6)
|
| 934 |
+
self.assertAlmostEqual(o['cytometer.window_extension_s'], 4e-6)
|
| 935 |
+
self.assertEqual((o['cytometer.area_scaling']['blue'], o['cytometer.area_scaling']['red'], o['cytometer.area_scaling']['violet']), (0.75, 0.5, 0.25))
|
| 936 |
+
self.assertEqual(set(o['deflection.side_stream_fraction'].values()), {0.0})
|
| 937 |
+
r.call(r.A, 'fluidics.startup')
|
| 938 |
+
r.step(m.STARTUP_S + 1)
|
| 939 |
+
r.call(r.A, 'stream.set', on=True)
|
| 940 |
+
r.step(30)
|
| 941 |
+
o = r.rd('truth.laser_delays_s', 'truth.jet_speed_m_s', 'breakoff.drop1_px')
|
| 942 |
+
self.assertAlmostEqual(o['truth.laser_delays_s']['violet'], 82e-6, delta=1e-6) # the fitted flow reproduces the documented delay
|
| 943 |
+
self.assertLess(o['truth.jet_speed_m_s'], 0.5 * 28.0)
|
| 944 |
+
hi = Rig()
|
| 945 |
+
hi.ready(sweet=False)
|
| 946 |
+
rates = {}
|
| 947 |
+
for name, rig in (('custom', r), ('high', hi)):
|
| 948 |
+
rig.tube('b', [dict(bead_id='ps_bead_3um', volume_m3=2e-7, stains=[dict(dye='fluorescein_fitc', molecules=300.0, cv=0.02)])], 8e-7)
|
| 949 |
+
rig.call(rig.A, 'cytometer.settings', voltages={'B530_30': 550.0})
|
| 950 |
+
rig.step(m.WARMUP_S if name == 'custom' else 0.0)
|
| 951 |
+
rig.load('b', wait=6)
|
| 952 |
+
rig.record('dimb', 2000)
|
| 953 |
+
rates[name] = rig.stats(source='dimb', params=['B530_30-A'])['rows'][0]['parameters'][0]['median']
|
| 954 |
+
self.assertGreater(rates['custom'], 1.8 * rates['high']) # ~2.3 x longer transit at 20 psi: more photons per particle
|
| 955 |
+
# ACDU 24-well plate: one cell per well
|
| 956 |
+
h = Rig()
|
| 957 |
+
h.ready()
|
| 958 |
+
set_true_drop_delay(h)
|
| 959 |
+
h.provide('s', PBMC)
|
| 960 |
+
h.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 961 |
+
h.call(h.A, 'acquisition.flow_rate', setting=1.0)
|
| 962 |
+
h.load('t')
|
| 963 |
+
h.call(h.A, 'gate.define', gate_id='pos', kind='interval', x='B530_30-A', x_range=[3000.0, 262143.0])
|
| 964 |
+
h.call(h.A, 'door.set', door='sort_chamber', angle_rad=1.6)
|
| 965 |
+
h.call(h.A, 'collection.install', device='plate_24', prefill_m3=5e-7)
|
| 966 |
+
h.call(h.A, 'door.set', door='sort_chamber', angle_rad=0.0)
|
| 967 |
+
h.call(h.A, 'deflection.set', voltage_on=True)
|
| 968 |
+
h.call(h.A, 'sort.layout', layout_id='p24', device='plate_24', precision_mode='single_cell', targets={'plate': 'pos'}, events_per_well=2, wells=['A1', 'B6', 'D6'])
|
| 969 |
+
op = h.sort('p24', max_s=30)
|
| 970 |
+
self.assertEqual(h.A.poll(op)['status'], 'succeeded')
|
| 971 |
+
W3 = ('A1', 'B6', 'D6')
|
| 972 |
+
v_single = sum(x['volume_m3'] - 5e-7 for x in h.call(h.E, 'collection.inspect')['result']['locations'] if x['location'] in W3)
|
| 973 |
+
h.call(h.A, 'door.set', door='sort_chamber', angle_rad=1.6)
|
| 974 |
+
h.call(h.A, 'collection.remove')
|
| 975 |
+
h.call(h.A, 'collection.install', device='plate_24', prefill_m3=5e-7)
|
| 976 |
+
h.call(h.A, 'door.set', door='sort_chamber', angle_rad=0.0)
|
| 977 |
+
h.call(h.A, 'sort.layout', layout_id='p24y', device='plate_24', precision_mode='purity', targets={'plate': 'pos'}, events_per_well=40, wells=['A1', 'B6', 'D6'])
|
| 978 |
+
op2 = h.sort('p24y', max_s=60)
|
| 979 |
+
self.assertEqual(h.A.poll(op2)['status'], 'succeeded')
|
| 980 |
+
v_yield = sum(x['volume_m3'] - 5e-7 for x in h.call(h.E, 'collection.inspect')['result']['locations'] if x['location'] in W3)
|
| 981 |
+
self.assertGreater(v_yield / 120.0, 1.5 * v_single / 6.0) # purity mode (yield mask 32): two drops per decision, single cell one
|
| 982 |
+
c = {w: sum(x.values()) for w, x in h.collected().items() if sum(x.values()) > 0}
|
| 983 |
+
self.assertEqual(sorted(c), ['A1', 'B6', 'D6'])
|
| 984 |
+
|
| 985 |
+
def test_rate_window_and_si_units(self):
|
| 986 |
+
r = Rig()
|
| 987 |
+
r.ready(warm=False, sweet=False)
|
| 988 |
+
ob = r.A.read(instance_id=r.I, state_ids=['acquisition.threshold_rate_eps', 'sort.sort_rate_eps', 'sample.agitation_rate_hz'])['observations']
|
| 989 |
+
w = ob['acquisition.threshold_rate_eps']['sample_window_s']
|
| 990 |
+
self.assertEqual(len(w), 2)
|
| 991 |
+
self.assertAlmostEqual(w[1] - w[0], 1.0)
|
| 992 |
+
self.assertAlmostEqual(w[1], r.R.t, delta=0.1)
|
| 993 |
+
self.assertEqual(ob['sample.agitation_rate_hz']['unit'], '1/s')
|
| 994 |
+
ob2 = r.A.read(instance_id=r.I, state_ids=['acquisition.events_processed'])['observations']['acquisition.events_processed']
|
| 995 |
+
self.assertIsNone(ob2['sample_window_s']) # a running total, not a 1-s rate
|
| 996 |
+
out = r.call(r.A, 'amo.set', enabled=True, mode='rapid')['result']
|
| 997 |
+
self.assertAlmostEqual(out['chamber_exchange_rate_per_s'], 69.0 / 60.0)
|
| 998 |
+
meta = m.export_bd_facsariaiii_contract_metadata()
|
| 999 |
+
units = {k: v['unit'] for k, v in meta['state_slots'].items()}
|
| 1000 |
+
self.assertFalse([k for k, u in units.items() if u in ('1/min', 'SI', '%')])
|
| 1001 |
+
params = meta['mechanisms']['flow_sorting_process']['parameters']
|
| 1002 |
+
self.assertFalse([k for k, p in params.items() if p['unit'] in ('1/min', 'SI', '%')])
|
| 1003 |
+
|
| 1004 |
+
|
| 1005 |
+
# ---------------------------------------------------------------- framework
|
| 1006 |
+
class Framework(unittest.TestCase):
|
| 1007 |
+
def test_sessions_isolation_and_idempotency(self):
|
| 1008 |
+
r = Rig()
|
| 1009 |
+
A, B, E = r.A, r.B, r.E
|
| 1010 |
+
r.call(A, 'fault.inject', 'ACCESS_DENIED', fault='clog_full', active=True)
|
| 1011 |
+
with self.assertRaises(m.ActionRejected):
|
| 1012 |
+
A.read(instance_id=r.I, state_ids=['truth.faults'])
|
| 1013 |
+
r.ready(warm=False, sweet=False)
|
| 1014 |
+
r.provide('s', PBMC)
|
| 1015 |
+
r.tube('ta', [dict(sample_id='s', volume_m3=1e-6)], 0.0)
|
| 1016 |
+
r.call(B, 'tube.install', 'ACCESS_DENIED', tube_id='ta')
|
| 1017 |
+
self.assertNotIn('ta', B.read(instance_id=r.I, state_ids=['tubes.on_bench'])['observations']['tubes.on_bench']['value'])
|
| 1018 |
+
r.load('ta')
|
| 1019 |
+
op = r.call(A, 'acquisition.record', record_id='ra', events=100000)['operation_id']
|
| 1020 |
+
r.step(1)
|
| 1021 |
+
r.call(B, 'stream.set', 'ACCESS_DENIED', on=False) # another agent's operation is running
|
| 1022 |
+
r.call(B, 'statistics.read', 'ACCESS_DENIED', source='ra')
|
| 1023 |
+
self.assertTrue(B.read(instance_id=r.I, state_ids=['operation.started_by_other_agent'])['observations']['operation.started_by_other_agent']['value'])
|
| 1024 |
+
with self.assertRaises(m.ActionRejected):
|
| 1025 |
+
B.poll(op)
|
| 1026 |
+
# idempotency
|
| 1027 |
+
r1 = A.invoke(instance_id=r.I, capability_id='drop_delay.set', arguments=dict(drops=43.5), request_id='same')
|
| 1028 |
+
r2 = A.invoke(instance_id=r.I, capability_id='drop_delay.set', arguments=dict(drops=43.5), request_id='same')
|
| 1029 |
+
self.assertEqual(r1, r2)
|
| 1030 |
+
r3 = A.invoke(instance_id=r.I, capability_id='drop_delay.set', arguments=dict(drops=42.0), request_id='same')
|
| 1031 |
+
self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT')
|
| 1032 |
+
SEEN.add(('drop_delay.set', 'REQUEST_CONFLICT'))
|
| 1033 |
+
A.cancel(op, 'cx')
|
| 1034 |
+
self.assertEqual(A.poll(op)['status'], 'cancelled')
|
| 1035 |
+
r.call(A, 'laser.uv_355nm', 'UNSUPPORTED')
|
| 1036 |
+
|
| 1037 |
+
def test_atomic_rejection(self):
|
| 1038 |
+
r = Rig()
|
| 1039 |
+
r.ready(warm=False, sweet=False)
|
| 1040 |
+
r.provide('s', PBMC)
|
| 1041 |
+
before = copy.deepcopy(r.R.read('evaluator'))
|
| 1042 |
+
samples = copy.deepcopy(r.R.samples)
|
| 1043 |
+
r.call(r.A, 'tube.prepare', 'VOLUME_OUT_OF_RANGE', tube_id='x', tube_type='1.5ml', sources=[dict(sample_id='s', volume_m3=1e-6)], buffer_volume_m3=1e-6)
|
| 1044 |
+
r.call(r.A, 'tube.prepare', 'INSUFFICIENT_SAMPLE', tube_id='x', tube_type='15ml', sources=[dict(sample_id='s', volume_m3=2e-6), dict(sample_id='s', volume_m3=2e-6)])
|
| 1045 |
+
r.call(r.A, 'sort.layout', 'INVALID_LAYOUT', layout_id='l', device='2way_12x75', precision_mode='purity', targets={'far_left': 'x'})
|
| 1046 |
+
r.call(r.A, 'cytometer.settings', 'INVALID_THRESHOLD', thresholds=[dict(parameter='FSC', value=1.0), dict(parameter='FSC', value=2.0)])
|
| 1047 |
+
self.assertEqual(r.R.read('evaluator'), before)
|
| 1048 |
+
self.assertEqual(r.R.samples, samples)
|
| 1049 |
+
|
| 1050 |
+
def test_step_partition_independence(self):
|
| 1051 |
+
out = []
|
| 1052 |
+
for parts in ([8.0], [0.5] * 16, [2.0, 0.25, 0.25, 0.5, 5.0]):
|
| 1053 |
+
r = Rig(seed=9)
|
| 1054 |
+
r.ready(warm=False, sweet=True)
|
| 1055 |
+
r.provide('s', PBMC)
|
| 1056 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 1057 |
+
r.load('t', wait=0.0)
|
| 1058 |
+
for p in parts:
|
| 1059 |
+
r.R.step(p)
|
| 1060 |
+
out.append((r.R.read('evaluator'), r.R.ledger()))
|
| 1061 |
+
self.assertEqual(out[0], out[1])
|
| 1062 |
+
self.assertEqual(out[0], out[2])
|
| 1063 |
+
|
| 1064 |
+
|
| 1065 |
+
class MoreRejections(unittest.TestCase):
|
| 1066 |
+
def test_preconditions(self):
|
| 1067 |
+
r = Rig()
|
| 1068 |
+
A = r.A
|
| 1069 |
+
r.call(A, 'lasers.set', 'POWER_OFF', laser='blue', enabled=True)
|
| 1070 |
+
r.ready(warm=False, sweet=False)
|
| 1071 |
+
r.provide('s', PBMC)
|
| 1072 |
+
r.call(A, 'sample.load', 'NO_TUBE')
|
| 1073 |
+
r.tube('t', [dict(sample_id='s', volume_m3=1e-6)], 0.0)
|
| 1074 |
+
r.tube('t2', [dict(sample_id='s', volume_m3=1e-6)], 0.0)
|
| 1075 |
+
r.call(A, 'tube.prepare', 'ITEM_EXISTS', tube_id='t', tube_type='12x75', sources=[dict(sample_id='s', volume_m3=1e-7)])
|
| 1076 |
+
r.call(A, 'tube.prepare', 'UNKNOWN_SAMPLE', tube_id='t3', tube_type='12x75', sources=[dict(sample_id='nope', volume_m3=1e-7)])
|
| 1077 |
+
r.call(A, 'tube.prepare', 'INVALID_SOURCE', tube_id='t3', tube_type='12x75', sources=[dict(volume_m3=1e-7)])
|
| 1078 |
+
r.call(A, 'tube.install', tube_id='t')
|
| 1079 |
+
r.call(A, 'tube.install', 'PORT_OCCUPIED', tube_id='t2')
|
| 1080 |
+
r.call(A, 'acquisition.record', 'NOT_ACQUIRING', record_id='x', events=10)
|
| 1081 |
+
r.call(A, 'collection.install', 'DOOR_CLOSED', device='2way_12x75')
|
| 1082 |
+
r.call(A, 'door.set', door='sort_chamber', angle_rad=0.3)
|
| 1083 |
+
r.call(A, 'amo.set', 'DOOR_OPEN', enabled=True)
|
| 1084 |
+
r.call(A, 'sort.start', 'UNKNOWN_LAYOUT', layout_id='none')
|
| 1085 |
+
r.call(A, 'sort.pause', 'NOT_SORTING')
|
| 1086 |
+
r.call(A, 'sweet_spot.set', enabled=True)
|
| 1087 |
+
r.call(A, 'sort_setup.select', 'STREAM_ON', preset='100')
|
| 1088 |
+
r.call(A, 'nozzle.install', 'STREAM_ON', nozzle='100')
|
| 1089 |
+
r.call(r.E, 'sample.provide', 'UNKNOWN_PARTICLE', sample_id='z', volume_m3=1e-6, populations=[dict(population_id='p', particle_id='unicorn', concentration_per_m3=1.0)])
|
| 1090 |
+
r.call(r.E, 'tube.inspect', 'UNKNOWN_ITEM', tube_id='zz')
|
| 1091 |
+
r.call(A, 'statistics.read', 'UNKNOWN_RECORD', source='nope')
|
| 1092 |
+
r.call(A, 'sample.unload', 'NOT_LOADED')
|
| 1093 |
+
|
| 1094 |
+
|
| 1095 |
+
class Coverage(unittest.TestCase):
|
| 1096 |
+
def test_remaining_capabilities(self):
|
| 1097 |
+
r = Rig()
|
| 1098 |
+
A, E = r.A, r.E
|
| 1099 |
+
r.call(A, 'power.set', enabled=True)
|
| 1100 |
+
r.call(A, 'fluidics.startup')
|
| 1101 |
+
r.step(m.STARTUP_S + 1)
|
| 1102 |
+
op = r.call(A, 'cleaning.run', mode='clean_flow_cell')['operation_id']
|
| 1103 |
+
self.assertEqual(r.v('fluidics.state'), 'cleaning')
|
| 1104 |
+
r.step(m.CLEAN_S['clean_flow_cell'] + 1)
|
| 1105 |
+
self.assertEqual(A.poll(op)['status'], 'succeeded')
|
| 1106 |
+
r.call(A, 'door.set', door='flow_cell', angle_rad=1.2)
|
| 1107 |
+
r.call(A, 'nozzle.install', nozzle='closed_loop')
|
| 1108 |
+
op = r.call(A, 'cleaning.run', mode='prepare_aseptic_sort')['operation_id']
|
| 1109 |
+
A.cancel(op, 'cc')
|
| 1110 |
+
self.assertEqual(r.v('fluidics.state'), 'ready')
|
| 1111 |
+
r.call(A, 'nozzle.install', nozzle='70')
|
| 1112 |
+
r.call(A, 'door.set', door='flow_cell', angle_rad=0.0)
|
| 1113 |
+
r.call(A, 'cart.refill_cleaning')
|
| 1114 |
+
r.call(A, 'cart.refill_sheath', volume_m3=float(0.010 - r.v('truth.cart_sheath_m3')))
|
| 1115 |
+
r.call(A, 'cart.refill_sheath', 'CONTAINER_OVERFLOW', volume_m3=0.001)
|
| 1116 |
+
r.call(A, 'sheath.set_pressure', pressure_pa=60 * PSI)
|
| 1117 |
+
self.assertEqual(r.v('sort_setup.preset'), 'custom')
|
| 1118 |
+
r.call(A, 'sort_setup.select', preset='70_high')
|
| 1119 |
+
r.call(A, 'stream.set', on=True)
|
| 1120 |
+
r.step(30)
|
| 1121 |
+
r.call(A, 'amo.set', enabled=True, mode='rapid')
|
| 1122 |
+
self.assertTrue(r.v('amo.on'))
|
| 1123 |
+
for L in m.LASERS:
|
| 1124 |
+
r.call(A, 'lasers.set', laser=L, enabled=True)
|
| 1125 |
+
r.provide('s', PBMC)
|
| 1126 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 1127 |
+
r.load('t')
|
| 1128 |
+
rid = r.record('r1', 2000)['result']['record_id']
|
| 1129 |
+
lst = r.call(A, 'records.list')['result']['records']
|
| 1130 |
+
self.assertEqual(lst[0]['events'], 2000)
|
| 1131 |
+
ex = r.call(A, 'data.export', record_id=rid, kind='fcs_csv')['result']
|
| 1132 |
+
self.assertEqual(ex['rows'], 2000)
|
| 1133 |
+
self.assertTrue(r.R.exports['r1.csv'].startswith('FSC-A,FSC-H,FSC-W'))
|
| 1134 |
+
ev = r.call(A, 'events.read', since_s=0.0)['result']['events']
|
| 1135 |
+
self.assertTrue(any(e['code'] == 'RECORD_DONE' for e in ev))
|
| 1136 |
+
pv = r.call(A, 'provenance.read')['result']
|
| 1137 |
+
self.assertEqual(len(pv['detectors']), 10)
|
| 1138 |
+
two_way(r, n=10 ** 6)
|
| 1139 |
+
r.call(A, 'sweet_spot.set', enabled=True)
|
| 1140 |
+
r.step(0.2)
|
| 1141 |
+
self.assertTrue(r.v('sweet_spot.paused')) # Gap still off target: sorting would pause
|
| 1142 |
+
r.step(60)
|
| 1143 |
+
self.assertFalse(r.v('sweet_spot.paused'))
|
| 1144 |
+
tb = r.call(E, 'tube.inspect', tube_id='t')['result']
|
| 1145 |
+
self.assertLess(tb['volume_m3'], 3e-6)
|
| 1146 |
+
sop = r.call(A, 'sort.start', layout_id='two')['operation_id']
|
| 1147 |
+
r.step(3)
|
| 1148 |
+
r.call(A, 'sort.pause')
|
| 1149 |
+
n0 = r.v('sort.counts')['left']
|
| 1150 |
+
r.step(2)
|
| 1151 |
+
self.assertEqual(r.v('sort.counts')['left'], n0)
|
| 1152 |
+
r.call(A, 'sort.resume')
|
| 1153 |
+
r.step(2)
|
| 1154 |
+
self.assertGreater(r.v('sort.counts')['left'], n0)
|
| 1155 |
+
A.cancel(sop, 'cs')
|
| 1156 |
+
self.assertEqual(r.v('sort.state'), 'stopped')
|
| 1157 |
+
r.call(A, 'drawer.set', open=True)
|
| 1158 |
+
r.step(2)
|
| 1159 |
+
self.assertAlmostEqual(r.v('sort.drawer_position_m'), m.DRAWER_TRAVEL)
|
| 1160 |
+
missing = sorted(k for k in m.CAPS if k not in m.UNSUPPORTED and k not in PROCESS_EVIDENCE)
|
| 1161 |
+
self.assertLessEqual(len(missing), 40)
|
| 1162 |
+
|
| 1163 |
+
|
| 1164 |
+
class ZDeclaredEffects(unittest.TestCase):
|
| 1165 |
+
"""Immediate state changes stay within EFFECTS; changes after a step stay within EFFECTS | ON_STEP (compared with the same host not called)."""
|
| 1166 |
+
|
| 1167 |
+
def _check(self, rig, cap, args, session=None):
|
| 1168 |
+
meta = m.export_bd_facsariaiii_contract_metadata()['capabilities'][cap]
|
| 1169 |
+
eff = {e['state_id'] for e in meta['state_effects'] if e['timing'] == 'immediate'}
|
| 1170 |
+
on_step = {e['state_id'] for e in meta['state_effects']}
|
| 1171 |
+
base = copy.deepcopy(rig.R)
|
| 1172 |
+
s0 = rig.R.read('evaluator')
|
| 1173 |
+
(session or rig.A).invoke(instance_id=rig.I, capability_id=cap, arguments=args, request_id=f'eff_{cap}')
|
| 1174 |
+
s1 = rig.R.read('evaluator')
|
| 1175 |
+
changed = {k for k in s0 if s0[k] != s1[k]} - {'operation.started_by_other_agent'}
|
| 1176 |
+
self.assertTrue(changed <= eff, (cap, sorted(changed - eff)))
|
| 1177 |
+
for dt in (2.0, 28.0):
|
| 1178 |
+
rig.R.step(dt)
|
| 1179 |
+
base.step(dt)
|
| 1180 |
+
a, b = rig.R.read('evaluator'), base.read('evaluator')
|
| 1181 |
+
diff = {k for k in a if a[k] != b[k]}
|
| 1182 |
+
self.assertTrue(diff <= (eff | on_step), (cap, dt, sorted(diff - (eff | on_step))))
|
| 1183 |
+
|
| 1184 |
+
def test_declared_effects(self):
|
| 1185 |
+
r = Rig()
|
| 1186 |
+
r.ready(warm=False, sweet=False)
|
| 1187 |
+
r.provide('s', PBMC)
|
| 1188 |
+
r.tube('t', [dict(sample_id='s', volume_m3=2e-6)], 1e-6)
|
| 1189 |
+
r.tube('t2', [dict(sample_id='s', volume_m3=5e-7)], 1e-6)
|
| 1190 |
+
for cap, args in [('lasers.set', dict(laser='red', enabled=False)), ('breakoff.set', dict(amplitude_v=55.0)), ('drop_delay.set', dict(drops=43.0)),
|
| 1191 |
+
('deflection.set', dict(voltage_on=True, plate_voltage_v=5000.0)), ('acquisition.flow_rate', dict(setting=3.0)),
|
| 1192 |
+
('cytometer.settings', dict(voltages={'B530_30': 550.0})), ('sample.chamber_light', {}), ('tube.install', dict(tube_id='t')),
|
| 1193 |
+
('sample.load', {}), ('sweet_spot.set', dict(enabled=True)), ('door.set', dict(door='side', angle_rad=1.0)),
|
| 1194 |
+
('gate.define', dict(gate_id='g1', kind='interval', x='FSC-A', x_range=[1000.0, 262143.0])),
|
| 1195 |
+
('compensation.set', dict(enabled=True)), ('sample.agitation', dict(speed='100_rpm')), ('drawer.set', dict(open=True)),
|
| 1196 |
+
('acquisition.set', dict(acquiring=False)), ('acquisition.set', dict(acquiring=True)), ('sample.temperature', dict(setpoint_k=310.15)),
|
| 1197 |
+
('collection.temperature', dict(setpoint_k=277.15)), ('amo.set', dict(enabled=True)), ('warnings.dismiss', {}),
|
| 1198 |
+
('sort.layout', dict(layout_id='lx', device='2way_12x75', precision_mode='purity', targets={'left': 'g1'})),
|
| 1199 |
+
('safety.emergency_stop', {}), ('safety.reset_emergency_stop', {}), ('tube.mix', dict(tube_id='t2')),
|
| 1200 |
+
('cart.refill_cleaning', {})]:
|
| 1201 |
+
self._check(r, cap, args)
|
| 1202 |
+
self._check(r, 'fault.inject', dict(fault='power_loss', active=True), session=r.E)
|
| 1203 |
+
|
| 1204 |
+
|
| 1205 |
+
class ZZRejectionCodes(unittest.TestCase):
|
| 1206 |
+
def test_codes_are_declared(self):
|
| 1207 |
+
meta = m.export_bd_facsariaiii_contract_metadata()['capabilities']
|
| 1208 |
+
missing = [(c, e) for c, e in sorted(SEEN) if e not in {x['code'] for x in meta[c]['errors']}]
|
| 1209 |
+
missing += [(c, e) for c, es in sorted(REJECTIONS.items()) for e in sorted(es) if e not in {x['code'] for x in meta[c]['errors']}]
|
| 1210 |
+
self.assertEqual(missing, [])
|
| 1211 |
+
self.assertGreaterEqual(len(SEEN), 30)
|
| 1212 |
+
CHECKS.append(dict(check='rejection_codes_declared', status='passed', codes=len(SEEN)))
|
| 1213 |
+
|
| 1214 |
+
def test_zz_every_implemented_capability_called(self):
|
| 1215 |
+
missing = sorted(k for k in m.CAPS if k not in m.UNSUPPORTED and k not in PROCESS_EVIDENCE)
|
| 1216 |
+
self.assertEqual(missing, [])
|
| 1217 |
+
|
| 1218 |
+
|
| 1219 |
+
if __name__ == '__main__':
|
| 1220 |
+
unittest.main()
|
tests/test_asset_binder_fd056.py
ADDED
|
@@ -0,0 +1,657 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""tests for CHEM-011 binder_fd056 (BINDER FD 56 drying and heating chamber with forced convection): python3 -m unittest tests/test_asset_binder_fd056.py
|
| 2 |
+
|
| 3 |
+
Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances
|
| 4 |
+
isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success
|
| 5 |
+
changes only declared slots; heating-up 15 min, 290 W at 150 C and 4 min recovery as calibrated; heating and fan stop with the door open;
|
| 6 |
+
fluctuation and spatial variation; air flap air change; drying of wet samples (constant and falling rate, boiling, chamber vapour, room
|
| 7 |
+
humidity) to constant mass; class 2 safety controller (latched, reset with OK) and class 1 overtemperature device (330 C, reset after >= 10 s
|
| 8 |
+
without mains below 230 C); Delayed Off timer with the fan selection; ramp; USB recording (interval, standby, outage, stick removal); racks and
|
| 9 |
+
loads; Pt100 rupture (1999); fan failure; standby skipping exact; energy, liquid-mass and vapour ledgers close."""
|
| 10 |
+
import json
|
| 11 |
+
import math
|
| 12 |
+
import re
|
| 13 |
+
import sys
|
| 14 |
+
import unittest
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
|
| 17 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 18 |
+
sys.path.insert(0, str(ROOT / 'scripts'))
|
| 19 |
+
from asset_runtime import binder_fd056 as rt # noqa: E402
|
| 20 |
+
|
| 21 |
+
INST = 'binder_fd056_01'
|
| 22 |
+
CHECKS = []
|
| 23 |
+
SEEN_CAPS = set()
|
| 24 |
+
PROCESS_EVIDENCE = {}
|
| 25 |
+
C0 = 273.15
|
| 26 |
+
DOOR_90 = math.pi / 2.0
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def _differ(x, y):
|
| 30 |
+
if isinstance(x, float) and isinstance(y, float):
|
| 31 |
+
return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y))
|
| 32 |
+
return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class Rig:
|
| 36 |
+
def __init__(self, seed=1, instance=INST, **plant):
|
| 37 |
+
self.h = rt.BinderFd056Runtime(instance)
|
| 38 |
+
self.h.register_principal('agent', 'agent')
|
| 39 |
+
self.h.register_principal('eval', 'evaluator')
|
| 40 |
+
self.A = self.h.session('agent')
|
| 41 |
+
self.E = self.h.session('eval')
|
| 42 |
+
self.n = 0
|
| 43 |
+
self.inst = instance
|
| 44 |
+
self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant))
|
| 45 |
+
|
| 46 |
+
def call(self, sess, cap, expect='succeeded', **args):
|
| 47 |
+
self.n += 1
|
| 48 |
+
before, t0 = self.h.read('evaluator'), self.h.t
|
| 49 |
+
r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}')
|
| 50 |
+
after = self.h.read('evaluator')
|
| 51 |
+
changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'}
|
| 52 |
+
if expect == 'succeeded':
|
| 53 |
+
assert r['status'] == 'succeeded', (cap, r['error'])
|
| 54 |
+
rt.validate(rt.CAPS[cap]['output_schema'], r['result'])
|
| 55 |
+
allowed = set(rt.EFFECTS.get(cap, [])) | (set(rt.ON_STEP['sim.step']) if cap == 'sim.step' else set())
|
| 56 |
+
extra = changed - allowed
|
| 57 |
+
assert not extra, (cap, sorted(extra))
|
| 58 |
+
if cap != 'sim.step':
|
| 59 |
+
assert self.h.t == t0, cap
|
| 60 |
+
SEEN_CAPS.add(cap)
|
| 61 |
+
PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status']))
|
| 62 |
+
return r['result']
|
| 63 |
+
assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result'))
|
| 64 |
+
assert r['error']['code'] == expect, (cap, r['error']['code'], expect)
|
| 65 |
+
assert not changed, (cap, 'rejected call changed', sorted(changed))
|
| 66 |
+
assert expect in [e['code'] for e in rt.export_binder_fd056_contract_metadata()['capabilities'][cap]['errors']], (cap, expect)
|
| 67 |
+
return r
|
| 68 |
+
|
| 69 |
+
def step(self, s):
|
| 70 |
+
self.call(self.E, 'sim.step', dt_s=float(s))
|
| 71 |
+
|
| 72 |
+
def read(self, *ids, who=None):
|
| 73 |
+
sess = who or self.E
|
| 74 |
+
o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations']
|
| 75 |
+
return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value']
|
| 76 |
+
|
| 77 |
+
def truth(self):
|
| 78 |
+
return self.read('truth.process')
|
| 79 |
+
|
| 80 |
+
def on(self):
|
| 81 |
+
self.call(self.A, 'power.set', on=True)
|
| 82 |
+
|
| 83 |
+
def setp(self, c):
|
| 84 |
+
self.call(self.A, 'temperature.set', temperature_k=C0 + c)
|
| 85 |
+
|
| 86 |
+
def door(self, open_):
|
| 87 |
+
self.call(self.A, 'door.set', angle_rad=DOOR_90 if open_ else 0.0)
|
| 88 |
+
|
| 89 |
+
def sample(self, sid='s1', level=1, position='front_left', ware='weighing_bottle_50x30', dry=0.005, liquid='water', liq_kg=0.002, **kw):
|
| 90 |
+
was_open = self.h._door_open()
|
| 91 |
+
if not was_open:
|
| 92 |
+
self.door(True)
|
| 93 |
+
r = self.call(self.A, 'sample.place', sample_id=sid, level=level, position=position, ware=ware, dry_mass_kg=dry, liquid_id=liquid, liquid_mass_kg=liq_kg, **kw)
|
| 94 |
+
if not was_open:
|
| 95 |
+
self.door(False)
|
| 96 |
+
return r
|
| 97 |
+
|
| 98 |
+
def remove(self, sid):
|
| 99 |
+
self.door(True)
|
| 100 |
+
r = self.call(self.A, 'sample.remove', sample_id=sid)['sample']
|
| 101 |
+
self.door(False)
|
| 102 |
+
return r
|
| 103 |
+
|
| 104 |
+
def ledger(self):
|
| 105 |
+
return self.call(self.E, 'ledger.read')['ledger']
|
| 106 |
+
|
| 107 |
+
def events(self, who=None):
|
| 108 |
+
return [e['code'] for e in self.call(who or self.E, 'events.read', since_s=0.0)['events']]
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def _balance(test, L):
|
| 112 |
+
scale = max(abs(L['e_heater_j']) + abs(L['e_fan_j']) + abs(L['e_samples_in_j']), 1.0)
|
| 113 |
+
test.assertLess(abs(L['energy_balance_j']), 1e-9 * scale + 1e-6, L)
|
| 114 |
+
test.assertLess(abs(L['mass_balance_kg']), 1e-12 + 1e-12 * L['m_placed_kg'], L)
|
| 115 |
+
test.assertLess(abs(L['vapour_balance_kg']), 1e-12 + 1e-12 * L['m_placed_kg'], L)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def _raised_codes():
|
| 119 |
+
src = Path(rt.__file__).read_text()
|
| 120 |
+
funcs = {}
|
| 121 |
+
for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S):
|
| 122 |
+
funcs[m.group(1)] = m.group(2)
|
| 123 |
+
own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()}
|
| 124 |
+
calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()}
|
| 125 |
+
out = {}
|
| 126 |
+
for k in funcs:
|
| 127 |
+
if not k.startswith('_cmd_'):
|
| 128 |
+
continue
|
| 129 |
+
seen, todo, codes = set(), [k], set()
|
| 130 |
+
while todo:
|
| 131 |
+
f = todo.pop()
|
| 132 |
+
if f in seen:
|
| 133 |
+
continue
|
| 134 |
+
seen.add(f)
|
| 135 |
+
codes |= own.get(f, set())
|
| 136 |
+
todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')]
|
| 137 |
+
out[k] = codes
|
| 138 |
+
name = {'_cmd_' + c.replace('.', '_'): c for c in rt.CAPS}
|
| 139 |
+
return {name[k]: v for k, v in out.items() if k in name}
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
class Contract(unittest.TestCase):
|
| 143 |
+
def test_metadata_slots_effects_consistent(self):
|
| 144 |
+
m = rt.export_binder_fd056_contract_metadata()
|
| 145 |
+
for k, c in m['capabilities'].items():
|
| 146 |
+
for e in c['state_effects']:
|
| 147 |
+
self.assertIn(e['state_id'], m['state_slots'], (k, e))
|
| 148 |
+
for p in c['preconditions']:
|
| 149 |
+
for s in p['state_ids']:
|
| 150 |
+
self.assertIn(s, m['state_slots'], (k, s))
|
| 151 |
+
for s in rt.SCENE_MIRRORED:
|
| 152 |
+
self.assertIn(s, rt.SLOTS)
|
| 153 |
+
self.assertEqual(rt.SLOTS[s]['visibility'], 'agent')
|
| 154 |
+
units = {p['unit'] for p in m['mechanisms']['drying_oven_process']['parameters'].values()}
|
| 155 |
+
self.assertFalse(units & {'degC', 'min', 'deg', 'K/min'}, units)
|
| 156 |
+
CHECKS.append(dict(id='metadata_consistent'))
|
| 157 |
+
|
| 158 |
+
def test_declared_errors_cover_raised_codes(self):
|
| 159 |
+
m = rt.export_binder_fd056_contract_metadata()
|
| 160 |
+
for cap, codes in _raised_codes().items():
|
| 161 |
+
declared = {e['code'] for e in m['capabilities'][cap]['errors']}
|
| 162 |
+
self.assertFalse(codes - declared, (cap, codes - declared))
|
| 163 |
+
|
| 164 |
+
def test_unsupported_capabilities(self):
|
| 165 |
+
g = Rig()
|
| 166 |
+
for k in rt.UNSUPPORTED:
|
| 167 |
+
r = g.A.invoke(instance_id=INST, capability_id=k, arguments={}, request_id='u' + k)
|
| 168 |
+
self.assertEqual((r['status'], r['error']['code']), ('unsupported', 'UNSUPPORTED'))
|
| 169 |
+
|
| 170 |
+
def test_agent_truth_isolation(self):
|
| 171 |
+
g = Rig()
|
| 172 |
+
obs = g.A.read(instance_id=INST)['observations']
|
| 173 |
+
self.assertFalse([k for k in obs if k.startswith('truth.')])
|
| 174 |
+
for cap, args in (('truth.inspect', {}), ('ledger.read', {}), ('fault.inject', dict(fault='fan_failure', active=True)), ('sim.step', dict(dt_s=1.0)),
|
| 175 |
+
('plant.configure', dict(rt.PLANT_EXAMPLE))):
|
| 176 |
+
r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=args, request_id='x' + cap)
|
| 177 |
+
self.assertEqual(r['error']['code'], 'ACCESS_DENIED')
|
| 178 |
+
d = g.A.describe(instance_id=INST)
|
| 179 |
+
self.assertNotIn('truth.inspect', d['capabilities'])
|
| 180 |
+
self.assertNotIn('truth.process', d['state_slots'])
|
| 181 |
+
g.on()
|
| 182 |
+
g.setp(280.0)
|
| 183 |
+
g.sample('p', ware='ptfe_dish_100', dry=0.01, liquid=None, liq_kg=0.0)
|
| 184 |
+
g.step(7200.0)
|
| 185 |
+
self.assertIn('WARE_OVERHEATED', g.events()) # PTFE above its service limit: evaluator truth only
|
| 186 |
+
self.assertNotIn('WARE_OVERHEATED', g.events(g.A))
|
| 187 |
+
|
| 188 |
+
def test_idempotent_request_ids(self):
|
| 189 |
+
g = Rig()
|
| 190 |
+
r1 = g.A.invoke(instance_id=INST, capability_id='power.toggle', arguments={}, request_id='same')
|
| 191 |
+
r2 = g.A.invoke(instance_id=INST, capability_id='power.toggle', arguments={}, request_id='same')
|
| 192 |
+
self.assertEqual(r1, r2)
|
| 193 |
+
self.assertTrue(g.read('power.on'))
|
| 194 |
+
r3 = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=False), request_id='same')
|
| 195 |
+
self.assertEqual(r3['error']['code'], 'REQUEST_CONFLICT')
|
| 196 |
+
|
| 197 |
+
def test_two_instances_isolated(self):
|
| 198 |
+
a, b = Rig(instance='a'), Rig(instance='b')
|
| 199 |
+
a.on()
|
| 200 |
+
a.setp(80.0)
|
| 201 |
+
a.step(60.0)
|
| 202 |
+
self.assertFalse(b.read('power.on'))
|
| 203 |
+
self.assertEqual(b.h.Ta, rt.PLANT_EXAMPLE['ambient_k'])
|
| 204 |
+
|
| 205 |
+
def test_step_partition_independence(self):
|
| 206 |
+
def run(parts):
|
| 207 |
+
g = Rig(seed=7)
|
| 208 |
+
g.call(g.A, 'usb.set_stick', inserted=True)
|
| 209 |
+
g.on()
|
| 210 |
+
g.call(g.A, 'usb.record', on=True, interval_min=1)
|
| 211 |
+
g.setp(105.0)
|
| 212 |
+
g.sample('w', liq_kg=0.003)
|
| 213 |
+
g.call(g.A, 'timer.set', days=0, hours=0, minutes=4, fan_after='off')
|
| 214 |
+
for dt in parts:
|
| 215 |
+
g.step(dt)
|
| 216 |
+
r = g.h.read('evaluator')
|
| 217 |
+
return json.dumps({k: r[k] for k in r if k != 'clock.time_s'}, sort_keys=True, default=float), g.ledger(), g.call(g.A, 'usb.read')['rows']
|
| 218 |
+
a, la, ua = run([300.0])
|
| 219 |
+
b, lb, ub = run([0.05] * 6000)
|
| 220 |
+
c, lc, uc = run([7.33] * 40 + [6.8])
|
| 221 |
+
self.assertEqual(a, b)
|
| 222 |
+
self.assertEqual(a, c)
|
| 223 |
+
self.assertEqual(json.dumps(la, sort_keys=True), json.dumps(lb, sort_keys=True))
|
| 224 |
+
self.assertEqual(ua, ub)
|
| 225 |
+
self.assertEqual(ua, uc)
|
| 226 |
+
|
| 227 |
+
def test_rejections_change_nothing(self):
|
| 228 |
+
g = Rig()
|
| 229 |
+
g.call(g.A, 'temperature.set', expect='STANDBY', temperature_k=C0 + 100.0)
|
| 230 |
+
g.call(g.A, 'usb.read', expect='NO_STICK')
|
| 231 |
+
g.call(g.A, 'sample.place', expect='DOOR_CLOSED', sample_id='a', level=1, position='front_left', ware='petri_dish_100', dry_mass_kg=0.01)
|
| 232 |
+
g.call(g.A, 'rack.set', expect='DOOR_CLOSED', level=2, present=True)
|
| 233 |
+
g.on()
|
| 234 |
+
g.call(g.A, 'usb.record', expect='NO_STICK', on=True)
|
| 235 |
+
g.door(True)
|
| 236 |
+
g.call(g.A, 'sample.place', expect='NO_RACK', sample_id='a', level=2, position='front_left', ware='petri_dish_100', dry_mass_kg=0.01)
|
| 237 |
+
g.call(g.A, 'sample.place', expect='OVERFILL', sample_id='a', level=1, position='front_left', ware='crucible_porcelain_30ml', dry_mass_kg=0.0,
|
| 238 |
+
liquid_id='water', liquid_mass_kg=0.05)
|
| 239 |
+
g.call(g.A, 'sample.place', expect='NOT_LIQUID', sample_id='a', level=1, position='front_left', ware='beaker_250ml', dry_mass_kg=0.0, liquid_id='diethyl_ether',
|
| 240 |
+
liquid_mass_kg=0.05, initial_k=C0 + 40.0)
|
| 241 |
+
g.call(g.A, 'sample.place', expect='OVERLOAD', sample_id='a', level=1, position='front_left', ware='steel_tray_300x200', dry_mass_kg=29.5,
|
| 242 |
+
dry_density_kg_m3=22000.0)
|
| 243 |
+
g.call(g.A, 'sample.place', expect='OVERFILL', sample_id='a', level=1, position='front_left', ware='weighing_bottle_50x30', dry_mass_kg=29.0)
|
| 244 |
+
g.call(g.A, 'sample.place', expect='INVALID_ARGUMENT', sample_id='a', level=1, position='front_left', ware='beaker_250ml', dry_mass_kg=0.0, liquid_mass_kg=0.05)
|
| 245 |
+
g.call(g.A, 'sample.place', sample_id='a', level=1, position='front_left', ware='beaker_250ml', dry_mass_kg=0.05)
|
| 246 |
+
g.call(g.A, 'sample.place', expect='DUPLICATE_ID', sample_id='a', level=3, position='front_left', ware='beaker_250ml', dry_mass_kg=0.05)
|
| 247 |
+
g.call(g.A, 'sample.place', expect='POSITION_OCCUPIED', sample_id='b', level=1, position='front_left', ware='beaker_250ml', dry_mass_kg=0.05)
|
| 248 |
+
g.call(g.A, 'rack.set', expect='RACK_LOADED', level=1, present=False)
|
| 249 |
+
g.call(g.A, 'sample.remove', expect='NO_SAMPLE', sample_id='zz')
|
| 250 |
+
g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=99))
|
| 251 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=True)
|
| 252 |
+
g.call(g.A, 'power.set', expect='NO_MAINS', on=False)
|
| 253 |
+
g.call(g.A, 'flap.set', expect='NO_MAINS', position=2)
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
class Physics(unittest.TestCase):
|
| 257 |
+
def test_heating_up_energy_and_fluctuation(self):
|
| 258 |
+
g = Rig(ambient_k=C0 + 22.0)
|
| 259 |
+
g.on()
|
| 260 |
+
g.setp(150.0)
|
| 261 |
+
g.step(890.0)
|
| 262 |
+
self.assertLess(g.h.Tsens, C0 + 149.0)
|
| 263 |
+
g.step(20.0)
|
| 264 |
+
self.assertGreaterEqual(g.h.Tsens, C0 + 149.0) # 15 min to 150 C (datasheet; calibrated)
|
| 265 |
+
g.step(8 * 3600.0)
|
| 266 |
+
L0, t0 = g.ledger(), g.h.t
|
| 267 |
+
dev = 0.0
|
| 268 |
+
for _ in range(360):
|
| 269 |
+
g.step(10.0)
|
| 270 |
+
dev = max(dev, abs(g.h.Tsens - (C0 + 150.0)))
|
| 271 |
+
L1 = g.ledger()
|
| 272 |
+
self.assertAlmostEqual((L1['e_electric_total_j'] - L0['e_electric_total_j']) / (g.h.t - t0), 290.0, delta=2.0) # 290 Wh/h at 150 C
|
| 273 |
+
self.assertLess(dev, 0.3) # +-0.3 K fluctuation
|
| 274 |
+
self.assertEqual(g.read('display.temperature'), 150.0)
|
| 275 |
+
self.assertEqual(g.read('display.text'), 'SP 150')
|
| 276 |
+
_balance(self, L1)
|
| 277 |
+
|
| 278 |
+
def test_door_stops_heating_and_recovery(self):
|
| 279 |
+
g = Rig(ambient_k=C0 + 22.0)
|
| 280 |
+
g.on()
|
| 281 |
+
g.setp(150.0)
|
| 282 |
+
g.step(3 * 3600.0)
|
| 283 |
+
g.door(True)
|
| 284 |
+
g.step(5.0)
|
| 285 |
+
self.assertFalse(g.read('fan.running'))
|
| 286 |
+
self.assertEqual(g.truth()['heater_w'], 0.0)
|
| 287 |
+
g.step(25.0)
|
| 288 |
+
self.assertLess(g.truth()['air_k'], C0 + 110.0) # fresh room air in, liner still hot
|
| 289 |
+
g.door(False)
|
| 290 |
+
g.step(230.0)
|
| 291 |
+
self.assertLess(g.h.Tsens, C0 + 149.0)
|
| 292 |
+
g.step(20.0)
|
| 293 |
+
self.assertGreaterEqual(g.h.Tsens, C0 + 149.0) # 4 min recovery (datasheet; calibrated)
|
| 294 |
+
_balance(self, g.ledger())
|
| 295 |
+
|
| 296 |
+
def test_spatial_variation_and_flap(self):
|
| 297 |
+
g = Rig(ambient_k=C0 + 22.0)
|
| 298 |
+
g.on()
|
| 299 |
+
g.setp(150.0)
|
| 300 |
+
g.step(3 * 3600.0)
|
| 301 |
+
offs = [g.h._offset(lv, p) for lv in rt.LEVELS for p in rt.POSITIONS]
|
| 302 |
+
self.assertAlmostEqual(max(abs(x) for x in offs), 1.7, delta=0.03)
|
| 303 |
+
e0, t0 = g.ledger()['e_electric_total_j'], g.h.t
|
| 304 |
+
g.step(1800.0)
|
| 305 |
+
p_closed = (g.ledger()['e_electric_total_j'] - e0) / (g.h.t - t0)
|
| 306 |
+
g.call(g.A, 'flap.set', position=4)
|
| 307 |
+
self.assertEqual(g.read('flap.angle_rad'), math.radians(60.0))
|
| 308 |
+
g.step(3 * 3600.0)
|
| 309 |
+
e0, t0 = g.ledger()['e_electric_total_j'], g.h.t
|
| 310 |
+
g.step(1800.0)
|
| 311 |
+
p_open = (g.ledger()['e_electric_total_j'] - e0) / (g.h.t - t0)
|
| 312 |
+
self.assertGreater(p_open, p_closed + 150.0) # 80 /h of fresh air to heat
|
| 313 |
+
self.assertGreater(max(abs(g.h._offset(lv, p)) for lv in rt.LEVELS for p in rt.POSITIONS), 2.0) # flap open: worse uniformity
|
| 314 |
+
_balance(self, g.ledger())
|
| 315 |
+
|
| 316 |
+
def test_drying_to_constant_mass(self):
|
| 317 |
+
g = Rig()
|
| 318 |
+
g.on()
|
| 319 |
+
g.setp(105.0)
|
| 320 |
+
g.sample('w', dry=0.005, liq_kg=0.002)
|
| 321 |
+
masses = []
|
| 322 |
+
for _ in range(12):
|
| 323 |
+
g.step(600.0)
|
| 324 |
+
masses.append(g.truth()['samples']['w']['total_mass_kg'])
|
| 325 |
+
self.assertTrue(all(b <= a for a, b in zip(masses, masses[1:])))
|
| 326 |
+
self.assertLess(g.truth()['samples']['w']['liquid_kg'], 1e-6) # dry within 2 h at 105 C
|
| 327 |
+
g.step(3600.0)
|
| 328 |
+
r = g.remove('w')
|
| 329 |
+
self.assertAlmostEqual(r['total_mass_kg'], rt.WARES['weighing_bottle_50x30']['mass_kg'] + 0.005, delta=1e-6) # constant mass
|
| 330 |
+
self.assertAlmostEqual(r['liquid_lost_kg'], 0.002, delta=1e-9)
|
| 331 |
+
L = g.ledger()
|
| 332 |
+
self.assertEqual(g.call(g.E, 'truth.inspect')['process']['samples'], {})
|
| 333 |
+
self.assertGreater(L['m_vented_kg'] + L['m_condensed_kg'], 0.0019)
|
| 334 |
+
_balance(self, L)
|
| 335 |
+
|
| 336 |
+
def test_falling_rate_and_humidity(self):
|
| 337 |
+
def loss(rh, dry):
|
| 338 |
+
g = Rig(relative_humidity=rh)
|
| 339 |
+
g.on()
|
| 340 |
+
g.setp(45.0)
|
| 341 |
+
g.sample('w', ware='petri_dish_100', dry=dry, liq_kg=0.010)
|
| 342 |
+
g.step(1800.0)
|
| 343 |
+
_balance(self, g.ledger())
|
| 344 |
+
return 0.010 - g.truth()['samples']['w']['liquid_kg']
|
| 345 |
+
self.assertGreater(loss(0.0, 0.0), loss(0.9, 0.0) * 1.05) # humid room air slows drying at 45 C
|
| 346 |
+
self.assertGreater(loss(0.5, 0.0), loss(0.5, 0.12) * 1.5) # 10 g on 120 g solid: below the critical moisture
|
| 347 |
+
|
| 348 |
+
def test_boiling_limits_sample_temperature(self):
|
| 349 |
+
g = Rig()
|
| 350 |
+
g.on()
|
| 351 |
+
g.setp(150.0)
|
| 352 |
+
g.sample('e', ware='beaker_250ml', dry=0.0, liquid='ethanol', liq_kg=0.050)
|
| 353 |
+
tb = rt.boiling_k('ethanol', rt.PLANT_EXAMPLE['pressure_pa'])
|
| 354 |
+
tmax = 0.0
|
| 355 |
+
for _ in range(60):
|
| 356 |
+
g.step(30.0)
|
| 357 |
+
s = g.truth()['samples']['e']
|
| 358 |
+
if s['liquid_kg'] > 0:
|
| 359 |
+
tmax = max(tmax, s['temperature_k'])
|
| 360 |
+
self.assertLessEqual(tmax, tb + 1e-6)
|
| 361 |
+
self.assertGreater(g.truth()['samples']['e']['boiled_kg'] + g.truth()['samples']['e']['evaporated_kg'], 0.01)
|
| 362 |
+
_balance(self, g.ledger())
|
| 363 |
+
|
| 364 |
+
def test_safety_controller_class2(self):
|
| 365 |
+
g = Rig()
|
| 366 |
+
g.on()
|
| 367 |
+
g.setp(100.0)
|
| 368 |
+
g.call(g.A, 'safety.set_limit', limit_k=C0 + 105.0)
|
| 369 |
+
g.step(3600.0)
|
| 370 |
+
g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=True)
|
| 371 |
+
for _ in range(600):
|
| 372 |
+
g.step(1.0)
|
| 373 |
+
if g.read('alarm.state'):
|
| 374 |
+
break
|
| 375 |
+
self.assertEqual(g.read('alarm.state'), 'limit_active')
|
| 376 |
+
self.assertEqual(g.read('display.text'), 'ALAr tLI')
|
| 377 |
+
self.assertTrue(g.read('indicator.alarm'))
|
| 378 |
+
self.assertLess(g.truth()['air_k'], C0 + 125.0)
|
| 379 |
+
g.call(g.A, 'alarm.acknowledge')
|
| 380 |
+
self.assertEqual(g.read('alarm.state'), 'limit_active') # still above: no reset
|
| 381 |
+
g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=False)
|
| 382 |
+
g.call(g.A, 'temperature.set', temperature_k=C0 + 95.0)
|
| 383 |
+
g.step(1800.0)
|
| 384 |
+
self.assertEqual(g.read('alarm.state'), 'limit_latched')
|
| 385 |
+
self.assertEqual(g.truth()['heater_w'], 0.0)
|
| 386 |
+
g.call(g.A, 'alarm.acknowledge')
|
| 387 |
+
self.assertIsNone(g.read('alarm.state'))
|
| 388 |
+
g.step(1800.0)
|
| 389 |
+
self.assertAlmostEqual(g.h.Tsens, C0 + 95.0, delta=0.3)
|
| 390 |
+
_balance(self, g.ledger())
|
| 391 |
+
|
| 392 |
+
def test_overtemperature_class1(self):
|
| 393 |
+
g = Rig()
|
| 394 |
+
g.on()
|
| 395 |
+
g.setp(250.0)
|
| 396 |
+
g.call(g.E, 'fault.inject', fault='safety_controller_failure', active=True)
|
| 397 |
+
g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=True)
|
| 398 |
+
g.step(3 * 3600.0)
|
| 399 |
+
self.assertEqual(g.read('alarm.state'), 'overtemperature')
|
| 400 |
+
self.assertLess(g.truth()['air_k'], C0 + 345.0)
|
| 401 |
+
self.assertEqual(g.read('display.text'), 'ALAr OtP')
|
| 402 |
+
g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=False)
|
| 403 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=True)
|
| 404 |
+
g.step(5.0)
|
| 405 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=False)
|
| 406 |
+
self.assertEqual(g.read('alarm.state'), 'overtemperature') # too short and still hot
|
| 407 |
+
g.step(4 * 3600.0)
|
| 408 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=True)
|
| 409 |
+
g.step(12.0)
|
| 410 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=False)
|
| 411 |
+
self.assertNotEqual(g.read('alarm.state'), 'overtemperature') # >= 10 s off and below 230 C
|
| 412 |
+
_balance(self, g.ledger())
|
| 413 |
+
|
| 414 |
+
def test_timer_delayed_off_and_fan_selection(self):
|
| 415 |
+
for fan_after in ('on', 'off'):
|
| 416 |
+
g = Rig()
|
| 417 |
+
g.on()
|
| 418 |
+
g.setp(80.0)
|
| 419 |
+
g.call(g.A, 'timer.set', days=0, hours=0, minutes=20, fan_after=fan_after)
|
| 420 |
+
self.assertTrue(g.read('indicator.timer'))
|
| 421 |
+
g.call(g.A, 'display.cycle')
|
| 422 |
+
g.call(g.A, 'display.cycle')
|
| 423 |
+
g.call(g.A, 'display.cycle')
|
| 424 |
+
self.assertEqual(g.read('display.text'), 't 00020')
|
| 425 |
+
g.step(1199.0)
|
| 426 |
+
self.assertFalse(g.read('timer.state')['expired'])
|
| 427 |
+
g.step(2.0)
|
| 428 |
+
self.assertTrue(g.read('timer.state')['expired'])
|
| 429 |
+
self.assertEqual(g.read('display.text'), 't End')
|
| 430 |
+
self.assertEqual(g.read('fan.running'), fan_after == 'on')
|
| 431 |
+
g.step(60.0)
|
| 432 |
+
self.assertEqual(g.truth()['heater_w'], 0.0)
|
| 433 |
+
g.call(g.A, 'alarm.acknowledge') # OK turns the expired timer off
|
| 434 |
+
self.assertFalse(g.read('timer.state')['set'])
|
| 435 |
+
self.assertTrue(g.read('fan.running'))
|
| 436 |
+
_balance(self, g.ledger())
|
| 437 |
+
|
| 438 |
+
def test_ramp(self):
|
| 439 |
+
g = Rig()
|
| 440 |
+
g.on()
|
| 441 |
+
g.setp(50.0)
|
| 442 |
+
g.step(3600.0)
|
| 443 |
+
g.call(g.A, 'ramp.set', gradient_k_min=2, target_k=C0 + 90.0)
|
| 444 |
+
g.step(600.0)
|
| 445 |
+
self.assertAlmostEqual(g.read('ramp.state')['effective_k'], C0 + 70.0, delta=0.05)
|
| 446 |
+
self.assertAlmostEqual(g.h.Tsens, C0 + 70.0, delta=1.5)
|
| 447 |
+
g.step(1200.0)
|
| 448 |
+
self.assertFalse(g.read('ramp.state')['active'])
|
| 449 |
+
self.assertEqual(g.read('temperature.set_k'), C0 + 90.0)
|
| 450 |
+
g.call(g.A, 'ramp.set', gradient_k_min=3, target_k=C0 + 60.0) # target below the actual value: set directly
|
| 451 |
+
self.assertFalse(g.read('ramp.state')['active'])
|
| 452 |
+
self.assertEqual(g.read('temperature.set_k'), C0 + 60.0)
|
| 453 |
+
|
| 454 |
+
def test_usb_recording_standby_outage(self):
|
| 455 |
+
g = Rig()
|
| 456 |
+
g.call(g.A, 'usb.set_stick', inserted=True)
|
| 457 |
+
g.on()
|
| 458 |
+
g.setp(60.0)
|
| 459 |
+
g.call(g.A, 'usb.record', on=True, interval_min=2)
|
| 460 |
+
g.step(600.0)
|
| 461 |
+
rows = g.call(g.A, 'usb.read')['rows']
|
| 462 |
+
self.assertEqual(len(rows), 5)
|
| 463 |
+
self.assertEqual([r['time_s'] for r in rows], [0.1, 120.1, 240.1, 360.1, 480.1])
|
| 464 |
+
g.call(g.A, 'power.set', on=False) # recording continues in standby
|
| 465 |
+
g.step(1200.0)
|
| 466 |
+
self.assertEqual(len(g.call(g.A, 'usb.read')['rows']), 15)
|
| 467 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=True) # interrupted by an outage
|
| 468 |
+
g.step(600.0)
|
| 469 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=False)
|
| 470 |
+
n = len(g.call(g.A, 'usb.read')['rows'])
|
| 471 |
+
self.assertEqual(n, 15)
|
| 472 |
+
g.step(240.0)
|
| 473 |
+
self.assertGreater(len(g.call(g.A, 'usb.read')['rows']), n)
|
| 474 |
+
g.call(g.A, 'usb.set_stick', inserted=False)
|
| 475 |
+
self.assertIn('USB_REMOVED_WHILE_RECORDING', g.events())
|
| 476 |
+
self.assertFalse(g.read('usb.state')['recording'])
|
| 477 |
+
|
| 478 |
+
def test_sensor_rupture_fan_failure_unit(self):
|
| 479 |
+
g = Rig()
|
| 480 |
+
g.on()
|
| 481 |
+
g.setp(100.0)
|
| 482 |
+
g.call(g.A, 'unit.set', unit='F')
|
| 483 |
+
g.step(3600.0)
|
| 484 |
+
self.assertEqual(g.read('display.temperature'), 212.0)
|
| 485 |
+
self.assertEqual(g.read('display.text'), 'SP 212')
|
| 486 |
+
g.call(g.E, 'fault.inject', fault='sensor_rupture', active=True)
|
| 487 |
+
g.step(10.0)
|
| 488 |
+
self.assertEqual(g.read('display.temperature'), 1999.0)
|
| 489 |
+
self.assertEqual(g.truth()['heater_w'], 0.0)
|
| 490 |
+
g2, g3 = Rig(), Rig()
|
| 491 |
+
for x in (g2, g3):
|
| 492 |
+
x.on()
|
| 493 |
+
x.setp(150.0)
|
| 494 |
+
x.sample('d', ware='beaker_250ml', dry=0.1, liquid=None, liq_kg=0.0)
|
| 495 |
+
g3.call(g3.E, 'fault.inject', fault='fan_failure', active=True)
|
| 496 |
+
g2.step(1800.0)
|
| 497 |
+
g3.step(1800.0)
|
| 498 |
+
t2, t3 = g2.truth(), g3.truth()
|
| 499 |
+
self.assertLess(t3['samples']['d']['temperature_k'], t2['samples']['d']['temperature_k'] - 10.0) # no forced convection: the load heats slower
|
| 500 |
+
self.assertGreater(t3['heater_k'], t2['heater_k'] + 20.0) # and the element runs hotter
|
| 501 |
+
self.assertFalse(g3.read('fan.running'))
|
| 502 |
+
_balance(self, g3.ledger())
|
| 503 |
+
|
| 504 |
+
def test_standby_skipping_is_exact(self):
|
| 505 |
+
g = Rig()
|
| 506 |
+
n = g.h.tick
|
| 507 |
+
g.step(30 * 86400.0)
|
| 508 |
+
self.assertEqual(g.h.tick - n, int(round(30 * 86400.0 / rt.DT)))
|
| 509 |
+
g.on()
|
| 510 |
+
g.setp(60.0)
|
| 511 |
+
g.step(600.0)
|
| 512 |
+
g.call(g.A, 'power.set', on=False)
|
| 513 |
+
g.step(24 * 3600.0)
|
| 514 |
+
self.assertEqual(g.truth()['air_k'], rt.PLANT_EXAMPLE['ambient_k'])
|
| 515 |
+
self.assertTrue(g.read('indicator.standby'))
|
| 516 |
+
self.assertIsNone(g.read('display.temperature'))
|
| 517 |
+
n = g.h.tick
|
| 518 |
+
g.step(10 * 86400.0)
|
| 519 |
+
self.assertEqual(g.h.tick - n, int(round(10 * 86400.0 / rt.DT)))
|
| 520 |
+
_balance(self, g.ledger())
|
| 521 |
+
|
| 522 |
+
def test_racks_and_keys(self):
|
| 523 |
+
g = Rig()
|
| 524 |
+
g.on()
|
| 525 |
+
g.door(True)
|
| 526 |
+
g.call(g.A, 'rack.set', level=2, present=True)
|
| 527 |
+
self.assertEqual(g.read('racks.levels'), [1, 2, 3])
|
| 528 |
+
g.call(g.A, 'rack.set', level=2, present=False)
|
| 529 |
+
g.door(False)
|
| 530 |
+
g.call(g.A, 'temperature.step', delta_k=1.0)
|
| 531 |
+
g.call(g.A, 'temperature.step', delta_k=-1.0)
|
| 532 |
+
g.call(g.A, 'temperature.step', delta_k=1.0)
|
| 533 |
+
self.assertEqual(g.read('temperature.set_k'), C0 + 26.0)
|
| 534 |
+
g.call(g.A, 'power.toggle')
|
| 535 |
+
self.assertFalse(g.read('power.on'))
|
| 536 |
+
|
| 537 |
+
|
| 538 |
+
class RoundOneFixes(unittest.TestCase):
|
| 539 |
+
"""Regression tests of the round-1 review findings (R1-*)."""
|
| 540 |
+
|
| 541 |
+
def test_usb_rows_independent_of_standby_stepping(self): # R1-01
|
| 542 |
+
def run(parts):
|
| 543 |
+
g = Rig(seed=3)
|
| 544 |
+
g.call(g.A, 'usb.set_stick', inserted=True)
|
| 545 |
+
g.on()
|
| 546 |
+
g.call(g.A, 'usb.record', on=True, interval_min=1)
|
| 547 |
+
g.call(g.A, 'timer.set', days=0, hours=0, minutes=10, fan_after='on')
|
| 548 |
+
g.call(g.A, 'power.set', on=False)
|
| 549 |
+
for dt in parts:
|
| 550 |
+
g.step(dt)
|
| 551 |
+
return g.call(g.A, 'usb.read')['rows']
|
| 552 |
+
a = run([1800.0])
|
| 553 |
+
self.assertEqual(a, run([0.1] * 18000))
|
| 554 |
+
self.assertEqual(a, run([33.0] * 54 + [18.0]))
|
| 555 |
+
self.assertEqual([r['timer_s'] for r in a[1:4]], [540.0 - 0.1, 480.0 - 0.1, 420.0 - 0.1])
|
| 556 |
+
|
| 557 |
+
def test_vapour_bounded_by_ambient_pressure(self): # R1-02
|
| 558 |
+
g = Rig()
|
| 559 |
+
g.on()
|
| 560 |
+
g.setp(200.0)
|
| 561 |
+
g.sample('wet', ware='steel_tray_300x200', dry=0.2, liquid='water', liq_kg=1.0)
|
| 562 |
+
g.call(g.A, 'flap.set', position=0)
|
| 563 |
+
pmax = 0.0
|
| 564 |
+
for _ in range(40):
|
| 565 |
+
g.step(60.0)
|
| 566 |
+
v = g.truth()['vapour_kg']
|
| 567 |
+
pmax = max(pmax, sum(m * rt.R_GAS * g.h.Ta / (rt.LIQ[k]['molar_mass_kg_mol'] * rt.V_AIR) for k, m in v.items()))
|
| 568 |
+
self.assertLessEqual(pmax, rt.PLANT_EXAMPLE['pressure_pa'] * (1 + 1e-9))
|
| 569 |
+
_balance(self, g.ledger())
|
| 570 |
+
|
| 571 |
+
def test_class1_clears_automatically_after_cooling(self): # R1-03
|
| 572 |
+
g = Rig()
|
| 573 |
+
g.on()
|
| 574 |
+
g.setp(250.0)
|
| 575 |
+
g.call(g.E, 'fault.inject', fault='safety_controller_failure', active=True)
|
| 576 |
+
g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=True)
|
| 577 |
+
for _ in range(240):
|
| 578 |
+
g.step(60.0)
|
| 579 |
+
if g.read('alarm.state') == 'overtemperature':
|
| 580 |
+
break
|
| 581 |
+
self.assertEqual(g.read('alarm.state'), 'overtemperature')
|
| 582 |
+
g.call(g.E, 'fault.inject', fault='ssr_stuck_on', active=False)
|
| 583 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=True)
|
| 584 |
+
g.step(12.0)
|
| 585 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=False)
|
| 586 |
+
self.assertGreater(g.truth()['air_k'], rt.CLASS1[1])
|
| 587 |
+
self.assertEqual(g.read('alarm.state'), 'overtemperature') # still above 230 C
|
| 588 |
+
g.step(6 * 3600.0)
|
| 589 |
+
self.assertNotEqual(g.read('alarm.state'), 'overtemperature') # cleared once below 230 C
|
| 590 |
+
self.assertIn('OVERTEMP_RESET', g.events())
|
| 591 |
+
_balance(self, g.ledger())
|
| 592 |
+
|
| 593 |
+
def test_door_cuts_heater_immediately(self): # R1-04
|
| 594 |
+
g = Rig()
|
| 595 |
+
g.on()
|
| 596 |
+
g.setp(150.0)
|
| 597 |
+
g.step(120.0)
|
| 598 |
+
self.assertGreater(g.truth()['duty'], 0.5)
|
| 599 |
+
g.door(True)
|
| 600 |
+
self.assertEqual(g.truth()['heater_w'], 0.0)
|
| 601 |
+
self.assertFalse(g.read('indicator.heating'))
|
| 602 |
+
self.assertFalse(g.read('fan.running'))
|
| 603 |
+
|
| 604 |
+
|
| 605 |
+
class RoundTwoFixes(unittest.TestCase):
|
| 606 |
+
"""Regression tests of the round-2 review findings (R2-*)."""
|
| 607 |
+
|
| 608 |
+
def test_no_usb_rows_inside_an_outage(self): # R2-01
|
| 609 |
+
for active in (False, True):
|
| 610 |
+
g = Rig(seed=4)
|
| 611 |
+
g.call(g.A, 'usb.set_stick', inserted=True)
|
| 612 |
+
g.on()
|
| 613 |
+
g.setp(50.0)
|
| 614 |
+
g.call(g.A, 'usb.record', on=True, interval_min=1)
|
| 615 |
+
g.call(g.A, 'timer.set', days=0, hours=0, minutes=30, fan_after='on')
|
| 616 |
+
if not active:
|
| 617 |
+
g.call(g.A, 'power.set', on=False)
|
| 618 |
+
g.step(300.0)
|
| 619 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=True)
|
| 620 |
+
t0 = g.h.t
|
| 621 |
+
g.step(400.0)
|
| 622 |
+
t1 = g.h.t
|
| 623 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=False)
|
| 624 |
+
g.step(300.0)
|
| 625 |
+
rows = g.call(g.A, 'usb.read')['rows']
|
| 626 |
+
self.assertFalse([r['time_s'] for r in rows if t0 < r['time_s'] <= t1 + 1e-9], active)
|
| 627 |
+
ts = [r['timer_s'] for r in rows if r['timer_s'] is not None]
|
| 628 |
+
self.assertTrue(all(b <= a for a, b in zip(ts, ts[1:])) and max(ts) <= 1800.0, ts)
|
| 629 |
+
|
| 630 |
+
def test_vapour_never_above_saturation(self): # R2-02
|
| 631 |
+
g = Rig()
|
| 632 |
+
g.on()
|
| 633 |
+
g.setp(120.0)
|
| 634 |
+
g.sample('wet', ware='steel_tray_300x200', dry=0.2, liquid='water', liq_kg=1.0)
|
| 635 |
+
g.step(1800.0)
|
| 636 |
+
g.call(g.A, 'power.set', on=False) # warm wet tray in a cooling chamber
|
| 637 |
+
worst = 0.0
|
| 638 |
+
for _ in range(60):
|
| 639 |
+
g.step(60.0)
|
| 640 |
+
m = g.truth()['vapour_kg'].get('water', 0.0)
|
| 641 |
+
p = m * rt.R_GAS * g.h.Ta / (rt.LIQ['water']['molar_mass_kg_mol'] * rt.V_AIR) + g.h._room_water_pa()
|
| 642 |
+
worst = max(worst, p / rt.p_vap('water', g.h.Ta))
|
| 643 |
+
self.assertLessEqual(worst, 1.0 + 1e-9)
|
| 644 |
+
L = g.ledger()
|
| 645 |
+
self.assertGreater(L['m_condensed_kg'], 0.0)
|
| 646 |
+
_balance(self, L)
|
| 647 |
+
|
| 648 |
+
|
| 649 |
+
class ZCoverage(unittest.TestCase):
|
| 650 |
+
def test_all_capabilities_exercised(self):
|
| 651 |
+
missing = set(rt.CAPS) - set(rt.UNSUPPORTED) - SEEN_CAPS - {'events.read'}
|
| 652 |
+
if len(SEEN_CAPS) > 5:
|
| 653 |
+
self.assertFalse(missing, sorted(missing))
|
| 654 |
+
|
| 655 |
+
|
| 656 |
+
if __name__ == '__main__':
|
| 657 |
+
unittest.main()
|
tests/test_asset_binder_kbf115.py
ADDED
|
@@ -0,0 +1,646 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""tests for CHEM-198 binder_kbf115 (BINDER KBF 115 constant climate chamber): python3 -m unittest tests/test_asset_binder_kbf115.py
|
| 2 |
+
|
| 3 |
+
Themes: contract consistency (slots, effects, errors raised vs declared); agent / evaluator truth isolation; idempotent request ids; two instances
|
| 4 |
+
isolated; step-partition independence; rejected calls leave the state unchanged; every output validated against its schema and every success
|
| 5 |
+
changes only declared slots; 40 C / 75 %RH steady state (fluctuation, 470 Wh/h, about 100 mL water a day, calibrated); recovery after 30 s door
|
| 6 |
+
opening (6 / 7 min, calibrated) and the door-open behaviour (fan to minimum, all off after 60 s, door alarm after 5 min); 200 W heat compensation
|
| 7 |
+
at 40 C; climate chart regions (A, B corner reached, outside not reached, dry mode); time programs (ramp / step, tolerance band pause, section
|
| 8 |
+
repetition, power-failure resume); safety controller class 3.1, tolerance range alarms, reset and buzzer, the humidity-system alarm that cannot be
|
| 9 |
+
acknowledged; freshwater tap / can and wastewater; sample exposure with measured templates (NaCl and KCl deliquescence humidities, solution
|
| 10 |
+
branch, adsorbent isotherm, condensation on cold samples, degradation law, mean kinetic temperature); glass-door fog when the door heating
|
| 11 |
+
fails; icing below +5 C and the manual defrost; idle mode, humidity off and the 10 min module warm-up, sensor failures; energy and water ledgers
|
| 12 |
+
closing exactly."""
|
| 13 |
+
import json
|
| 14 |
+
import math
|
| 15 |
+
import re
|
| 16 |
+
import sys
|
| 17 |
+
import unittest
|
| 18 |
+
from pathlib import Path
|
| 19 |
+
|
| 20 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 21 |
+
sys.path.insert(0, str(ROOT / 'scripts'))
|
| 22 |
+
from asset_runtime import binder_kbf115 as rt # noqa: E402
|
| 23 |
+
|
| 24 |
+
INST = 'binder_kbf115_01'
|
| 25 |
+
T0 = 273.15
|
| 26 |
+
CHECKS = []
|
| 27 |
+
SEEN_CAPS = set()
|
| 28 |
+
PROCESS_EVIDENCE = {}
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def _differ(x, y):
|
| 32 |
+
if isinstance(x, float) and isinstance(y, float):
|
| 33 |
+
return abs(x - y) > 1e-12 * max(1.0, abs(x), abs(y))
|
| 34 |
+
return json.dumps(x, sort_keys=True, default=str) != json.dumps(y, sort_keys=True, default=str)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class Rig:
|
| 38 |
+
def __init__(self, seed=1, instance=INST, **plant):
|
| 39 |
+
self.h = rt.BinderKbf115Runtime(instance)
|
| 40 |
+
self.h.register_principal('agent', 'agent')
|
| 41 |
+
self.h.register_principal('eval', 'evaluator')
|
| 42 |
+
self.A = self.h.session('agent')
|
| 43 |
+
self.E = self.h.session('eval')
|
| 44 |
+
self.n = 0
|
| 45 |
+
self.inst = instance
|
| 46 |
+
self.call(self.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, noise_seed=seed, **plant))
|
| 47 |
+
|
| 48 |
+
def call(self, sess, cap, expect='succeeded', **args):
|
| 49 |
+
self.n += 1
|
| 50 |
+
before, t0 = self.h.read('evaluator'), self.h.t
|
| 51 |
+
r = sess.invoke(instance_id=self.inst, capability_id=cap, arguments=args, request_id=f'r{self.n}')
|
| 52 |
+
after = self.h.read('evaluator')
|
| 53 |
+
changed = {k for k in after if _differ(after[k], before[k])} - {'clock.time_s'}
|
| 54 |
+
if expect == 'succeeded':
|
| 55 |
+
assert r['status'] == 'succeeded', (cap, r['error'])
|
| 56 |
+
rt.validate(rt.CAPS[cap]['output_schema'], r['result'])
|
| 57 |
+
if cap != 'sim.step':
|
| 58 |
+
extra = changed - set(rt.EFFECTS.get(cap, []))
|
| 59 |
+
assert not extra, (cap, sorted(extra))
|
| 60 |
+
assert self.h.t == t0, cap
|
| 61 |
+
SEEN_CAPS.add(cap)
|
| 62 |
+
PROCESS_EVIDENCE.setdefault(cap, []).append(dict(arguments=json.dumps(args, sort_keys=True, default=str)[:200], time_s=t0, status=r['status']))
|
| 63 |
+
return r['result']
|
| 64 |
+
assert r['status'] in ('rejected', 'unsupported'), (cap, r['status'], r.get('result'))
|
| 65 |
+
assert r['error']['code'] == expect, (cap, r['error']['code'], expect)
|
| 66 |
+
assert not changed, (cap, 'rejected call changed', sorted(changed))
|
| 67 |
+
assert expect in [e['code'] for e in rt.export_binder_kbf115_contract_metadata()['capabilities'][cap]['errors']], (cap, expect)
|
| 68 |
+
return r
|
| 69 |
+
|
| 70 |
+
def step(self, s):
|
| 71 |
+
self.call(self.E, 'sim.step', dt_s=float(s))
|
| 72 |
+
|
| 73 |
+
def read(self, *ids, who=None):
|
| 74 |
+
sess = who or self.E
|
| 75 |
+
o = sess.read(instance_id=self.inst, state_ids=list(ids) if ids else None)['observations']
|
| 76 |
+
return {k: v['value'] for k, v in o.items()} if not ids or len(ids) > 1 else o[ids[0]]['value']
|
| 77 |
+
|
| 78 |
+
def run(self, T_c, rh, settle=6 * 3600.0, fan=1.0):
|
| 79 |
+
self.call(self.A, 'power.set', on=True)
|
| 80 |
+
self.call(self.A, 'setpoint.set', temperature_k=T0 + T_c, relative_humidity=rh, fan_fraction=fan)
|
| 81 |
+
self.step(settle)
|
| 82 |
+
|
| 83 |
+
def open(self):
|
| 84 |
+
self.call(self.A, 'door.move', angle_rad=1.6)
|
| 85 |
+
self.call(self.A, 'glass_door.move', angle_rad=1.5)
|
| 86 |
+
|
| 87 |
+
def close(self):
|
| 88 |
+
self.call(self.A, 'glass_door.move', angle_rad=0.0)
|
| 89 |
+
self.call(self.A, 'door.move', angle_rad=0.0)
|
| 90 |
+
|
| 91 |
+
def until(self, pred, limit, every=10.0):
|
| 92 |
+
t = 0.0
|
| 93 |
+
while not pred() and t < limit:
|
| 94 |
+
self.step(every)
|
| 95 |
+
t += every
|
| 96 |
+
return t
|
| 97 |
+
|
| 98 |
+
def ledger(self):
|
| 99 |
+
return self.call(self.E, 'ledger.read')['ledger']
|
| 100 |
+
|
| 101 |
+
def climate(self):
|
| 102 |
+
return self.read('truth.climate')
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def _raised_codes():
|
| 106 |
+
src = Path(rt.__file__).read_text()
|
| 107 |
+
funcs = {}
|
| 108 |
+
for m in re.finditer(r'\n def (\w+)\(self[^\n]*\n(.*?)(?=\n def |\n# ----|\nclass |\ndef )', src, re.S):
|
| 109 |
+
funcs[m.group(1)] = m.group(2)
|
| 110 |
+
own = {k: set(re.findall(r"ActionRejected\('([A-Z_]+)'\)", v)) for k, v in funcs.items()}
|
| 111 |
+
calls = {k: set(re.findall(r'self\.(_\w+)\(', v)) & set(funcs) for k, v in funcs.items()}
|
| 112 |
+
out = {}
|
| 113 |
+
for k in funcs:
|
| 114 |
+
if not k.startswith('_cmd_'):
|
| 115 |
+
continue
|
| 116 |
+
seen, todo, codes = set(), [k], set()
|
| 117 |
+
while todo:
|
| 118 |
+
f = todo.pop()
|
| 119 |
+
if f in seen:
|
| 120 |
+
continue
|
| 121 |
+
seen.add(f)
|
| 122 |
+
codes |= own.get(f, set())
|
| 123 |
+
todo += [g for g in calls.get(f, ()) if g not in ('_cmd_sim_step', 'step', '_tick')]
|
| 124 |
+
out[k] = codes
|
| 125 |
+
name = {'_cmd_' + c.replace('.', '_'): c for c in rt.CAPS}
|
| 126 |
+
return {name[k]: v for k, v in out.items() if k in name}
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
def _balance(test, L):
|
| 130 |
+
E = (L['e_initial_j'] + L['e_heater_in_j'] + L['e_fan_in_j'] + L['e_door_heating_in_j'] + L['e_wall_in_j'] + L['e_glass_in_j'] + L['e_exchange_in_j']
|
| 131 |
+
+ L['e_steam_in_j'] + L['e_sample_heat_in_j'] - L['e_refrigeration_out_j'] - L['e_drain_out_j'] + L['e_samples_added_j'] - L['e_samples_removed_j'] + L['e_reconfigure_in_j'])
|
| 132 |
+
scale = max(abs(L['e_initial_j']), abs(L['e_refrigeration_out_j']), abs(L['e_heater_in_j']), 1.0)
|
| 133 |
+
test.assertAlmostEqual(L['u_chamber_j'], E, delta=1e-9 * scale + 1e-3)
|
| 134 |
+
W = (L['w_initial_kg'] + L['w_supply_in_kg'] + L['w_can_refill_kg'] + L['w_exchange_in_kg'] - L['w_pumped_out_kg'] - L['w_overflow_kg']
|
| 135 |
+
+ L['w_samples_added_kg'] - L['w_samples_removed_kg'])
|
| 136 |
+
test.assertAlmostEqual(L['w_system_kg'], W, delta=1e-12 + 1e-9 * (L['w_supply_in_kg'] + L['w_system_kg']))
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
class Contract(unittest.TestCase):
|
| 140 |
+
def test_metadata_slots_effects_consistent(self):
|
| 141 |
+
meta = rt.export_binder_kbf115_contract_metadata()
|
| 142 |
+
slots = set(meta['state_slots'])
|
| 143 |
+
self.assertEqual(slots, set(rt.SLOTS))
|
| 144 |
+
for k, c in meta['capabilities'].items():
|
| 145 |
+
for e in c['state_effects']:
|
| 146 |
+
self.assertIn(e['state_id'], slots, k)
|
| 147 |
+
self.assertTrue({'INVALID_ARGUMENT', 'REQUEST_CONFLICT', 'UNKNOWN_INSTANCE'} <= {e['code'] for e in c['errors']}, k)
|
| 148 |
+
self.assertTrue(rt.SCENE_MIRRORED <= slots)
|
| 149 |
+
for name, p in meta['mechanisms']['climate_chamber_process']['parameters'].items():
|
| 150 |
+
self.assertEqual(name, name.lower())
|
| 151 |
+
self.assertIn(p['evidence'], ('documented', 'assumption'), name)
|
| 152 |
+
|
| 153 |
+
def test_declared_errors_cover_raised_codes(self):
|
| 154 |
+
meta = rt.export_binder_kbf115_contract_metadata()
|
| 155 |
+
for cap, codes in _raised_codes().items():
|
| 156 |
+
declared = {e['code'] for e in meta['capabilities'][cap]['errors']}
|
| 157 |
+
self.assertTrue(codes <= declared, (cap, sorted(codes - declared)))
|
| 158 |
+
|
| 159 |
+
def test_unsupported_capabilities(self):
|
| 160 |
+
g = Rig()
|
| 161 |
+
for k in rt.UNSUPPORTED:
|
| 162 |
+
g.call(g.A, k, expect='UNSUPPORTED')
|
| 163 |
+
|
| 164 |
+
def test_agent_truth_isolation(self):
|
| 165 |
+
g = Rig()
|
| 166 |
+
g.call(g.A, 'power.set', on=True)
|
| 167 |
+
g.step(600.0)
|
| 168 |
+
self.assertFalse(any(k.startswith('truth.') for k in g.read(who=g.A)))
|
| 169 |
+
for cap, a in (('truth.inspect', {}), ('ledger.read', {}), ('fault.inject', dict(fault='mains_outage', active=True)), ('sim.step', dict(dt_s=1.0))):
|
| 170 |
+
r = g.A.invoke(instance_id=INST, capability_id=cap, arguments=a, request_id='x' + cap)
|
| 171 |
+
self.assertEqual(r['error']['code'], 'ACCESS_DENIED')
|
| 172 |
+
g.call(g.E, 'fault.inject', fault='heater_failure', active=True)
|
| 173 |
+
self.assertFalse(any(e['kind'] in ('fault', 'truth') for e in g.call(g.A, 'events.read', since_s=0.0)['events']))
|
| 174 |
+
g.call(g.E, 'truth.inspect')
|
| 175 |
+
|
| 176 |
+
def test_idempotent_request_ids(self):
|
| 177 |
+
g = Rig()
|
| 178 |
+
a = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same')
|
| 179 |
+
b = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=True), request_id='same')
|
| 180 |
+
self.assertEqual(a, b)
|
| 181 |
+
c = g.A.invoke(instance_id=INST, capability_id='power.set', arguments=dict(on=False), request_id='same')
|
| 182 |
+
self.assertEqual(c['error']['code'], 'REQUEST_CONFLICT')
|
| 183 |
+
|
| 184 |
+
def test_two_instances_isolated(self):
|
| 185 |
+
a, b = Rig(instance='i1'), Rig(instance='i2')
|
| 186 |
+
a.call(a.A, 'power.set', on=True)
|
| 187 |
+
self.assertFalse(b.read('power.on'))
|
| 188 |
+
|
| 189 |
+
def test_step_partition_independence(self):
|
| 190 |
+
runs = []
|
| 191 |
+
for parts in ([3000.0], [0.3, 7.7, 400.0, 2592.0], [1.0] * 40 + [2960.0]):
|
| 192 |
+
g = Rig(seed=7)
|
| 193 |
+
g.call(g.A, 'power.set', on=True)
|
| 194 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0, relative_humidity=0.75)
|
| 195 |
+
for p in parts:
|
| 196 |
+
g.step(p)
|
| 197 |
+
v = g.read()
|
| 198 |
+
v.pop('clock.time_s')
|
| 199 |
+
runs.append(json.dumps(v, sort_keys=True, default=str))
|
| 200 |
+
self.assertEqual(runs[0], runs[1])
|
| 201 |
+
self.assertEqual(runs[0], runs[2])
|
| 202 |
+
|
| 203 |
+
def test_rejections_change_nothing(self):
|
| 204 |
+
r = rt.BinderKbf115Runtime('fresh')
|
| 205 |
+
r.register_principal('e', 'evaluator')
|
| 206 |
+
self.assertEqual(r.session('e').invoke(instance_id='fresh', capability_id='power.set', arguments=dict(on=True), request_id='p')['error']['code'], 'PLANT_REQUIRED')
|
| 207 |
+
g = Rig()
|
| 208 |
+
g.call(g.E, 'plant.configure', expect='SEED_FIXED', **dict(rt.PLANT_EXAMPLE, noise_seed=2))
|
| 209 |
+
g.call(g.E, 'plant.configure', expect='SUPPLY_FIXED', **dict(rt.PLANT_EXAMPLE, water_supply='can'))
|
| 210 |
+
g.call(g.A, 'setpoint.set', expect='POWER_OFF', temperature_k=T0 + 30.0)
|
| 211 |
+
g.call(g.A, 'alarm.reset', expect='POWER_OFF')
|
| 212 |
+
g.call(g.A, 'glass_door.move', expect='OUTER_DOOR_CLOSED', angle_rad=1.0)
|
| 213 |
+
g.call(g.A, 'sample.place', expect='OUTER_DOOR_CLOSED', **rt.SAMPLE_EXAMPLE)
|
| 214 |
+
g.call(g.A, 'sample.remove', expect='UNKNOWN_SAMPLE', sample_id='nothing')
|
| 215 |
+
g.call(g.A, 'can.refill', expect='NO_CAN')
|
| 216 |
+
g.call(g.A, 'power.set', on=True)
|
| 217 |
+
g.call(g.A, 'setpoint.set', expect='INVALID_ARGUMENT', relative_humidity=0.9)
|
| 218 |
+
g.call(g.A, 'setpoint.set', expect='INVALID_ARGUMENT', temperature_k=T0 + 75.0)
|
| 219 |
+
g.call(g.A, 'safety.configure', expect='OUT_OF_LIMITS', mode='limit', value_k=50.0)
|
| 220 |
+
g.call(g.A, 'tolerance.configure', expect='INVALID_ARGUMENT', delay_s=60.0)
|
| 221 |
+
g.call(g.A, 'program.start', expect='UNKNOWN_PROGRAM', program=5)
|
| 222 |
+
g.call(g.A, 'program.write', expect='INVALID_REPEAT', **dict(rt.PROGRAM_EXAMPLE, repeat=dict(from_section=2, to_section=2, count=1)))
|
| 223 |
+
g.call(g.A, 'program.write', **rt.PROGRAM_EXAMPLE)
|
| 224 |
+
g.call(g.A, 'program.start', program=2)
|
| 225 |
+
g.call(g.A, 'program.write', expect='PROGRAM_RUNNING', **rt.PROGRAM_EXAMPLE)
|
| 226 |
+
g.open()
|
| 227 |
+
g.call(g.A, 'door.move', expect='GLASS_DOOR_OPEN', angle_rad=0.0)
|
| 228 |
+
g.call(g.A, 'sample.place', expect='NO_SHELF', **dict(rt.SAMPLE_EXAMPLE, shelf=3))
|
| 229 |
+
g.call(g.A, 'sample.place', expect='SHELF_OVERLOAD', **dict(rt.SAMPLE_EXAMPLE, dry_mass_kg=29.0, container_mass_kg=2.0))
|
| 230 |
+
g.call(g.A, 'sample.place', expect='UNQUANTIFIED_SOLUTION', **dict(rt.SAMPLE_EXAMPLE, substance_id='lithium_chloride', initial_water_kg=0.01))
|
| 231 |
+
g.call(g.A, 'sample.place', **rt.SAMPLE_EXAMPLE)
|
| 232 |
+
g.call(g.A, 'sample.place', expect='DUPLICATE_SAMPLE', **rt.SAMPLE_EXAMPLE)
|
| 233 |
+
for i, sh in enumerate((1, 1, 2, 2)):
|
| 234 |
+
g.call(g.A, 'sample.place', **dict(rt.SAMPLE_EXAMPLE, sample_id=f'w{i}', substance_id='inert', dry_mass_kg=24.0, container_mass_kg=0.0, shelf=sh) if i % 2 == 0
|
| 235 |
+
else dict(rt.SAMPLE_EXAMPLE, sample_id=f'w{i}', substance_id='inert', dry_mass_kg=1.0, shelf=sh))
|
| 236 |
+
g.call(g.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, shelves=4))
|
| 237 |
+
g.call(g.A, 'sample.place', **dict(rt.SAMPLE_EXAMPLE, sample_id='big', substance_id='inert', dry_mass_kg=29.0, container_mass_kg=0.0, shelf=3))
|
| 238 |
+
g.call(g.A, 'sample.place', expect='LOAD_LIMIT', **dict(rt.SAMPLE_EXAMPLE, sample_id='big2', substance_id='inert', dry_mass_kg=29.0, container_mass_kg=0.0, shelf=4))
|
| 239 |
+
g.call(g.E, 'plant.configure', expect='SHELF_OCCUPIED', **dict(rt.PLANT_EXAMPLE, shelves=2))
|
| 240 |
+
g.call(g.A, 'sample.remove', sample_id='big')
|
| 241 |
+
g.call(g.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, shelves=2))
|
| 242 |
+
g.call(g.E, 'fault.inject', expect='INVALID_ARGUMENT', fault='alien', active=True)
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
class Physics(unittest.TestCase):
|
| 246 |
+
def test_steady_40_75_energy_water_and_fluctuation(self):
|
| 247 |
+
g = Rig()
|
| 248 |
+
g.run(40.0, 0.75)
|
| 249 |
+
self.assertEqual(g.read('state.current'), 'fixed')
|
| 250 |
+
self.assertEqual(g.read('chart.region'), 'A')
|
| 251 |
+
L0 = g.ledger()
|
| 252 |
+
Ts, RHs = [], []
|
| 253 |
+
for _ in range(240):
|
| 254 |
+
g.step(15.0)
|
| 255 |
+
c = g.climate()
|
| 256 |
+
Ts.append(c['air_k'])
|
| 257 |
+
RHs.append(g.read('humidity.chamber'))
|
| 258 |
+
L1 = g.ledger()
|
| 259 |
+
self.assertLessEqual(max(abs(t - (T0 + 40.0)) for t in Ts), 0.1 + 0.05) # +-0.1 K fluctuation
|
| 260 |
+
self.assertLessEqual(max(abs(r - 0.75) for r in RHs), rt.DOC['humidity_fluctuation']) # <= +-2 %RH
|
| 261 |
+
self.assertAlmostEqual((L1['electric_energy_j'] - L0['electric_energy_j']) / 3600.0, rt.DOC['energy_40_75_w'], delta=15.0)
|
| 262 |
+
g.step(86400.0 - 3600.0)
|
| 263 |
+
L2 = g.ledger()
|
| 264 |
+
self.assertAlmostEqual(L2['w_supply_in_kg'] - L0['w_supply_in_kg'], rt.DOC['water_consumption_kg_day']['at_40_75_closed'], delta=0.015)
|
| 265 |
+
self.assertAlmostEqual(g.read('display.temperature'), 40.0, delta=0.15)
|
| 266 |
+
self.assertLessEqual(g.read('truth.power')['mains_current_a'], rt.DOC['unit_fuse_a'])
|
| 267 |
+
_balance(self, L2)
|
| 268 |
+
|
| 269 |
+
def test_door_recovery_and_door_behaviour(self):
|
| 270 |
+
for T_c, rh, target in ((25.0, 0.60, rt.DOC['recovery_25_60_s']), (40.0, 0.75, rt.DOC['recovery_40_75_s'])):
|
| 271 |
+
g = Rig()
|
| 272 |
+
g.run(T_c, rh)
|
| 273 |
+
g.open()
|
| 274 |
+
g.step(30.0)
|
| 275 |
+
self.assertIn('DOOR_OPEN', g.read('notifications.active'))
|
| 276 |
+
self.assertTrue(g.read('indicator.door_open'))
|
| 277 |
+
self.assertLess(g.read('humidity.chamber'), rh - 0.03)
|
| 278 |
+
g.close()
|
| 279 |
+
last = 0.0
|
| 280 |
+
for k in range(1, 1801):
|
| 281 |
+
g.step(1.0)
|
| 282 |
+
if abs(g.read('temperature.chamber_k') - (T0 + T_c)) > 0.5 or abs(g.read('humidity.chamber') - rh) > 0.03:
|
| 283 |
+
last = float(k)
|
| 284 |
+
self.assertAlmostEqual(last, target, delta=0.25 * target, msg=(T_c, rh)) # one calibrated parameter for both targets
|
| 285 |
+
_balance(self, g.ledger())
|
| 286 |
+
g = Rig()
|
| 287 |
+
g.run(40.0, 0.75)
|
| 288 |
+
g.call(g.A, 'door.move', angle_rad=1.6)
|
| 289 |
+
g.step(30.0)
|
| 290 |
+
self.assertEqual(g.read('state.current'), 'fixed')
|
| 291 |
+
self.assertAlmostEqual(g.read('truth.power')['fan'], rt.ENG['fan_power_w'] * rt.FAN_LO ** 3, delta=1e-9) # fan at minimum speed
|
| 292 |
+
g.step(31.0)
|
| 293 |
+
self.assertEqual(g.read('state.current'), 'door_off') # all off after 60 s
|
| 294 |
+
p = g.read('truth.power')
|
| 295 |
+
self.assertEqual((p['heater'], p['fan'], p['compressor']), (0.0, 0.0, 0.0))
|
| 296 |
+
self.assertNotIn('DOOR_OPEN', g.read('alarms.active'))
|
| 297 |
+
g.step(rt.DOC['door_open_alarm_s'] - 61.0 + 1.0)
|
| 298 |
+
self.assertIn('DOOR_OPEN', g.read('alarms.active'))
|
| 299 |
+
self.assertTrue(g.read('alarm.audible'))
|
| 300 |
+
g.call(g.A, 'door.move', angle_rad=0.0)
|
| 301 |
+
g.step(1.0)
|
| 302 |
+
self.assertIn('DOOR_OPEN', g.read('alarms.active')) # not acknowledged: stays after the door closed
|
| 303 |
+
self.assertEqual(g.call(g.A, 'alarm.reset')['cleared'], ['DOOR_OPEN'])
|
| 304 |
+
self.assertFalse(g.read('alarm.audible'))
|
| 305 |
+
_balance(self, g.ledger())
|
| 306 |
+
|
| 307 |
+
def test_heat_compensation_200w(self):
|
| 308 |
+
res = {}
|
| 309 |
+
for load in (200.0, 300.0):
|
| 310 |
+
g = Rig()
|
| 311 |
+
g.call(g.A, 'power.set', on=True)
|
| 312 |
+
g.call(g.A, 'function.set', humidity_control=False)
|
| 313 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0)
|
| 314 |
+
g.open()
|
| 315 |
+
g.call(g.A, 'sample.place', sample_id='dut', substance_id='inert', shelf=1, dry_mass_kg=2.0, initial_k=T0 + 40.0, exposed_area_m2=0.2, heat_output_w=load)
|
| 316 |
+
g.close()
|
| 317 |
+
g.step(5 * 3600.0)
|
| 318 |
+
res[load] = g.climate()['air_k'] - (T0 + 40.0)
|
| 319 |
+
self.assertEqual(g.read('chart.region'), 'dry')
|
| 320 |
+
_balance(self, g.ledger())
|
| 321 |
+
self.assertLess(abs(res[200.0]), 0.15)
|
| 322 |
+
self.assertGreater(res[300.0], 1.0)
|
| 323 |
+
|
| 324 |
+
def test_climate_chart_regions(self):
|
| 325 |
+
g = Rig()
|
| 326 |
+
g.run(10.0, 0.40, settle=12 * 3600.0)
|
| 327 |
+
self.assertEqual(g.read('chart.region'), 'B')
|
| 328 |
+
self.assertIn('CLIMATE_CHART_B', g.read('notifications.active'))
|
| 329 |
+
self.assertAlmostEqual(g.read('humidity.chamber'), 0.40, delta=0.03)
|
| 330 |
+
g.step(13 * 3600.0)
|
| 331 |
+
self.assertIn('CLIMATE_CHART_B_24H', g.read('notifications.active'))
|
| 332 |
+
g = Rig()
|
| 333 |
+
g.run(20.0, 0.10, settle=12 * 3600.0)
|
| 334 |
+
self.assertEqual(g.read('chart.region'), 'outside')
|
| 335 |
+
self.assertIn('CLIMATE_CHART_OUTSIDE', g.read('notifications.active'))
|
| 336 |
+
self.assertGreater(g.read('humidity.chamber'), 0.10 + 0.03) # below the reachable dew point
|
| 337 |
+
self.assertLessEqual(g.climate()['dehumidification_evaporator_k'], rt.ENG['evaporator_min_k'] + 0.5)
|
| 338 |
+
_balance(self, g.ledger())
|
| 339 |
+
|
| 340 |
+
def test_program_ramp_step_repeat_pause_and_power_failure(self):
|
| 341 |
+
g = Rig()
|
| 342 |
+
g.run(25.0, 0.60, settle=4 * 3600.0)
|
| 343 |
+
secs = [dict(duration_s=1800.0, temperature_k=T0 + 25.0, relative_humidity=0.60, transition='step'),
|
| 344 |
+
dict(duration_s=3600.0, temperature_k=T0 + 25.0, relative_humidity=0.60, transition='ramp'),
|
| 345 |
+
dict(duration_s=3600.0, temperature_k=T0 + 25.0, relative_humidity=0.60, transition='ramp'),
|
| 346 |
+
dict(duration_s=600.0, temperature_k=T0 + 35.0, relative_humidity=0.70, transition='step'),
|
| 347 |
+
dict(duration_s=600.0, temperature_k=T0 + 45.0, relative_humidity=0.70, transition='step', tolerance_k=1.0),
|
| 348 |
+
dict(duration_s=1.0, temperature_k=T0 + 45.0, relative_humidity=0.70, transition='step')]
|
| 349 |
+
r = g.call(g.A, 'program.write', program=4, sections=secs, repeat=dict(from_section=1, to_section=2, count=1))
|
| 350 |
+
self.assertEqual(r['duration_s'], sum(x['duration_s'] for x in secs) + 1800.0 + 3600.0)
|
| 351 |
+
g.call(g.A, 'program.start', program=4)
|
| 352 |
+
g.step(1800.0 + 3600.0 + 1800.0 + 3600.0 + 1800.0) # sections 1, 2, repeated 1, 2, half of 3 (ramp)
|
| 353 |
+
st = g.read('program.status')['running']
|
| 354 |
+
self.assertEqual((st['section'], st['reps_done']), (3, 1))
|
| 355 |
+
self.assertAlmostEqual(st['elapsed'], 1800.0, delta=1.0)
|
| 356 |
+
self.assertAlmostEqual(g.read('setpoint.current')['temperature_k'], T0 + 30.0, delta=0.01) # ramp 25 C -> 35 C: half way 30 C
|
| 357 |
+
self.assertAlmostEqual(g.read('setpoint.current')['relative_humidity'], 0.65, delta=1e-4)
|
| 358 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=True)
|
| 359 |
+
g.step(1200.0)
|
| 360 |
+
self.assertEqual(g.read('state.current'), 'outage')
|
| 361 |
+
self.assertEqual(g.read('alarms.active'), []) # the panel is dead
|
| 362 |
+
g.call(g.E, 'fault.inject', fault='mains_outage', active=False)
|
| 363 |
+
g.step(1.0)
|
| 364 |
+
self.assertAlmostEqual(g.read('program.status')['running']['elapsed'], 1801.0, delta=1.5) # program time held during the outage
|
| 365 |
+
self.assertIn('POWER_FAILURE', g.read('alarms.active'))
|
| 366 |
+
g.step(1799.0 + 600.0 + 60.0)
|
| 367 |
+
self.assertEqual(g.read('program.status')['running']['section'], 5)
|
| 368 |
+
self.assertEqual(g.read('state.current'), 'program_paused') # step to 45 C outside the 1 K band
|
| 369 |
+
self.assertLess(g.read('program.status')['running']['elapsed'], 120.0)
|
| 370 |
+
g.until(lambda: g.read('program.status')['running'] is None, 6 * 3600.0, 60.0)
|
| 371 |
+
self.assertEqual(g.read('setpoint.current')['source'], 'fixed')
|
| 372 |
+
self.assertTrue(any(e['code'] == 'PROGRAM_PAUSE' for e in g.call(g.A, 'events.read', since_s=0.0)['events']))
|
| 373 |
+
g.call(g.A, 'program.start', program=4)
|
| 374 |
+
self.assertTrue(g.call(g.A, 'program.stop')['stopped'])
|
| 375 |
+
_balance(self, g.ledger())
|
| 376 |
+
|
| 377 |
+
def test_safety_tolerance_alarms_reset_and_buzzer(self):
|
| 378 |
+
g = Rig()
|
| 379 |
+
g.run(40.0, 0.75)
|
| 380 |
+
g.call(g.A, 'tolerance.configure', temperature_k=2.0, relative_humidity=0.05, delay_s=900.0)
|
| 381 |
+
g.call(g.A, 'safety.configure', mode='offset', value_k=2.0)
|
| 382 |
+
self.assertAlmostEqual(g.read('safety.settings')['limit_k'], T0 + 42.0)
|
| 383 |
+
g.open()
|
| 384 |
+
g.call(g.A, 'sample.place', sample_id='hot', substance_id='inert', shelf=2, dry_mass_kg=3.0, initial_k=T0 + 40.0, exposed_area_m2=0.3, heat_output_w=450.0)
|
| 385 |
+
g.close()
|
| 386 |
+
t = g.until(lambda: 'SAFETY_CONTROLLER' in g.read('alarms.active'), 3 * 3600.0, 10.0)
|
| 387 |
+
self.assertLess(t, 3 * 3600.0)
|
| 388 |
+
self.assertEqual(g.read('truth.power')['heater'], 0.0)
|
| 389 |
+
self.assertTrue(g.read('indicator.alarm_header'))
|
| 390 |
+
g.step(960.0)
|
| 391 |
+
self.assertIn('TEMPERATURE_RANGE', g.read('alarms.active'))
|
| 392 |
+
r = g.call(g.A, 'alarm.reset')
|
| 393 |
+
self.assertIn('SAFETY_CONTROLLER', r['muted'])
|
| 394 |
+
self.assertFalse(g.read('alarm.audible'))
|
| 395 |
+
g.open()
|
| 396 |
+
g.call(g.A, 'sample.remove', sample_id='hot')
|
| 397 |
+
g.close()
|
| 398 |
+
g.until(lambda: 'SAFETY_CONTROLLER' not in g.read('alarms.active'), 4 * 3600.0, 30.0)
|
| 399 |
+
self.assertNotIn('SAFETY_CONTROLLER', g.read('alarms.active')) # acknowledged: clears by itself
|
| 400 |
+
g.step(3 * 3600.0)
|
| 401 |
+
self.assertNotIn('TEMPERATURE_RANGE', g.read('alarms.active'))
|
| 402 |
+
g.call(g.A, 'buzzer.set', on=False)
|
| 403 |
+
g.call(g.E, 'fault.inject', fault='humidity_module_failure', active=True)
|
| 404 |
+
g.step(5.0)
|
| 405 |
+
self.assertIn('HUMIDITY_SYSTEM', g.read('alarms.active'))
|
| 406 |
+
self.assertFalse(g.read('alarm.audible')) # buzzer off
|
| 407 |
+
g.call(g.A, 'buzzer.set', on=True)
|
| 408 |
+
self.assertNotIn('HUMIDITY_SYSTEM', g.call(g.A, 'alarm.reset')['muted']) # must not be acknowledged
|
| 409 |
+
self.assertTrue(g.read('alarm.audible'))
|
| 410 |
+
g.call(g.E, 'fault.inject', fault='humidity_module_failure', active=False)
|
| 411 |
+
for f, code in (('temperature_sensor_failure', 'TEMPERATURE_SENSOR'), ('humidity_sensor_failure', 'HUMIDITY_SENSOR'), ('safety_sensor_failure', 'SAFETY_SENSOR'),
|
| 412 |
+
('door_sensor_failure', 'DOOR_SENSOR')):
|
| 413 |
+
g.call(g.E, 'fault.inject', fault=f, active=True)
|
| 414 |
+
g.step(2.0)
|
| 415 |
+
self.assertIn(code, g.read('alarms.active'))
|
| 416 |
+
self.assertIsNone(g.read('display.temperature'))
|
| 417 |
+
self.assertIsNone(g.read('display.humidity'))
|
| 418 |
+
_balance(self, g.ledger())
|
| 419 |
+
|
| 420 |
+
def test_water_supply_can_and_wastewater(self):
|
| 421 |
+
g = Rig()
|
| 422 |
+
g.run(40.0, 0.75)
|
| 423 |
+
g.call(g.A, 'water.supply', open=False)
|
| 424 |
+
t = g.until(lambda: 'FRESHWATER_SUPPLY' in g.read('alarms.active'), 48 * 3600.0, 600.0)
|
| 425 |
+
self.assertLess(t, 3 * 3600.0) # the next fill attempt fails (level about 10 % down)
|
| 426 |
+
self.assertTrue(g.read('indicator.water'))
|
| 427 |
+
g.step(36 * 3600.0) # the 0.07 L container runs dry (about 0.1 L a day)
|
| 428 |
+
self.assertLess(g.read('humidity.chamber'), 0.70)
|
| 429 |
+
g.call(g.A, 'water.supply', open=True)
|
| 430 |
+
g.step(3600.0)
|
| 431 |
+
self.assertAlmostEqual(g.read('humidity.chamber'), 0.75, delta=0.02)
|
| 432 |
+
_balance(self, g.ledger())
|
| 433 |
+
c = Rig(water_supply='can')
|
| 434 |
+
self.assertEqual(c.read('water.can_kg'), rt.ENG['can_capacity_kg'])
|
| 435 |
+
c.run(25.0, 0.60, settle=3600.0)
|
| 436 |
+
kg = c.read('water.can_kg')
|
| 437 |
+
self.assertLess(kg, rt.ENG['can_capacity_kg'])
|
| 438 |
+
c.call(c.A, 'can.refill')
|
| 439 |
+
self.assertEqual(c.read('water.can_kg'), rt.ENG['can_capacity_kg'])
|
| 440 |
+
c.h.can_kg = 0.0 # an empty can (evaluator shortcut)
|
| 441 |
+
c.h.hum_kg = 0.0
|
| 442 |
+
c.step(10.0)
|
| 443 |
+
self.assertIn('FRESHWATER_CAN_EMPTY', c.read('alarms.active'))
|
| 444 |
+
w = Rig()
|
| 445 |
+
w.run(25.0, 0.80, settle=2 * 3600.0)
|
| 446 |
+
w.call(w.E, 'fault.inject', fault='wastewater_blocked', active=True)
|
| 447 |
+
old = w.h.waste
|
| 448 |
+
w.h.waste = 0.49 # a nearly full can (evaluator shortcut)
|
| 449 |
+
w.h.led['w_initial_kg'] += 0.49 - old # keep the water ledger consistent
|
| 450 |
+
w.call(w.A, 'setpoint.set', relative_humidity=0.30)
|
| 451 |
+
t = w.until(lambda: 'WASTEWATER' in w.read('alarms.active'), 48 * 3600.0, 300.0)
|
| 452 |
+
self.assertLess(t, 48 * 3600.0)
|
| 453 |
+
self.assertGreaterEqual(w.climate()['wastewater_kg'], rt.DOC['wastewater_tank_kg'] - 1e-9)
|
| 454 |
+
_balance(self, w.ledger())
|
| 455 |
+
|
| 456 |
+
def test_sample_exposure_templates(self):
|
| 457 |
+
g = Rig()
|
| 458 |
+
g.run(25.0, 0.60)
|
| 459 |
+
g.open()
|
| 460 |
+
g.call(g.A, 'sample.place', sample_id='nacl', substance_id='sodium_chloride', shelf=1, dry_mass_kg=0.010, exposed_area_m2=0.02, initial_k=T0 + 25.0, container_mass_kg=0.05)
|
| 461 |
+
g.call(g.A, 'sample.place', sample_id='kcl', substance_id='potassium_chloride', shelf=1, dry_mass_kg=0.010, exposed_area_m2=0.005, initial_k=T0 + 25.0)
|
| 462 |
+
g.call(g.A, 'sample.place', sample_id='mof', substance_id='uio_66', shelf=2, dry_mass_kg=0.005, exposed_area_m2=0.003, initial_k=T0 + 25.0)
|
| 463 |
+
g.call(g.A, 'sample.place', sample_id='cold', substance_id='inert', shelf=2, dry_mass_kg=0.5, exposed_area_m2=0.02, initial_k=T0 + 5.0, heat_capacity_j_kg_k=900.0)
|
| 464 |
+
g.call(g.A, 'sample.place', sample_id='drug', substance_id='inert', shelf=2, dry_mass_kg=0.02, initial_k=T0 + 25.0,
|
| 465 |
+
degradation=dict(rate_ref_per_s=1e-7, activation_j_mol=100000.0, humidity_exponent=2.0))
|
| 466 |
+
g.close()
|
| 467 |
+
self.assertEqual(len(g.call(g.A, 'samples.read')['samples']), 5)
|
| 468 |
+
g.step(1800.0)
|
| 469 |
+
tr = g.read('truth.samples')
|
| 470 |
+
self.assertGreater(tr['cold']['exposure']['condensation_events'], 0) # cold item below the dew point
|
| 471 |
+
g.step(2 * 86400.0)
|
| 472 |
+
tr = g.read('truth.samples')
|
| 473 |
+
self.assertEqual(tr['nacl']['water_kg'], 0.0) # 60 %RH < NaCl 75.3 %
|
| 474 |
+
self.assertEqual(tr['nacl']['state'], 'dry')
|
| 475 |
+
q_eq = rt._interp(rt.SORPTION['uio_66']['adsorption']['relative_humidity'], rt.SORPTION['uio_66']['adsorption']['uptake_kg_kg'], 0.60)
|
| 476 |
+
self.assertAlmostEqual(tr['mof']['water_kg'] / 0.005, q_eq, delta=0.1 * q_eq)
|
| 477 |
+
self.assertEqual(tr['cold']['film_kg'], 0.0) # the film evaporated after warming
|
| 478 |
+
g.call(g.A, 'setpoint.set', relative_humidity=0.80)
|
| 479 |
+
g.step(4 * 86400.0)
|
| 480 |
+
tr = g.read('truth.samples')
|
| 481 |
+
self.assertGreater(tr['nacl']['water_kg'], 0.0) # 80 %RH > 75.3 %: deliquesced
|
| 482 |
+
self.assertIn(tr['nacl']['state'], ('solution', 'saturated_solution', 'solution_extrapolated'))
|
| 483 |
+
self.assertEqual(tr['kcl']['water_kg'], 0.0) # KCl 84.3 %: still dry
|
| 484 |
+
g.step(10 * 86400.0)
|
| 485 |
+
tr = g.read('truth.samples')
|
| 486 |
+
m = 0.010 / rt.SORPTION['sodium_chloride']['solution_branch']['solute_molar_mass_kg_mol'] / tr['nacl']['water_kg']
|
| 487 |
+
aw, q = rt.branch_aw('sodium_chloride', m)
|
| 488 |
+
self.assertAlmostEqual(aw, 0.80, delta=0.02) # solution in equilibrium with 80 %RH
|
| 489 |
+
g.open()
|
| 490 |
+
rep = g.call(g.A, 'sample.remove', sample_id='nacl')['sample']
|
| 491 |
+
self.assertEqual(rep['appearance'], 'liquid')
|
| 492 |
+
self.assertAlmostEqual(rep['total_mass_kg'], 0.06 + tr['nacl']['water_kg'], delta=1e-3)
|
| 493 |
+
self.assertNotIn('exposure', rep) # hidden process values only in the truth
|
| 494 |
+
g.call(g.A, 'sample.remove', sample_id='drug')
|
| 495 |
+
g.close()
|
| 496 |
+
rm = {r['sample_id']: r for r in g.call(g.E, 'truth.inspect')['removed_samples']}
|
| 497 |
+
self.assertAlmostEqual(rm['nacl']['exposure']['mean_kinetic_temperature_k'], T0 + 25.0, delta=0.6) # shelf offset and the latent heat of uptake
|
| 498 |
+
self.assertGreater(rm['nacl']['exposure']['time_above_deliquescence_s'], 13 * 86400.0)
|
| 499 |
+
self.assertGreater(rm['drug']['degraded_fraction'], 0.0)
|
| 500 |
+
self.assertLess(rm['drug']['degraded_fraction'], 1.0)
|
| 501 |
+
_balance(self, g.ledger())
|
| 502 |
+
|
| 503 |
+
def test_glass_fog_when_door_heating_fails(self):
|
| 504 |
+
g = Rig(ambient_k=T0 + 15.0)
|
| 505 |
+
g.run(40.0, 0.80, settle=4 * 3600.0)
|
| 506 |
+
self.assertFalse(g.read('door.glass_fogged'))
|
| 507 |
+
g.call(g.E, 'fault.inject', fault='door_heating_failure', active=True)
|
| 508 |
+
g.step(4 * 3600.0)
|
| 509 |
+
self.assertTrue(g.read('door.glass_fogged'))
|
| 510 |
+
self.assertLess(g.climate()['glass_k'], g.climate()['dew_point_k'])
|
| 511 |
+
g.call(g.E, 'fault.inject', fault='door_heating_failure', active=False)
|
| 512 |
+
g.step(8 * 3600.0)
|
| 513 |
+
self.assertFalse(g.read('door.glass_fogged'))
|
| 514 |
+
_balance(self, g.ledger())
|
| 515 |
+
|
| 516 |
+
def test_icing_below_5c_and_manual_defrost(self):
|
| 517 |
+
g = Rig()
|
| 518 |
+
g.call(g.A, 'power.set', on=True)
|
| 519 |
+
g.call(g.A, 'function.set', humidity_control=False)
|
| 520 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 2.0)
|
| 521 |
+
g.step(86400.0)
|
| 522 |
+
self.assertAlmostEqual(g.read('temperature.chamber_k'), T0 + 2.0, delta=0.3)
|
| 523 |
+
g.step(2 * 86400.0)
|
| 524 |
+
ice = g.climate()['evaporator_ice_kg']
|
| 525 |
+
self.assertGreater(ice, 0.0)
|
| 526 |
+
g.call(g.A, 'function.set', humidity_control=True) # manual defrost: 0 %RH, 40 C, 30 min
|
| 527 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0, relative_humidity=0.0)
|
| 528 |
+
g.step(1800.0 + 3600.0)
|
| 529 |
+
self.assertLess(g.climate()['evaporator_ice_kg'], 0.05 * ice)
|
| 530 |
+
_balance(self, g.ledger())
|
| 531 |
+
|
| 532 |
+
def test_idle_humidity_off_warmup_and_logger(self):
|
| 533 |
+
g = Rig()
|
| 534 |
+
g.run(30.0, 0.70, settle=3 * 3600.0)
|
| 535 |
+
g.call(g.A, 'logger.configure', interval_s=120.0)
|
| 536 |
+
g.call(g.A, 'function.set', humidity_control=False)
|
| 537 |
+
self.assertIsNone(g.read('setpoint.current')['relative_humidity'])
|
| 538 |
+
self.assertIn('HUMIDITY_OFF', g.read('notifications.active'))
|
| 539 |
+
g.step(1200.0)
|
| 540 |
+
self.assertEqual(g.climate()['humidifier_ready'], 0.0)
|
| 541 |
+
g.call(g.A, 'function.set', humidity_control=True)
|
| 542 |
+
g.step(300.0)
|
| 543 |
+
self.assertLess(g.climate()['humidifier_ready'], 1.0) # up to 10 min until fully available
|
| 544 |
+
g.step(400.0)
|
| 545 |
+
self.assertEqual(g.climate()['humidifier_ready'], 1.0)
|
| 546 |
+
g.call(g.A, 'function.set', idle_mode=True)
|
| 547 |
+
g.step(600.0)
|
| 548 |
+
self.assertEqual(g.read('state.current'), 'idle')
|
| 549 |
+
self.assertEqual(g.read('truth.power')['heater'], 0.0)
|
| 550 |
+
g.call(g.A, 'function.set', idle_mode=False)
|
| 551 |
+
recs = g.call(g.A, 'log.read', last=20)['records']
|
| 552 |
+
self.assertEqual(len(recs), 20)
|
| 553 |
+
self.assertAlmostEqual(recs[-1]['time_s'] - recs[-2]['time_s'], 120.0, delta=1e-6)
|
| 554 |
+
self.assertEqual(g.read('logger.settings')['interval_s'], 120.0)
|
| 555 |
+
g.call(g.A, 'power.set', on=False)
|
| 556 |
+
self.assertEqual(g.read('state.current'), 'off')
|
| 557 |
+
g.call(g.A, 'power.toggle')
|
| 558 |
+
self.assertTrue(g.read('power.on'))
|
| 559 |
+
_balance(self, g.ledger())
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
def test_review_r1_fixes(self):
|
| 563 |
+
g = Rig()
|
| 564 |
+
g.call(g.A, 'power.set', on=True)
|
| 565 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 25.0, relative_humidity=0.60)
|
| 566 |
+
g.step(900.0)
|
| 567 |
+
self.assertEqual(g.read('truth.climate')['steam_kg_s'], 0.0) # E7: about 20 min before humidification
|
| 568 |
+
g.step(900.0)
|
| 569 |
+
self.assertGreater(g.read('truth.climate')['steam_kg_s'] + g.read('truth.climate')['humidifier_ready'], 0.0)
|
| 570 |
+
g.call(g.A, 'safety.configure', mode='limit', value_k=T0 + 45.0) # absolute limit accepted
|
| 571 |
+
g.call(g.A, 'safety.configure', mode='offset', value_k=40.0, expect='OUT_OF_LIMITS')
|
| 572 |
+
g.call(g.A, 'safety.configure', mode='offset', value_k=2.0)
|
| 573 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0, relative_humidity=0.75, fan_fraction=0.4) # lowest documented fan speed
|
| 574 |
+
g.step(10 * 3600.0)
|
| 575 |
+
self.assertAlmostEqual(g.read('truth.climate')['relative_humidity'], 0.75, delta=0.035)
|
| 576 |
+
g.call(g.E, 'plant.configure', **dict(rt.PLANT_EXAMPLE, ambient_k=T0 + 35.0, pressure_pa=80000.0)) # re-referenced energy stays balanced
|
| 577 |
+
g.step(600.0)
|
| 578 |
+
_balance(self, g.call(g.E, 'ledger.read')['ledger'])
|
| 579 |
+
g.open()
|
| 580 |
+
g.call(g.A, 'sample.place', sample_id='h1', substance_id='inert', shelf=1, dry_mass_kg=1.0, initial_k=T0 + 40.0, heat_output_w=400.0)
|
| 581 |
+
g.call(g.A, 'sample.place', sample_id='h2', substance_id='inert', shelf=1, dry_mass_kg=1.0, initial_k=T0 + 40.0, heat_output_w=200.0, expect='HEAT_LOAD_LIMIT')
|
| 582 |
+
g.call(g.A, 'sample.remove', sample_id='h1')
|
| 583 |
+
g.call(g.A, 'sample.place', sample_id='suc', substance_id='d_sucrose', shelf=1, dry_mass_kg=0.010, initial_k=T0 + 25.0,
|
| 584 |
+
initial_water_kg=0.010 / rt.SORPTION['d_sucrose']['solution_branch']['solute_molar_mass_kg_mol']) # 1 mol/kg
|
| 585 |
+
g.close()
|
| 586 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 25.0, relative_humidity=0.30, fan_fraction=1.0)
|
| 587 |
+
g.step(2 * 86400.0)
|
| 588 |
+
b = rt.SORPTION['d_sucrose']['solution_branch']
|
| 589 |
+
w_min = 0.010 / b['solute_molar_mass_kg_mol'] / b['molality_mol_kg'][-1]
|
| 590 |
+
self.assertGreater(g.read('truth.samples')['suc']['water_kg'], 0.9 * w_min) # stops at the most concentrated measured point
|
| 591 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 3.0, relative_humidity=0.60)
|
| 592 |
+
g.step(60.0)
|
| 593 |
+
self.assertIn('HUMIDITY_OFF', g.read('notifications.active')) # E7: humidity control off below 5 C
|
| 594 |
+
|
| 595 |
+
|
| 596 |
+
def test_review_r2_fixes(self):
|
| 597 |
+
g = Rig()
|
| 598 |
+
g.call(g.A, 'power.set', on=True)
|
| 599 |
+
g.call(g.A, 'function.set', humidity_control=False)
|
| 600 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 60.0, fan_fraction=1.0) # high heater load: integral released after the hold
|
| 601 |
+
g.step(6 * 3600.0)
|
| 602 |
+
self.assertAlmostEqual(g.read('truth.climate')['air_k'], T0 + 60.0, delta=0.1)
|
| 603 |
+
self.assertEqual(g.call(g.A, 'setpoint.set', temperature_k=T0 + 3.0)['chart_region'], 'dry') # same rule as chart.region
|
| 604 |
+
g.call(g.A, 'setpoint.set', temperature_k=T0 + 40.0, relative_humidity=0.5)
|
| 605 |
+
g.call(g.A, 'function.set', humidity_control=True) # after dry running: no second 20 min wait
|
| 606 |
+
g.step(700.0)
|
| 607 |
+
self.assertGreater(g.read('truth.climate')['humidifier_ready'], 0.9)
|
| 608 |
+
d = Rig()
|
| 609 |
+
d.run(50.0, 0.10) # dehumidification without temperature swings
|
| 610 |
+
xs = []
|
| 611 |
+
for _ in range(180):
|
| 612 |
+
d.step(10.0)
|
| 613 |
+
xs.append(d.read('truth.climate')['air_k'])
|
| 614 |
+
self.assertLess(max(xs) - min(xs), 0.2)
|
| 615 |
+
w = Rig()
|
| 616 |
+
w.call(w.A, 'power.set', on=True)
|
| 617 |
+
w.call(w.A, 'setpoint.set', temperature_k=T0 + 30.0, relative_humidity=0.65, fan_fraction=0.4) # no overshoot trip at minimum fan
|
| 618 |
+
w.step(3600.0)
|
| 619 |
+
self.assertNotIn('SAFETY_CONTROLLER', w.read('alarms.active'))
|
| 620 |
+
c = Rig()
|
| 621 |
+
c.call(c.A, 'power.set', on=True)
|
| 622 |
+
c.call(c.A, 'function.set', humidity_control=False)
|
| 623 |
+
c.call(c.A, 'setpoint.set', temperature_k=T0 + 59.0)
|
| 624 |
+
c.step(6 * 3600.0)
|
| 625 |
+
c.call(c.A, 'setpoint.set', temperature_k=T0 + 61.0) # compressor stops: bumpless, no safety trip
|
| 626 |
+
peak = 0.0
|
| 627 |
+
for _ in range(120):
|
| 628 |
+
c.step(10.0)
|
| 629 |
+
peak = max(peak, c.read('truth.climate')['air_k'] - T0 - 61.0)
|
| 630 |
+
self.assertLess(peak, 0.8)
|
| 631 |
+
self.assertNotIn('SAFETY_CONTROLLER', c.read('alarms.active'))
|
| 632 |
+
s = Rig()
|
| 633 |
+
s.run(40.0, 0.50, settle=3 * 3600.0) # start-up from the room: no false humidity alarm
|
| 634 |
+
self.assertNotIn('HUMIDITY_RANGE', s.read('alarms.active'))
|
| 635 |
+
|
| 636 |
+
|
| 637 |
+
class ZCoverage(unittest.TestCase):
|
| 638 |
+
def test_all_capabilities_exercised(self):
|
| 639 |
+
implemented = {k for k in rt.CAPS if k not in rt.UNSUPPORTED}
|
| 640 |
+
missing = implemented - SEEN_CAPS
|
| 641 |
+
if len(SEEN_CAPS) > 5:
|
| 642 |
+
self.assertFalse(missing, sorted(missing))
|
| 643 |
+
|
| 644 |
+
|
| 645 |
+
if __name__ == '__main__':
|
| 646 |
+
unittest.main()
|
tests/test_asset_biolin_mediuml.py
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CHEM127 finite real-source Langmuir/Wilhelmy/deposition protocol regressions."""
|
| 2 |
+
import copy,hashlib,importlib.util,json,math,sys,unittest
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
from unittest import mock
|
| 5 |
+
import numpy as np
|
| 6 |
+
ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'scripts'))
|
| 7 |
+
from asset_runtime import biolin_mediuml as rt
|
| 8 |
+
OBSERVED=[]
|
| 9 |
+
def call(h,k,**a):
|
| 10 |
+
r=h.invoke(k,**a);OBSERVED.append((k,copy.deepcopy(a),copy.deepcopy(r)));return r
|
| 11 |
+
def setup(name='mediuml_test',plant=None,sample=None,substrate=False,preimmerse=False):
|
| 12 |
+
h=rt.BiolinMediumlRuntime(name)
|
| 13 |
+
for k,a in [('plant.configure',dict(rt.PLANT_EXAMPLE,**(plant or {}))),('subphase.load',rt.SUBPHASE_EXAMPLE),('power.set',{'enabled':True})]:call(h,k,**a)
|
| 14 |
+
if substrate or preimmerse:
|
| 15 |
+
call(h,'substrate.load',**rt.SUBSTRATE_EXAMPLE);call(h,'clamp.set',locked=True)
|
| 16 |
+
if preimmerse:call(h,'dipper.move',position_m=.119,speed_m_s=.0018);h.step(66.2)
|
| 17 |
+
call(h,'balance.tare');call(h,'solution.load',**dict(rt.SAMPLE_EXAMPLE,**(sample or {})));call(h,'film.spread',volume_m3=50e-9);h.step(4.)
|
| 18 |
+
return h
|
| 19 |
+
def finish(h,limit=300):
|
| 20 |
+
for _ in range(round(limit/.1)):
|
| 21 |
+
h.step(.1)
|
| 22 |
+
if h.phase!='running':break
|
| 23 |
+
return call(h,'acquisition.result')
|
| 24 |
+
def compress(h):
|
| 25 |
+
call(h,'method.configure',**rt.METHOD_EXAMPLE);call(h,'acquisition.start');return finish(h)
|
| 26 |
+
def deposition_ready(plant=None):
|
| 27 |
+
h=setup(plant=plant,preimmerse=True);m=dict(rt.METHOD_EXAMPLE,mode='hold',duration_s=100.)
|
| 28 |
+
call(h,'method.configure',**m);call(h,'acquisition.start');finish(h)
|
| 29 |
+
m.update(mode='deposition',duration_s=45.,dipper_positions_m=[.063]);call(h,'method.configure',**m);return h
|
| 30 |
+
|
| 31 |
+
def cleanup(h):
|
| 32 |
+
if h.phase=='running':call(h,'acquisition.stop')
|
| 33 |
+
if h.control:call(h,'pressure.control',enabled=False,target_n_m=.02,speed_m_s=.0045)
|
| 34 |
+
if h.substrate:
|
| 35 |
+
call(h,'dipper.move',position_m=0.,speed_m_s=.0018);h.step(70.);call(h,'clamp.set',locked=False);call(h,'substrate.remove')
|
| 36 |
+
call(h,'film.clean');call(h,'solution.remove');call(h,'probe.move',distance_m=.04);call(h,'subphase.remove');call(h,'power.set',enabled=False)
|
| 37 |
+
|
| 38 |
+
class TestMediumL(unittest.TestCase):
|
| 39 |
+
def rejected(self,h,k,error='.',**a):
|
| 40 |
+
before=copy.deepcopy(h.__dict__)
|
| 41 |
+
with self.assertRaisesRegex(rt.ActionRejected,error):h.invoke(k,**a)
|
| 42 |
+
self.assertEqual(before,h.__dict__)
|
| 43 |
+
def ledger(self,h):
|
| 44 |
+
x=call(h,'ledger.read')
|
| 45 |
+
for k in ['solute_error_mol','solute_error_kg','solvent_error_m3']:self.assertLess(abs(x[k]),1e-18,k)
|
| 46 |
+
self.assertLess(abs(x['subphase_error_kg']),1e-12);self.assertLess(abs(x['thermal_error_j']),1e-10);return x
|
| 47 |
+
def test_01_real_source_compression_and_same_number_area(self):
|
| 48 |
+
h=setup();n=h.surface_mol;r=compress(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(len(r['rows']),169);self.assertAlmostEqual(r['elapsed_s'],16.8);self.assertAlmostEqual(h.area,.016);self.assertEqual(h.surface_mol,n);a,p=rt.curve(h.reference);self.assertAlmostEqual(h._eos()[0],np.interp(h.area/n/rt.NA,a,p));self.assertGreater(r['rows'][-1]['surface_pressure_n_m'],r['rows'][0]['surface_pressure_n_m']);self.ledger(h)
|
| 49 |
+
def test_02_three_real_references_preserved_and_distinct(self):
|
| 50 |
+
lib=rt.library();ids=['statins2020_dmpc_control','statins2020_dmpe_control','statins2020_dmps_control'];pressures=[]
|
| 51 |
+
for rid in ids:
|
| 52 |
+
rec=copy.deepcopy(lib['substances'][rid]);h=setup(sample={'reference_id':rid});compress(h);pressures.append(h._eos()[0]);self.assertEqual(h.reference,rec);self.assertGreater(len(rec['values']['molecular_area_m2']),600);self.assertEqual(rec['conditions']['temperature_k'],294.15);self.assertEqual(h.source,json.dumps(rec['source'],ensure_ascii=False));self.ledger(h)
|
| 53 |
+
self.assertEqual(len(set(round(p,8) for p in pressures)),3);self.assertGreaterEqual(len(lib['substances']),46);self.assertEqual(sum(v.get('runtime_usable') is True for v in lib['substances'].values()),3)
|
| 54 |
+
def test_03_negative_noise_and_local_derivative_not_clipped(self):
|
| 55 |
+
rec=rt.library()['substances']['statins2020_dmpc_control'];a,p=rt.curve(rec);self.assertLess(min(p),0);found=False
|
| 56 |
+
for j in range(len(a)-1):
|
| 57 |
+
x=(a[j]+a[j+1])/2
|
| 58 |
+
if x<rec['runtime_domain']['minimum_molecular_area_m2']:continue
|
| 59 |
+
q,c=rt.eos(rec,x);self.assertAlmostEqual(q,(p[j]+p[j+1])/2,places=12);self.assertAlmostEqual(c,-x*(p[j+1]-p[j])/(a[j+1]-a[j]),places=10)
|
| 60 |
+
if c<0:found=True
|
| 61 |
+
self.assertTrue(found)
|
| 62 |
+
def test_04_collapse_and_extrapolation_domains_atomic(self):
|
| 63 |
+
h=setup();lower=h.reference['runtime_domain']['minimum_molecular_area_m2'];self.rejected(h,'barrier.move','EOS_AREA_RANGE',area_m2=lower*h.surface_mol*rt.NA*.99,speed_m_s=.0045)
|
| 64 |
+
for a in [lower*.99,max(h.reference['values']['molecular_area_m2'])*1.01]:
|
| 65 |
+
with self.assertRaises(rt.ActionRejected):rt.eos(h.reference,a)
|
| 66 |
+
self.assertEqual(rt.eos(h.reference,max(h.reference['values']['molecular_area_m2'])*1.01,True),(0.,0.))
|
| 67 |
+
def test_05_evaporation_finite_latent_and_not_instant(self):
|
| 68 |
+
h=rt.BiolinMediumlRuntime()
|
| 69 |
+
for k,a in [('plant.configure',rt.PLANT_EXAMPLE),('subphase.load',rt.SUBPHASE_EXAMPLE),('power.set',{'enabled':True}),('balance.tare',{}),('solution.load',rt.SAMPLE_EXAMPLE),('film.spread',{'volume_m3':50e-9})]:call(h,k,**a)
|
| 70 |
+
self.assertEqual(h.surface_solvent,50e-9);self.rejected(h,'acquisition.start','SOLVENT_NOT_EVAPORATED');h.step(1.);self.assertAlmostEqual(h.surface_solvent,50e-9*math.exp(-2.));self.assertAlmostEqual(h.latent_energy,(50e-9-h.surface_solvent)*1480*250000);h.step(3.);compress(h);self.ledger(h)
|
| 71 |
+
def test_06_noisy_wilhelmy_has_wetting_bias(self):
|
| 72 |
+
h=setup(plant={'plate_contact_cosine':.7,'force_gain':1.2});p=h._eos()[0];self.assertAlmostEqual(h._observed(),p*.7*1.2,places=9);self.assertNotAlmostEqual(h._observed(),p,places=5);self.rejected(h,'balance.tare','CLEAN_BASELINE_REQUIRED');self.ledger(h)
|
| 73 |
+
def test_07_buoyancy_level_and_fixed_tare_observation(self):
|
| 74 |
+
h=setup(substrate=True);start=h._observed();n=h.surface_mol;call(h,'dipper.move',position_m=.119,speed_m_s=.0018);h.step(66.2);self.assertEqual(h.surface_mol,n);rise=.052*.003*.056/rt.AREA_MAX;self.assertAlmostEqual(h._liquid_rise(),rise);self.assertAlmostEqual(h.read()['subphase.level_delta_m'],rise);self.assertGreater(h._observed(),start);self.ledger(h)
|
| 75 |
+
def test_08_full_hydrophilic_first_upstroke_actual_transfer_ratio(self):
|
| 76 |
+
h=deposition_ready();before=h.surface_mol;call(h,'acquisition.start');r=finish(h);self.assertEqual(r['phase'],'succeeded');self.assertEqual(r['completed_strokes'],1);s=r['strokes'][0];self.assertEqual(s['direction'],'up');self.assertAlmostEqual(s['swept_area_m2'],2*.052*.056,places=12);self.assertAlmostEqual(s['transfer_ratio'],(s['start_area_m2']-s['end_area_m2'])/s['swept_area_m2']);self.assertGreater(h.deposited_mol,0);self.assertAlmostEqual(before-h.surface_mol,h.deposited_mol,places=18);self.assertNotEqual(s['transfer_ratio'],h.substrate['transfer_efficiency']);self.assertTrue(h.first_favorable_transferred);self.ledger(h)
|
| 77 |
+
def test_09_cancel_keeps_partial_layer_inventory_and_history(self):
|
| 78 |
+
h=deposition_ready();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start')['operation_id'];h.step(3.);s.cancel(op,'cancel');r=s.poll(op);self.assertEqual(r['result']['completed_strokes'],0);self.assertFalse(r['result']['strokes'][0]['completed']);self.assertGreater(h.deposited_mol,0);before=h.deposited_mol;z=h.dipper;h.step(1.);self.assertEqual(h.dipper,z);self.assertEqual(h.deposited_mol,before);self.assertEqual(s.poll(op),r);self.ledger(h)
|
| 79 |
+
def test_10_blank_correction_uses_input_not_hidden_true_leak(self):
|
| 80 |
+
h=deposition_ready();m=dict(h.method,blank_leak_area_rate_m2_s=1e-6);call(h,'method.configure',**m);call(h,'acquisition.start');r=finish(h);s=r['strokes'][0];expected=s['transfer_ratio']-1e-6*(s['end_time_s']-s['start_time_s'])/s['swept_area_m2'];self.assertAlmostEqual(s['blank_corrected_transfer_ratio'],expected);self.assertEqual(h.leaked_mol,0)
|
| 81 |
+
def test_11_first_favorable_wetting_direction(self):
|
| 82 |
+
h=setup(substrate=True);call(h,'dipper.move',position_m=.119,speed_m_s=.0018);h.step(66.2);self.assertEqual(h.deposited_mol,0)
|
| 83 |
+
call(h,'dipper.move',position_m=.063,speed_m_s=.0018);h.step(31.2);self.assertGreater(h.deposited_mol,0);first=h.deposited_mol;call(h,'dipper.move',position_m=.119,speed_m_s=.0018);h.step(31.2);call(h,'dipper.move',position_m=.063,speed_m_s=.0018);h.step(31.2);self.assertEqual(h.deposited_mol,first);self.ledger(h)
|
| 84 |
+
def test_12_leakage_stiff_finite_domain_failure_preserved(self):
|
| 85 |
+
h=setup(plant={'leak_rate_s':.001});before=h.surface_mol;h.step(10);self.assertAlmostEqual(h.surface_mol,before*math.exp(-.01),places=18);self.assertGreater(h.leaked_mol,0);self.ledger(h)
|
| 86 |
+
h=setup(plant={'leak_rate_s':100.});self.assertGreater(h.leaked_mol,0);self.assertGreaterEqual(h.surface_mol,0);self.rejected(h,'acquisition.start','EOS_AREA_RANGE');self.ledger(h)
|
| 87 |
+
def test_13_true_geometry_speeds_positions_and_no_teleport(self):
|
| 88 |
+
h=setup(substrate=True);start=h.read();call(h,'barrier.move',area_m2=.020,speed_m_s=.0045);self.assertEqual(h.area,rt.AREA_MAX);h.step(.1);self.assertAlmostEqual(h.read()['barrier.inward_m'],.00045);self.assertAlmostEqual(h.area,rt.AREA_MAX-.0000675)
|
| 89 |
+
h.step(20.);call(h,'dipper.move',position_m=.119,speed_m_s=.0018);self.assertEqual(h.dipper,0);h.step(.1);self.assertAlmostEqual(h.dipper,.00018);self.assertEqual(start['clock.time_s'],4.);self.ledger(h)
|
| 90 |
+
def test_14_hardware_extremes_and_negative_gamma_atomic(self):
|
| 91 |
+
h=setup()
|
| 92 |
+
for k,a in [('barrier.move',{'area_m2':rt.AREA_MIN-1e-9,'speed_m_s':.0045}),('barrier.move',{'area_m2':.02,'speed_m_s':.0045001}),('dipper.move',{'position_m':.125001,'speed_m_s':.0018}),('pressure.control',{'enabled':True,'target_n_m':.3,'speed_m_s':.0045})]:self.rejected(h,k,**a)
|
| 93 |
+
self.rejected(h,'plant.configure','INITIALIZATION_ONLY',**rt.PLANT_EXAMPLE)
|
| 94 |
+
def test_15_host_time_partition_and_two_instances(self):
|
| 95 |
+
a=setup(name='same');b=setup(name='same');a.invoke('acquisition.start');b.invoke('acquisition.start');a.step(5.)
|
| 96 |
+
for _ in range(50):b.step(.1)
|
| 97 |
+
self.assertEqual(a.read(),b.read());self.assertEqual(a.rows,b.rows);before=copy.deepcopy(b.__dict__);a.step(1.);self.assertEqual(before,b.__dict__);before=copy.deepcopy(a.__dict__);a.step(0.);self.assertEqual(before,a.__dict__)
|
| 98 |
+
def test_16_queries_are_pure_no_owner_stealing(self):
|
| 99 |
+
h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start')['operation_id'];before=copy.deepcopy(h.__dict__);h.read();h.describe();s.read(instance_id=h.instance_id);h.invoke('ledger.read');h.invoke('acquisition.result');call(h,'reference.query',reference_id=rt.SAMPLE_EXAMPLE['reference_id']);self.assertEqual(before,h.__dict__);q=s.invoke(instance_id=h.instance_id,capability_id='acquisition.result',arguments={},request_id='query');self.assertIsNone(q['operation_id']);self.assertEqual(h._owners[op],'agent')
|
| 100 |
+
def test_17_truth_permissions_and_no_load_recovery_leak(self):
|
| 101 |
+
h=setup();s=h.session();meta=s.describe(instance_id=h.instance_id);self.assertFalse(any(k.startswith('truth.') for k in meta['state_slots']))
|
| 102 |
+
for k,a in [('solution.load',rt.SAMPLE_EXAMPLE),('solution.remove',{}),('substrate.remove',{}),('subphase.remove',{}),('film.clean',{}),('ledger.read',{}),('sim.step',{'dt_s':1.})]:
|
| 103 |
+
before=copy.deepcopy(h.__dict__);r=s.invoke(instance_id=h.instance_id,capability_id=k,arguments=a,request_id=k);self.assertEqual(r['error']['code'],'ACCESS_DENIED');self.assertEqual(before,h.__dict__)
|
| 104 |
+
with self.assertRaises(rt.ActionRejected):s.read(instance_id=h.instance_id,state_ids=['truth.deposited_mol'])
|
| 105 |
+
def test_18_owner_result_poll_cancel_and_idempotency(self):
|
| 106 |
+
h=setup();h.register_principal('other');s=h.session();other=h.session('other');args=dict(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start');r=s.invoke(**args);self.assertEqual(r,s.invoke(**args));op=r['operation_id']
|
| 107 |
+
for k in ['acquisition.result','acquisition.stop']:self.assertEqual(other.invoke(instance_id=h.instance_id,capability_id=k,arguments={},request_id=k)['error']['code'],'ACCESS_DENIED')
|
| 108 |
+
with self.assertRaises(rt.ActionRejected):other.poll(op)
|
| 109 |
+
with self.assertRaises(rt.ActionRejected):other.cancel(op,'bad')
|
| 110 |
+
self.assertEqual(s.cancel(op,'stop')['status'],'succeeded');self.assertEqual(s.poll(op)['status'],'cancelled')
|
| 111 |
+
self.assertEqual(s.invoke(instance_id=h.instance_id,capability_id='power.set',arguments={'enabled':False},request_id='start')['error']['code'],'REQUEST_CONFLICT')
|
| 112 |
+
def test_19_frozen_result_after_method_and_source_changes(self):
|
| 113 |
+
h=setup();s=h.session();op=s.invoke(instance_id=h.instance_id,capability_id='acquisition.start',arguments={},request_id='start')['operation_id'];finish(h);saved=s.poll(op);cleanup(h);call(h,'subphase.load',**rt.SUBPHASE_EXAMPLE);self.assertEqual(saved,s.poll(op));self.assertEqual(saved['result'],h.invoke('acquisition.result'));saved['result']['rows'][0]['area_m2']=999;self.assertNotEqual(saved,s.poll(op))
|
| 114 |
+
def test_20_conditions_and_runtime_reference_only_guards(self):
|
| 115 |
+
h=setup();cleanup(h);call(h,'subphase.load',**dict(rt.SUBPHASE_EXAMPLE,ph=5.));self.rejected(h,'solution.load','REFERENCE_CONDITIONS',**dict(rt.SAMPLE_EXAMPLE,accept_condition_transfer=False));lib=rt.library();ref=next(k for k,v in lib['substances'].items() if not v.get('runtime_usable'));self.rejected(h,'solution.load','INVALID_REFERENCE',**dict(rt.SAMPLE_EXAMPLE,reference_id=ref))
|
| 116 |
+
lib=copy.deepcopy(lib);lib['substances'][rt.SAMPLE_EXAMPLE['reference_id']]['conditions']['temperature_k']=None
|
| 117 |
+
with mock.patch.object(rt,'library',return_value=lib):self.rejected(h,'solution.load','UNKNOWN_REFERENCE_CONDITIONS',**dict(rt.SAMPLE_EXAMPLE,accept_unknown_conditions=False))
|
| 118 |
+
def test_21_small_stock_excess_rejected_without_tolerance(self):
|
| 119 |
+
h=setup();self.rejected(h,'film.spread','INSUFFICIENT_SOLUTION',volume_m3=h.stock_volume+1e-20);self.ledger(h)
|
| 120 |
+
def test_22_calibration_probe_and_clean_tare_guard(self):
|
| 121 |
+
h=setup();call(h,'balance.calibrate',force_gain_correction=1.2,force_zero_n=1e-5,assumed_contact_cosine=.8);self.assertFalse(h.tared);self.assertIsNone(h._observed());call(h,'probe.move',distance_m=.04);self.assertIsNone(h._observed());self.rejected(h,'balance.tare','CLEAN_BASELINE_REQUIRED');call(h,'film.clean');call(h,'probe.move',distance_m=0.);call(h,'balance.tare');self.assertEqual(h._observed(),0);self.ledger(h)
|
| 122 |
+
def test_23_expansion_requires_explicit_branch_reuse(self):
|
| 123 |
+
h=setup(sample={'accept_quasistatic_branch_reuse':False});compress(h);self.rejected(h,'barrier.move','BRANCH_REUSE_NOT_ACCEPTED',area_m2=.02,speed_m_s=.0045);m=dict(rt.METHOD_EXAMPLE,mode='expansion',target_area_m2=.02);call(h,'method.configure',**m);self.rejected(h,'acquisition.start','BRANCH_REUSE_NOT_ACCEPTED')
|
| 124 |
+
def test_24_external_modulus_input_and_apparent_label(self):
|
| 125 |
+
h=setup();a=dict(area_m2=[.01,.02,.03],surface_pressure_n_m=[.03,.02,.01],constant_molecule_number=True);r=call(h,'analysis.isotherm',**a);self.assertTrue(np.allclose(r['modulus_n_m'],[.01,.02,.03]));a['constant_molecule_number']=False;self.assertIn('apparent',call(h,'analysis.isotherm',**a)['interpretation']);a['area_m2']=[.01,.01,.03];self.rejected(h,'analysis.isotherm','INVALID_ARRAYS',**a)
|
| 126 |
+
def test_25_invalid_input_time_rejection_atomic(self):
|
| 127 |
+
h=setup()
|
| 128 |
+
for value in [True,float('nan'),float('inf'),-1.]:
|
| 129 |
+
self.rejected(h,'sim.step',dt_s=value);before=copy.deepcopy(h.__dict__)
|
| 130 |
+
with self.assertRaises(rt.ActionRejected):h.step(value)
|
| 131 |
+
self.assertEqual(before,h.__dict__)
|
| 132 |
+
call(h,'acquisition.start');self.rejected(h,'method.configure','BUSY',**rt.METHOD_EXAMPLE);self.rejected(h,'power.set','BUSY',enabled=False)
|
| 133 |
+
def test_26_timeout_preserves_partial_and_no_overrun(self):
|
| 134 |
+
h=setup();call(h,'method.configure',**dict(rt.METHOD_EXAMPLE,duration_s=.5));call(h,'acquisition.start');r=finish(h);self.assertEqual(r['phase'],'failed');self.assertEqual(r['error_code'],'METHOD_TIMEOUT');self.assertAlmostEqual(r['elapsed_s'],.5);self.assertEqual(r['rows'][-1]['time_s'],h.time_s);self.assertLess(h.area,rt.AREA_MAX);self.assertGreater(h.area,.016);saved=copy.deepcopy(r);h.step(1.);self.assertEqual(h.invoke('acquisition.result'),saved);self.ledger(h)
|
| 135 |
+
def test_27_pressure_control_is_observed_and_stops(self):
|
| 136 |
+
h=setup();call(h,'pressure.control',enabled=True,target_n_m=.02,speed_m_s=.0045);self.assertEqual(h.area,rt.AREA_MAX);h.step(60.);self.assertLess(abs(h._observed()-.02),.0005);call(h,'pressure.control',enabled=False,target_n_m=.02,speed_m_s=.0045);a=h.area;h.step(1.);self.assertEqual(h.area,a);self.ledger(h)
|
| 137 |
+
def test_28_geometry_access_and_hot_state_guards(self):
|
| 138 |
+
h=setup(substrate=True);self.rejected(h,'substrate.remove','SUBSTRATE_ACCESS');call(h,'dipper.move',position_m=.01,speed_m_s=.0018);self.rejected(h,'clamp.set','MOTION_ACTIVE',locked=False);h.step(6.);self.rejected(h,'clamp.set','SUBSTRATE_ACCESS',locked=False);self.rejected(h,'subphase.remove','SUBPHASE_ACCESS')
|
| 139 |
+
hot=rt.BiolinMediumlRuntime();call(hot,'plant.configure',**dict(rt.PLANT_EXAMPLE,temperature_k=323.15));self.rejected(hot,'subphase.load','HOT_SUBPHASE',**rt.SUBPHASE_EXAMPLE)
|
| 140 |
+
def test_29_complete_cleanup_solute_solvent_subphase_recovered(self):
|
| 141 |
+
h=deposition_ready();call(h,'acquisition.start');finish(h);cleanup(h);r=self.ledger(h);self.assertEqual(r['solute_present_kg'],0);self.assertAlmostEqual(r['solute_loaded_mol'],r['solute_recovered_mol'],places=18);self.assertEqual(r['subphase_present_kg'],0);self.assertAlmostEqual(r['subphase_loaded_kg'],r['subphase_recovered_kg']);self.assertAlmostEqual(r['solvent_loaded_m3'],r['solvent_recovered_m3']+r['solvent_evaporated_m3'],places=18)
|
| 142 |
+
def test_30_LCD_blank_and_real_units(self):
|
| 143 |
+
h=setup();d=h.read();self.assertEqual(d['panel.area_text'],'273.0');self.assertEqual(d['panel.pressure_text'],f'{d["pressure.indicated_n_m"]*1000:.1f}');call(h,'power.set',enabled=False);self.assertEqual(h.read()['panel.area_text'],'');self.assertEqual(h.read()['panel.pressure_text'],'')
|
| 144 |
+
def test_31_unsupported_and_actual_methods_schemas(self):
|
| 145 |
+
h=setup()
|
| 146 |
+
for k in rt.UNSUPPORTED:self.rejected(h,k,'UNSUPPORTED')
|
| 147 |
+
meta=h.describe();self.assertEqual(meta['capabilities']['film.collapse_prediction']['availability'],'unsupported');self.assertEqual(rt.PLANT['properties']['controller_gain_m3_n_s']['x-unit'],'m^3/(N*s)')
|
| 148 |
+
def test_32_wet_probe_includes_liquid_rise(self):
|
| 149 |
+
h=setup(preimmerse=True);h.probe_lift=h.plant['plate_immersion_m']+h._liquid_rise()/2
|
| 150 |
+
self.assertIsNotNone(h._observed());h.probe_lift=h.plant['plate_immersion_m']+h._liquid_rise();self.assertIsNone(h._observed())
|
| 151 |
+
def test_33_balance_physical_load_limit_atomic(self):
|
| 152 |
+
h=rt.BiolinMediumlRuntime();call(h,'plant.configure',**dict(rt.PLANT_EXAMPLE,plate_mass_kg=.001));self.rejected(h,'subphase.load','BALANCE_OVERLOAD',**rt.SUBPHASE_EXAMPLE)
|
| 153 |
+
def test_34_actual_effects_cover_changed_states(self):
|
| 154 |
+
meta=rt.export_biolin_mediuml_contract_metadata();original=rt.BiolinMediumlRuntime.invoke
|
| 155 |
+
def audited(h,k,**a):
|
| 156 |
+
before=h.read();r=original(h,k,**a);after=h.read();changed={x for x in before if before[x]!=after[x]};declared={e['state_id'] for e in meta['capabilities'][k]['state_effects'] if e['timing']=='immediate'};self.assertFalse(changed-declared,(k,changed-declared));return r
|
| 157 |
+
with mock.patch.object(rt.BiolinMediumlRuntime,'invoke',audited):
|
| 158 |
+
h=setup(substrate=True);call(h,'sim.step',dt_s=.1);compress(h);call(h,'balance.calibrate',**rt.CAPS['balance.calibrate']['example_arguments']);cleanup(h)
|
| 159 |
+
def test_35_agent_result_does_not_serialize_private_parameters(self):
|
| 160 |
+
h=setup(plant={'plate_contact_cosine':.73456789,'force_gain':1.23456789});r=compress(h);text=json.dumps(r)
|
| 161 |
+
for forbidden in ['concentration_mol_m3','force_gain','plate_contact_cosine','leak_rate_s','transfer_efficiency',str(.73456789),str(1.23456789)]:self.assertNotIn(forbidden,text)
|
| 162 |
+
self.assertNotIn('truth.',json.dumps(h.session().read(instance_id=h.instance_id)))
|
| 163 |
+
def test_36_sampling_aligned_to_start_and_terminal_derivative(self):
|
| 164 |
+
h=setup();h.step(.1);call(h,'method.configure',**dict(rt.METHOD_EXAMPLE,sample_interval_s=.3));call(h,'acquisition.start');r=finish(h);times=[p['time_s'] for p in r['rows']];self.assertTrue(np.allclose(np.diff(times)[:-1],.3,atol=1e-12));self.assertIsNotNone(r['rows'][-1]['apparent_modulus_n_m'])
|
| 165 |
+
def test_37_actual_api_and_state_schemas(self):
|
| 166 |
+
spec=importlib.util.spec_from_file_location('mediuml_asset_tool',ROOT/'skills/chemistry-lab-assets/scripts/asset_tool.py');tool=importlib.util.module_from_spec(spec);spec.loader.exec_module(tool);meta=rt.export_biolin_mediuml_contract_metadata();h=setup();call(h,'acquisition.start');call(h,'sim.step',dt_s=.7);call(h,'acquisition.stop');call(h,'acquisition.result');self.ledger(h)
|
| 167 |
+
for k,c in rt.CAPS.items():
|
| 168 |
+
if k in rt.UNSUPPORTED:continue
|
| 169 |
+
cases=[v for v in OBSERVED if v[0]==k];self.assertTrue(cases,k)
|
| 170 |
+
for _,a,r in cases:self.assertEqual(tool.validate_value(a,meta['capabilities'][k]['input_schema']),[],k);self.assertEqual(tool.validate_value(r,meta['capabilities'][k]['output_schema']),[],k)
|
| 171 |
+
for state in [rt.BiolinMediumlRuntime().read(),h.read(),deposition_ready().read()]:
|
| 172 |
+
self.assertEqual(set(state),set(meta['state_slots']))
|
| 173 |
+
for k,v in state.items():self.assertEqual(tool.validate_value(v,meta['state_slots'][k]['value_schema']),[],k)
|
| 174 |
+
|
| 175 |
+
def test_38_partial_layers_are_normalized_by_whole_substrate(self):
|
| 176 |
+
h=deposition_ready();call(h,'acquisition.start');h.step(3.);call(h,'acquisition.stop');r=call(h,'acquisition.result');s=r['strokes'][0];full=rt.SUBSTRATE_EXAMPLE['width_m']*rt.SUBSTRATE_EXAMPLE['height_m']*rt.SUBSTRATE_EXAMPLE['faces'];self.assertAlmostEqual(r['equivalent_layers_from_area'],s['transfer_ratio']*s['swept_area_m2']/full);self.assertGreater(r['equivalent_layers_from_area'],0);self.assertLess(r['equivalent_layers_from_area'],.2);self.assertEqual(r['completed_strokes'],0)
|
| 177 |
+
|
| 178 |
+
if __name__=='__main__':unittest.main()
|