diff --git a/assets/icon-sources.json b/assets/icon-sources.json index a09d963a..e0827369 100644 --- a/assets/icon-sources.json +++ b/assets/icon-sources.json @@ -2575,5 +2575,12 @@ "mimeType": "image/png", "sha256": "4da1173e29c7e0d7428f50c00212d5093a1fb3c2fe90ae078ae33e4b7bc85505", "transformation": "SVG rendered to 512x512 PNG with transparent background; no baked corner radius" + }, + { + "name": "rfauto", + "icon": "rfauto/icon.png", + "source": "original artwork for the rfauto plugin, generated by devtests/make_rfauto_icon.py from a geometric description of an |S11| resonance dip on a VNA graticule (no third-party material); released with the plugin under GPL-3.0-only", + "mimeType": "image/png", + "sha256": "a8095016915887061ae5191c98a5396f8b9d09fd422868f6c4ffed7436351485" } ] diff --git a/assets/rfauto/icon.png b/assets/rfauto/icon.png new file mode 100644 index 00000000..2902c6f9 Binary files /dev/null and b/assets/rfauto/icon.png differ diff --git a/external_plugins/rfauto/.mcp.json b/external_plugins/rfauto/.mcp.json new file mode 100644 index 00000000..970b378e --- /dev/null +++ b/external_plugins/rfauto/.mcp.json @@ -0,0 +1,17 @@ +{ + "mcpServers": { + "rfauto": { + "type": "stdio", + "command": "python", + "args": ["${ZCODE_PLUGIN_ROOT}/scripts/serve_mcp.py"], + "cwd": "${ZCODE_PROJECT_DIR}", + "env": { + "RFAUTO_PYTHON": "${user_config.pythonPath}", + "RFAUTO_SRC": "${user_config.rfautoSrc}", + "RFAUTO_PLUGIN_ROOT": "${ZCODE_PLUGIN_ROOT}", + "RFAUTO_PLUGIN_DATA": "${ZCODE_PLUGIN_DATA}" + }, + "timeoutMs": 120000 + } + } +} diff --git a/external_plugins/rfauto/.zcode-plugin/plugin.json b/external_plugins/rfauto/.zcode-plugin/plugin.json new file mode 100644 index 00000000..0d0acadd --- /dev/null +++ b/external_plugins/rfauto/.zcode-plugin/plugin.json @@ -0,0 +1,47 @@ +{ + "name": "rfauto", + "displayName": "RFAuto", + "version": "0.1.0", + "description": "把 RFAuto 射频/微波 EDA 框架接入 ZCode 会话:提供 208 个 MCP 工具(器件综合、仿真作业、质量门、结果判读),另附一个判读裁判 agent 和 7 张器件技能卡。所有物理数字都出自 RFAuto 确定性内核与求解器,不由模型生成。", + "description_i18n": { + "en": "Drive the RFAuto RF/microwave EDA framework from any ZCode session: 208 deterministic MCP tools covering device synthesis, simulation jobs, quality gates, and result verdicts, plus a judge agent and device skill cards. Every physical number comes from the RFAuto deterministic kernel and solvers, never from the model.", + "zh-CN": "把 RFAuto 射频/微波 EDA 框架接入 ZCode 会话:提供 208 个 MCP 工具(器件综合、仿真作业、质量门、结果判读),另附一个判读裁判 agent 和 7 张器件技能卡。所有物理数字都出自 RFAuto 确定性内核与求解器,不由模型生成。" + }, + "author": { + "name": "geer1895", + "url": "https://github.com/geer1895" + }, + "homepage": "https://github.com/geer1895/rfauto", + "repository": "https://github.com/geer1895/rfauto", + "license": "GPL-3.0-only", + "keywords": [ + "rf", + "microwave", + "eda", + "hfss", + "openems", + "simulation", + "mcp", + "s-parameters", + "touchstone", + "RFAuto" + ], + "commands": "commands", + "skills": "skills", + "agents": "agents", + "mcpServers": ".mcp.json", + "userConfig": { + "pythonPath": { + "title": "rfauto Python 解释器", + "description": "装有 rfauto[mcp] 的 Python 解释器,需 3.10–3.12。留空则使用运行本启动器的解释器。安装命令:pip install \"rfauto[mcp] @ https://github.com/geer1895/rfauto/releases/download/v0.14.0/rfauto-0.14.0-source.zip#sha256=47b2a7db4a6345d1d92cd038d275d75be3edbd8f40ecd5db327a79c05b8ebe6d\"", + "type": "file", + "default": "" + }, + "rfautoSrc": { + "title": "rfauto 源码目录(可选)", + "description": "指向 rfauto 检出目录下的 src/。设置后将其前置到 PYTHONPATH,以这份源码为准,不用已安装的 rfauto 包。", + "type": "directory", + "default": "" + } + } +} diff --git a/external_plugins/rfauto/LICENSE b/external_plugins/rfauto/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/external_plugins/rfauto/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/external_plugins/rfauto/README.md b/external_plugins/rfauto/README.md new file mode 100644 index 00000000..ac9a09e5 --- /dev/null +++ b/external_plugins/rfauto/README.md @@ -0,0 +1,94 @@ +# RFAuto · ZCode plugin + +[简体中文](README_CN.md) + +Drives the [RFAuto/rfauto](https://github.com/geer1895/rfauto) RF/microwave EDA +framework from a ZCode session: closed-form synthesis, multi-engine simulation +jobs, quality gates and result verdicts. Every physical number (frequency, loss, +geometry) comes from the rfauto deterministic kernel and solvers. The language +model does not generate them. + +- Author: [geer1895](https://github.com/geer1895) +- License: GPL-3.0-only + +## Components + +| Component | Purpose | +|---|---| +| MCP server (`rfauto`) | The rfauto MCP server with 208 tools: device synthesis, simulation jobs, metric readout, quality gates, reports. It also exposes the toolset directory and the 7 device cards as resources | +| `rfauto-mcp-navigator` skill | Tool navigation. Lists 18 commonly used tools up front; the other tools are grouped into 14 toolsets in a reference file. Use at session start or when unsure which tool to call | +| `rf-verdict` skill | Judges simulation results from any origin (human, script or agent) and returns TRUSTED / SUSPECT / STALE / UNVERIFIABLE with per-gate evidence. Use when deciding whether a result can be trusted | +| `rf-judge` agent | Read-only verdict sub-agent with a fixed whitelist of quality-gate tools (runs_verify, em_doctor_check, em_metrics_from_run, ...). Dispatch it for an independent verdict | +| `/rf-check` command | Runs the verdict workflow on one run directory or Touchstone file | +| 7 device skill cards | Wilkinson power divider, branchline coupler, rectangular patch antenna, PIFA, CPW, microstrip synthesis, Verilog-A authoring (from the rfauto repo). Use when a request names one of these devices | + +## Usage + +For a person: + +1. In a session, type `/rf-check ` to get a verdict report. +2. Ask: "run the rfauto doctor tool". A successful call returns rfauto's environment envelope. +3. Ask for a design, for example "Design a 2.4 GHz Wilkinson power divider with rfauto". The matching device card loads automatically. + +For an agent: + +- Skills load on their own when a request matches their description. The trigger terms are listed in each `SKILL.md`. +- Ask it to "use rf-judge" to get an independent verdict on a run. +- Tools are named `mcp__plugin_rfauto_rfauto__`. `tools/list` returns all 208. + +## Requirements + +- A ZCode client with plugin and MCP support. +- Python 3.10–3.12 with rfauto v0.14.0 installed, once. The command below installs the public release source archive v0.14.0 (commit `3d7b15d`), with its SHA256 checked, so unreleased local changes are not included: + + ```bash + pip install "rfauto[mcp] @ https://github.com/geer1895/rfauto/releases/download/v0.14.0/rfauto-0.14.0-source.zip#sha256=47b2a7db4a6345d1d92cd038d275d75be3edbd8f40ecd5db327a79c05b8ebe6d" + ``` + + From a clone of the rfauto repository, the upstream route is `pip install -e ".[mcp]"` in the repository root. Alternatively, install the tag directly with `pip install "rfauto[mcp] @ git+https://github.com/geer1895/rfauto.git@v0.14.0"` when git can reach github.com (not verified on the maintainer machine). +- The launcher is started by `python` from `PATH` and needs only the standard library. Make sure that `python` is a Python 3 interpreter. +- HFSS needs Ansys AEDT 2025 R1 and its own license. ADS is a commercial Keysight tool. Neither is bundled. +- openEMS is open source (GPL) and not bundled. Build it from the upstream sources (`docs/openems_build_guide.md`). The built-in `fake` channel needs no license and no external engine. It is a closed-form model, so use it to check the pipeline, not for physics. + +## Setup + +1. Install the plugin from a marketplace or a local directory source. +2. Point the plugin at an interpreter, either way: + - In the plugin settings, fill in **rfauto Python 解释器** (`pythonPath`) with a Python that has rfauto installed. Leave it empty to use the launcher's own interpreter. Optionally set **rfauto 源码目录** (`rfautoSrc`) to a checkout's `src/` directory to pin an exact source tree. + - Or write `launcher.json` into the plugin data directory: `{"pythonPath": "...", "rfautoSrc": "..."}`. The exact path is printed in the `rf_env_doctor` report. If both are set, userConfig wins. +3. Restart the session and ask for "the rfauto doctor tool". You should get rfauto's environment envelope. +4. If the MCP server cannot start, the plugin falls back to a diagnostic server that exposes only `rf_env_doctor`. Call it and follow the report, which gives the exact install command and the setting to change. + +## Permissions, network and side effects + +- **Plugin network**: none. The plugin makes no network requests itself. The only online step is the pip install above. +- **MCP server network**: rfauto's MCP tools open network connections only in these cases, and each needs your own configuration: + - remote-machine tools (`remote_probe_machine`, `remote_machine_status`) contact machines you registered (a TCP probe, or SSH through paramiko); + - campaigns whose stages are routed to remote machines (SFTP upload and download, SSH commands); + - HFSS runs that target a registered remote AEDT host; + - a TCP probe of a license server, when a license-server environment variable is set. + + Other network paths in rfauto (LLM chat, literature and model downloads, notification webhooks) exist only in its CLI, workbench or scripts. The MCP tools do not trigger them. +- **Telemetry**: none found in the upstream code. +- **Credentials**: the plugin neither reads nor stores credentials. SSH authentication for registered machines is handled by rfauto through paramiko, using your local SSH setup. +- **Dependencies**: the MCP server needs rfauto's `[mcp]` extra (fastmcp, mcp). Other runtime packages (numpy, scipy, scikit-rf, pydantic and so on) are installed by pip and are not distributed with the plugin. +- **File writes**: simulation runs write their artifacts (`runs/`, dataset and database files) into the current workspace, as rfauto normally does. Remote campaigns also copy files to and from the remote machines. The verdict components (`rf-verdict`, `rf-judge`, `/rf-check`) are read-only. +- **Command execution**: `scripts/serve_mcp.py` finds the configured interpreter and starts `python -m rfauto.mcp_server` as a child process, with stdio passed straight through. If that fails, it falls back to the diagnostic server. +- **Hooks**: none. + +## Third-party material: source and license + +- This plugin wraps the public capabilities of [geer1895/rfauto](https://github.com/geer1895/rfauto) (GPL-3.0-only). The 7 device skill cards (`skills/rfauto-*`, `skills/veriloga-authoring`) are copied from that repository's `skills/` directory. Their bodies and reference files are unchanged, each keeps its own `LICENSE.txt`, and only the frontmatter `description` and `compatibility` are translated into Chinese. The MCP server process is rfauto's own `rfauto.mcp_server`, unmodified. +- The plugin itself (navigator and verdict skills, agent, command, launcher script, icon) is distributed under GPL-3.0-only, the same as the upstream `LICENSE`. +- Some upstream documents, including `THIRD_PARTY_NOTICES.md`, describe rfauto as MIT. That contradicts the upstream `LICENSE` file and `pyproject.toml`, which both say GPL-3.0-only. This plugin follows the `LICENSE` file. +- The upstream third-party list is incomplete. The license of each installed dependency is in its package metadata. + +## Iron rule 7 + +Every skill and agent here enforces rfauto's core rule: the agent orchestrates, interprets and judges, and every physical number traces back to a tool call. A FAIL is reported as FAIL and is never massaged into a pass. + +## Known limitations + +- The public repository publishes v0.14.0 as a GitHub Release (source zip) and does not document a PyPI release. The install command is pinned to the v0.14.0 release archive, with its SHA256 checked. When the plugin moves to a newer release, update the command in `.zcode-plugin/plugin.json` and `scripts/serve_mcp.py` together. +- The four verdict states (TRUSTED, SUSPECT, STALE, UNVERIFIABLE) are this plugin's own convention. rfauto has no definition with these names. +- In our test, the MCP server took about 30 seconds from launch to a completed handshake, because the rfauto import chain is heavy. Allow for that on the first call of a session. diff --git a/external_plugins/rfauto/README_CN.md b/external_plugins/rfauto/README_CN.md new file mode 100644 index 00000000..8152875e --- /dev/null +++ b/external_plugins/rfauto/README_CN.md @@ -0,0 +1,88 @@ +# RFAuto · ZCode 插件 + +在 ZCode 会话里驱动 [RFAuto/rfauto](https://github.com/geer1895/rfauto) 射频/微波 EDA 框架,做闭式综合、多引擎仿真作业、质量门和结果判读。所有物理数字(频率、损耗、几何尺寸)都来自 rfauto 确定性内核与求解器,不由大语言模型生成。 + +- 作者:[geer1895](https://github.com/geer1895) +- 许可证:GPL-3.0-only + +## 组件 + +| 组件 | 用途 | +|---|---| +| MCP 服务器(`rfauto`) | rfauto 的 208 个工具:器件综合、仿真作业、指标读取、质量门、报告。另以资源形式提供工具集目录和 7 张器件卡 | +| `rfauto-mcp-navigator` 技能 | 选工具用。先列出 18 个常用工具,其余工具按 14 个工具集归类,放在参考文件里。会话开始时,或不确定该调哪个工具时用 | +| `rf-verdict` 技能 | 判读任意来源(人工、脚本、其他 agent)的仿真结果,给出 TRUSTED / SUSPECT / STALE / UNVERIFIABLE 四态判定,每道门附证据。要判断某个结果能不能采信时用 | +| `rf-judge` 子代理 | 只读判读裁判,只能调用固定的质量门工具(runs_verify、em_doctor_check、em_metrics_from_run 等)。需要一个独立的判定结论时派发 | +| `/rf-check` 命令 | 对一个 run 目录或一个 Touchstone 文件执行判读流程 | +| 7 张器件技能卡 | Wilkinson 功分器、branchline 耦合器、矩形贴片天线、PIFA、CPW、微带线综合、Verilog-A 编写,来自 rfauto 仓库。遇到这些器件或 Verilog-A 模型的任务时用 | + +## 使用 + +给人: + +1. 在会话里输入 `/rf-check `,得到判定报告。 +2. 说“用 rfauto doctor 工具体检”。调用成功会返回 rfauto 的环境信封。 +3. 提出设计需求,例如“用 rfauto 设计一个 2.4 GHz 的 Wilkinson 功分器”。匹配的器件技能卡会自动加载。 + +给 Agent: + +- 技能按描述自动加载,触发词写在各自的 `SKILL.md` 里。 +- 要独立判定一个 run 时,说“派 rf-judge 判读某某 run”。 +- 工具名形如 `mcp__plugin_rfauto_rfauto__`,`tools/list` 返回全部 208 个。 + +## 环境要求 + +- 支持插件与 MCP 的 ZCode 客户端。 +- Python 3.10–3.12,并装好 rfauto v0.14.0(只需一次)。下面的命令安装公开仓 v0.14.0 的源码包(提交 `3d7b15d`,并校验 SHA256),不包含本地尚未发布的开发改动: + + ```bash + pip install "rfauto[mcp] @ https://github.com/geer1895/rfauto/releases/download/v0.14.0/rfauto-0.14.0-source.zip#sha256=47b2a7db4a6345d1d92cd038d275d75be3edbd8f40ecd5db327a79c05b8ebe6d" + ``` + + 从 rfauto 仓库的克隆安装时,上游文档的做法是在仓根执行 `pip install -e ".[mcp]"`。也可以直接用标签安装:`pip install "rfauto[mcp] @ git+https://github.com/geer1895/rfauto.git@v0.14.0"`(需要 git 且能连通 github.com,本机未验证)。 +- 启动器由 `PATH` 中的 `python` 启动,只用标准库。请确认该 `python` 是 Python 3。 +- HFSS 需要 Ansys AEDT 2025 R1 及其许可证;ADS 是 Keysight 的商用软件。两者都不随插件分发。 +- openEMS 是开源(GPL)软件,不随插件分发,需按上游文档 `docs/openems_build_guide.md` 从源码编译。内置的 `fake` 通道不需要许可证和外部引擎,可跑通全流程,但它是闭式解析模型,只用来检查流程,不用于物理结论。 + +## 安装与配置 + +1. 从插件市场或本地目录安装本插件。 +2. 指定解释器,两种方式任选其一: + - 在插件设置里填写 **rfauto Python 解释器**(`pythonPath`),即装有 rfauto 的 Python 路径;留空则使用启动器自身的解释器。如要锁定某份源码,再填 **rfauto 源码目录**(`rfautoSrc`),指向检出目录下的 `src/`。 + - 或在插件数据目录下写一个 `launcher.json`:`{"pythonPath": "...", "rfautoSrc": "..."}`,确切路径见 `rf_env_doctor` 的报告。两处同时设置时以 userConfig 为准。 +3. 重启会话,发一句“用 rfauto doctor 工具体检”。返回 rfauto 环境信封,说明配置生效。 +4. MCP 服务器起不来时,插件会降级为只提供 `rf_env_doctor` 的诊断服务器。调用它,按报告修复;报告里有确切的安装命令和需要配置的项。 + +## 权限、网络与副作用 + +- **插件网络**:插件本身不发起任何网络请求。唯一的联网步骤是上面的 pip 安装。 +- **MCP 服务器网络**:rfauto 的工具只在以下几种情况下建立网络连接,且都需要你自己配置: + - 远程主机工具(`remote_probe_machine`、`remote_machine_status`)访问你登记过的主机(TCP 探测,或经 paramiko 的 SSH); + - 分发到远程机器的 campaign 阶段(SFTP 上传下载、SSH 执行命令); + - 指向已登记远程 AEDT 主机的 HFSS 运行; + - 设置了许可证服务器环境变量时,对该服务器做 TCP 探测。 + + rfauto 的其他网络路径(大模型对话、文献和模型下载、通知 webhook)只出现在它的命令行、工作台或脚本中,MCP 工具不会触发。 +- **遥测**:上游代码中未发现遥测。 +- **凭据**:插件不读取也不保存凭据。登记远程主机的 SSH 认证由 rfauto 通过 paramiko 完成,使用你本机的 SSH 配置。 +- **依赖**:MCP 服务器依赖 rfauto 的 `[mcp]` 可选依赖(fastmcp、mcp)。numpy、scipy、scikit-rf、pydantic 等其他运行时包由 pip 安装,不随插件分发。 +- **文件写入**:仿真 run 的产物(`runs/`、数据集与数据库文件)按 rfauto 的正常行为写入当前工作区。远程 campaign 还会在本机与远程机器之间复制文件。判读三件套(`rf-verdict`、`rf-judge`、`/rf-check`)只读。 +- **命令执行**:启动器 `scripts/serve_mcp.py` 找到配置的解释器,以 `python -m rfauto.mcp_server` 启动子进程,stdio 直接透传。启动失败时降级为诊断服务器。 +- **Hook**:本插件不注册任何 hook。 + +## 第三方材料来源与许可证 + +- 本插件包装的是 [geer1895/rfauto](https://github.com/geer1895/rfauto)(GPL-3.0-only)的公开能力。随包分发的 7 张器件技能卡(`skills/rfauto-*`、`skills/veriloga-authoring`)复制自该仓库的 `skills/` 目录:正文与参考文件保持不变,各自保留 `LICENSE.txt`;仅 frontmatter 的 `description` 与 `compatibility` 译成了中文。MCP 服务器进程就是 rfauto 自带的 `rfauto.mcp_server`,本插件不改动它。 +- 插件本体(导航与判读技能、agent、命令、启动器脚本、图标)以 GPL-3.0-only 分发,与上游 `LICENSE` 一致。 +- 上游的部分文档(包括 `THIRD_PARTY_NOTICES.md`)把 rfauto 写成 MIT。这与上游的 `LICENSE` 文件和 `pyproject.toml`(均为 GPL-3.0-only)矛盾。本插件以 `LICENSE` 文件为准。 +- 上游的第三方清单并不完整,各依赖的许可证以安装包的元数据为准。 + +## 铁律 7 + +所有技能和 agent 都遵守 rfauto 的核心约定:agent 负责编排、解读和判定,每个物理数字都能追溯到某次工具调用。判定为 FAIL 就如实报 FAIL,不凑绿。 + +## 已知限制 + +- 公开仓以 GitHub Release 发布 v0.14.0(源码包),未记录 PyPI 发布。安装命令固定到 v0.14.0 的 Release 源码包(校验 SHA256);插件升级到新版本时,需同时修改 `.zcode-plugin/plugin.json` 与 `scripts/serve_mcp.py` 中的命令。 +- 四态判定(TRUSTED、SUSPECT、STALE、UNVERIFIABLE)是本插件的约定,rfauto 中没有同名定义。 +- 本机测试中,MCP 服务器从启动到握手完成约 30 秒(rfauto 的导入链较重)。会话里第一次调用时请留出这段时间。 diff --git a/external_plugins/rfauto/agents/rf-judge.md b/external_plugins/rfauto/agents/rf-judge.md new file mode 100644 index 00000000..5ad44523 --- /dev/null +++ b/external_plugins/rfauto/agents/rf-judge.md @@ -0,0 +1,33 @@ +--- +name: rf-judge +description: >- + 射频仿真结果判读裁判。派发本子代理,用只读质量门工具链(runs_verify、em_doctor_check、em_metrics_from_run、em_diff_runs、explain_run、diagnose、touchstone_info)对 rfauto run 或 Touchstone 结果做四态判定(TRUSTED/SUSPECT/STALE/UNVERIFIABLE),逐门附证据。适用于仿真完成后的核验、采信数字前的验证、run 对比和陈旧产物审计。物理数字全部来自工具返回。 +--- + +你是 rf-judge,rfauto 射频仿真结果的判读裁判。你独立完成判定,返回结构化结论,不向用户提问。输入不足时判 UNVERIFIABLE,并列明缺什么。 + +## 职责边界(不可越) + +- **只读**:只调用下列工具。不写文件,不发起仿真,不改动产物。 +- **工具白名单**(只读判读面,其他工具一律不用):`runs_verify`(新鲜度)、`em_doctor_check`(建模期体检)、`em_metrics_from_run`(指标提取)、`em_diff_runs`(双 run 对拍)、`em_sweep_plan`(扫描计划,只读面)、`explain_run`(失败的确定性解释)、`diagnose`(run 诊断)、`compare_runs`(跨 run 对比)、`touchstone_info`(裸 Touchstone 解析)、`anchors_list` / `anchors_inspect`(锚注册表)。 +- **铁律 7**:不产生任何物理数字。报告里每个数字都来自上述某次工具调用的返回,后面括注来源工具;工具没给的数字,写"工具未提供"。 + +## 判定协议(四态,固定口径) + +1. 以 `runs_verify` 起手:status 为 stale → 终判 **STALE**,逐条列出 issues;legacy → 证据降级,终判不得高于 SUSPECT;error(目录不存在)→ **UNVERIFIABLE**。 +2. 有模型清单时跑 `em_doctor_check`:已实装项任一 FAIL → 终判从 **SUSPECT** 起步,逐条引用 evidence。16 项中 6 项为占位,返回 SKIP,不计入判定。没有清单则记 skip,不硬凑。 +3. 用 `em_metrics_from_run` 读指标;给了两个 run 就跑 `em_diff_runs`。 +4. 有 FAIL → 用 `explain_run` / `diagnose` 的确定性规则归因,不用直觉替代。 +5. 所有能跑的门都 PASS 且 fresh → **TRUSTED**;fresh 但有 FAIL 或 WARN → **SUSPECT**。FAIL 就如实报哪道门、差多少。 + +## 返回格式(给主代理,固定) + +``` +VERDICT: +TARGET: +GATES: <逐行: 门名 | PASS/FAIL/WARN/skip | 工具原文证据摘录> +NUMBERS: <关键指标及来源工具,逐个括注> +NEXT: <1-3 条下一步建议> +``` + +主代理负责向用户转述,你只返回上述结构。工具调用失败(信封 ok=false)时重试一次。仍失败,就把这道门记为 UNVERIFIABLE,附上错误原文,不要悄悄跳过。 diff --git a/external_plugins/rfauto/commands/rf-check.md b/external_plugins/rfauto/commands/rf-check.md new file mode 100644 index 00000000..a8449823 --- /dev/null +++ b/external_plugins/rfauto/commands/rf-check.md @@ -0,0 +1,12 @@ +--- +description: 用 rfauto 门禁工具链判读一个 run/Touchstone 的可信度(四态判定) +argument-hint: "[run_id 或 run 目录或 Touchstone 文件路径]" +allowed-tools: mcp__plugin_rfauto_rfauto__runs_verify,mcp__plugin_rfauto_rfauto__em_doctor_check,mcp__plugin_rfauto_rfauto__em_metrics_from_run,mcp__plugin_rfauto_rfauto__em_diff_runs,mcp__plugin_rfauto_rfauto__touchstone_info,mcp__plugin_rfauto_rfauto__explain_run,mcp__plugin_rfauto_rfauto__diagnose,mcp__plugin_rfauto_rfauto__rf_env_doctor,Read,Glob +--- + +按 rf-verdict 技能的判读流程,对目标 `$ARGUMENTS` 做可信度判读: + +1. 目标为空时,列出当前工作区 `runs/` 下最近的 run 目录,请用户选一个。仍找不到 run 目录,就如实说明,并以 UNVERIFIABLE 结束。 +2. 依次执行 `runs_verify`(新鲜度)→ 有清单则 `em_doctor_check` → `em_metrics_from_run`(裸 Touchstone 用 `touchstone_info`)。有两个目标时加 `em_diff_runs`。 +3. 输出固定格式的判定报告:四态判定(TRUSTED/SUSPECT/STALE/UNVERIFIABLE)加门级证据表。每个物理数字都括注来源工具调用,不得产生工具没有返回的数字。 +4. 判定为 SUSPECT 或 STALE 时,给出 1–3 条下一步建议(对照 em_diff_runs、找 manifest、换引擎仲裁等)。服务器未能启动、只剩 `rf_env_doctor` 时,调用它输出环境报告。 diff --git a/external_plugins/rfauto/scripts/serve_mcp.py b/external_plugins/rfauto/scripts/serve_mcp.py new file mode 100644 index 00000000..d1c96f2d --- /dev/null +++ b/external_plugins/rfauto/scripts/serve_mcp.py @@ -0,0 +1,308 @@ +#!/usr/bin/env python3 +"""rfauto ZCode 插件 MCP 启动器(仅标准库)。 + +解释器解析顺序(前一步可用即采用;全部失败则进入诊断模式,不让宿主无声挂起): + +1. 配置了 RFAUTO_PYTHON:用该解释器派生 ``python -m rfauto.mcp_server``。 + RFAUTO_SRC 为目录时前置到子进程的 PYTHONPATH,使指定源码树优先于已安装的包。 + stdin/stdout 以原始文件句柄直接交给子进程,由它在信道上直接说 MCP,启动器不做任何加帧。 +2. 未配置:在本进程内导入 ``rfauto.mcp_server``(导入期间 stdout 重定向到 stderr, + 杂散的 print 不会污染 JSON-RPC 信道)。导入成功则交给其 ``main()`` 接管。 +3. 导入失败:运行最小诊断服务器,只暴露 ``rf_env_doctor`` 一个工具, + 报告缺什么、该运行哪条命令、该配哪项 userConfig。 + +配置值为空串或未解析的 ``${user_config.*}`` 字面量,一律视为未配置。诊断信息只写入 +stderr。 +""" + +from __future__ import annotations + +import json +import os +import shutil +import subprocess +import sys +from contextlib import redirect_stdout + +PLUGIN_ROOT = os.environ.get("RFAUTO_PLUGIN_ROOT", os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +SERVER_MODULE = "rfauto.mcp_server" +# 安装命令固定到公开仓 GitHub Release v0.14.0 的源码包(提交 3d7b15d,URL 内含 SHA256 摘要)。升级时同步修改本行、INSTALL_ALT 与 plugin.json 的 userConfig 说明。 +INSTALL_CMD = 'pip install "rfauto[mcp] @ https://github.com/geer1895/rfauto/releases/download/v0.14.0/rfauto-0.14.0-source.zip#sha256=47b2a7db4a6345d1d92cd038d275d75be3edbd8f40ecd5db327a79c05b8ebe6d"' +INSTALL_ALT = 'pip install "rfauto[mcp] @ git+https://github.com/geer1895/rfauto.git@v0.14.0"' # 需要 git 且能连通 github.com + + +def _cfg(name: str) -> str: + """读配置环境变量;空串或未解析的模板字面量按未配置处理。""" + v = os.environ.get(name, "").strip() + if not v or v.startswith("${"): + return "" + return v + + +def _load_cfg_file() -> dict: + """后备配置:``$RFAUTO_PLUGIN_DATA/launcher.json``,键 pythonPath/rfautoSrc。 + + 环境变量(userConfig)优先于本文件。 + """ + data_dir = os.environ.get("RFAUTO_PLUGIN_DATA", "").strip() + if not data_dir or data_dir.startswith("${"): + return {} + path = os.path.join(data_dir, "launcher.json") + if os.path.isfile(path): + try: + with open(path, encoding="utf-8") as f: + cfg = json.load(f) + if isinstance(cfg, dict): + cfg["_path"] = path + return cfg + except Exception as exc: # noqa: BLE001 - 报告异常,不崩会话 + print(f"[rfauto-plugin] 配置文件无效 {path}: {exc}", file=sys.stderr) + return {} + + +def _resolve_config() -> tuple[str, str, str]: + """返回 (python_path, rfauto_src, 来源说明)。""" + file_cfg = _load_cfg_file() + py = _cfg("RFAUTO_PYTHON") or str(file_cfg.get("pythonPath") or "").strip() + src = _cfg("RFAUTO_SRC") or str(file_cfg.get("rfautoSrc") or "").strip() + origin = "userConfig 环境变量" if _cfg("RFAUTO_PYTHON") else ( + f"配置文件 {file_cfg.get('_path')}" if file_cfg.get("pythonPath") else "未配置") + return py, src, origin + + +def _spawn_child(exe: str, src: str) -> int: + """以 ``exe -m rfauto.mcp_server`` 启动子进程,stdio 句柄直接传入,启动器不做转发。 + + 先净化子进程环境。宿主可能注入其自带解释器的 PYTHONHOME/PYTHONPATH(实测嵌入式 + 打包的 Python 会这样),版本不一致的 venv 子进程会因 SRE 模块不匹配而崩溃。 + 子进程只保留 PYTHONPATH=RFAUTO_SRC,PYTHONHOME 一律不传。 + """ + env = os.environ.copy() + env.pop("PYTHONHOME", None) + if src and os.path.isdir(src): + env["PYTHONPATH"] = src + else: + env.pop("PYTHONPATH", None) + env.setdefault("PYTHONUTF8", "1") + env.setdefault("PYTHONIOENCODING", "utf-8") + cmd = [exe, "-m", "rfauto.mcp_server"] + print(f"[rfauto-plugin] 启动:{' '.join(cmd)}", file=sys.stderr) + proc = subprocess.Popen( + cmd, + env=env, + stdin=sys.stdin.buffer, + stdout=sys.stdout.buffer, + stderr=sys.stderr, + ) + try: + return proc.wait() + except KeyboardInterrupt: + proc.terminate() + return 130 + + +# ─────────────────────────── 诊断兜底 ──────────────────────────── + +def _env_report() -> dict: + """收集服务器无法启动的原因所需的全部信息。""" + cfg_python_cfg = _cfg("RFAUTO_PYTHON") + cfg_src_cfg = _cfg("RFAUTO_SRC") + rep: dict = { + "launcher_python": sys.executable, + "launcher_python_version": sys.version.split()[0], + "rfauto_python_configured": cfg_python_cfg or "(未设置)", + "rfauto_src_configured": cfg_src_cfg or "(未设置)", + "checks": [], + } + file_cfg = _load_cfg_file() + data_env = os.environ.get("RFAUTO_PLUGIN_DATA", "").strip() + rep["config_file"] = file_cfg.get("_path") or ( + os.path.join(data_env, "launcher.json") + if data_env and not data_env.startswith("${") + else "(无插件数据目录)" + ) + cfg_exe, _cfg_src, cfg_origin = _resolve_config() + exe_ok = bool(cfg_exe) and (os.path.isfile(cfg_exe) or shutil.which(cfg_exe) is not None) + rep["checks"].append( + { + "name": "configured_interpreter", + "ok": exe_ok if cfg_exe else None, + "detail": ( + f"pythonPath(来自{cfg_origin})已找到" if exe_ok + else f"pythonPath(来自{cfg_origin})在本机不存在" if cfg_exe + else f"未配置解释器:请在插件设置中填写 pythonPath,或向 {rep['config_file']} " + '写入 {"pythonPath": "..."}' + ), + } + ) + try: + import rfauto # noqa: F401 + + version = getattr(rfauto, "__version__", None) + rep["checks"].append( + {"name": "rfauto_import", "ok": True, + "detail": f"rfauto {version or '(版本未知)'},位置 {os.path.dirname(rfauto.__file__)}"} + ) + except Exception as exc: # noqa: BLE001 + rep["checks"].append( + { + "name": "rfauto_import", + "ok": False, + "detail": f"rfauto 不可导入({exc})。先安装:{INSTALL_CMD};" + "然后把装好它的解释器填入插件 pythonPath," + "或把 rfautoSrc 指向某个检出目录的 src/。", + } + ) + try: + import fastmcp # noqa: F401 + + rep["checks"].append( + {"name": "fastmcp_import", "ok": True, + "detail": f"fastmcp {getattr(fastmcp, '__version__', '?')}"} + ) + except Exception as exc: # noqa: BLE001 + rep["checks"].append( + {"name": "fastmcp_import", "ok": False, + "detail": f"缺少 fastmcp({exc})。它随 [mcp] extra 一起安装:{INSTALL_CMD}"} + ) + rep["ok"] = all(c["ok"] is not False for c in rep["checks"]) + return rep + + +_DIAG_TOOL = { + "name": "rf_env_doctor", + "description": ( + "报告 rfauto MCP 服务器无法启动的原因:检查配置的解释器,以及 rfauto 与 fastmcp " + "能否导入,并给出确切的安装命令和需要配置的 userConfig 项。可随时调用,无副作用。" + ), + "inputSchema": {"type": "object", "properties": {}, "additionalProperties": False}, +} + +_DIAG_INSTRUCTIONS = ( + "rfauto MCP 服务器未能启动。请先安装 rfauto:\n" + f" {INSTALL_CMD}\n" + f" 或从 git 标签安装(需要 git 且能连通 github.com):{INSTALL_ALT}\n" + "然后二选一:(a) 若它装在运行本启动器的解释器里,userConfig.pythonPath 留空;" + "(b) 把 userConfig.pythonPath 指向任一装有 rfauto 的 Python 3.10–3.12 解释器。" + "可选:把 userConfig.rfautoSrc 指向 rfauto 检出目录的 src/,以锁定源码树。" + "完成后重启会话,MCP 服务器会重新拉起。" +) + + +def _diag_send(msg: dict) -> None: + sys.stdout.buffer.write((json.dumps(msg, ensure_ascii=False) + "\n").encode("utf-8")) + sys.stdout.buffer.flush() + + +def run_diagnostic_server(reason: str) -> int: + """行分隔 JSON-RPC 循环,仅暴露 rf_env_doctor。不抛异常。""" + print(f"[rfauto-plugin] 诊断模式:{reason}", file=sys.stderr) + for raw in sys.stdin.buffer: + line = raw.strip() + if not line: + continue + try: + req = json.loads(line.decode("utf-8")) + except Exception: + continue + method = req.get("method", "") + req_id = req.get("id") + if method == "initialize": + params = req.get("params") or {} + _diag_send( + { + "jsonrpc": "2.0", + "id": req_id, + "result": { + "protocolVersion": params.get("protocolVersion", "2024-11-05"), + "capabilities": {"tools": {}}, + "serverInfo": { + "name": "rfauto-plugin-bootstrap", + "version": "0.1.0", + }, + }, + } + ) + elif method == "tools/list": + _diag_send( + {"jsonrpc": "2.0", "id": req_id, "result": {"tools": [_DIAG_TOOL]}} + ) + elif method == "tools/call": + rep = _env_report() + lines = [ + "## rfauto 插件环境报告", + f"- 启动器 Python:{rep['launcher_python']}({rep['launcher_python_version']})", + f"- userConfig.pythonPath:{rep['rfauto_python_configured']}", + f"- userConfig.rfautoSrc:{rep['rfauto_src_configured']}", + f"- 后备配置文件:{rep['config_file']}", + "", + ] + for c in rep["checks"]: + mark = {True: "PASS", False: "FAIL", None: "SKIP"}[c["ok"]] + lines.append(f"- [{mark}] {c['name']}:{c['detail']}") + lines += ["", _DIAG_INSTRUCTIONS] + _diag_send( + { + "jsonrpc": "2.0", + "id": req_id, + "result": { + "content": [{"type": "text", "text": "\n".join(lines)}], + "isError": not rep["ok"], + }, + } + ) + elif method == "ping": + _diag_send({"jsonrpc": "2.0", "id": req_id, "result": {}}) + elif method.startswith("notifications/"): + pass + elif req_id is not None: + _diag_send( + {"jsonrpc": "2.0", "id": req_id, + "error": {"code": -32601, "message": "当前为诊断模式,不支持该方法"}} + ) + return 0 + + +def main() -> int: + cfg_python, cfg_src, cfg_origin = _resolve_config() + + if cfg_python: + exe = shutil.which(cfg_python) or cfg_python + if os.path.isfile(exe): + try: + return _spawn_child(exe, cfg_src) + except OSError as exc: + print(f"[rfauto-plugin] 派生失败:{exc}", file=sys.stderr) + return run_diagnostic_server(f"配置的解释器无法派生:{cfg_python}") + return run_diagnostic_server(f"配置的 pythonPath 不存在:{cfg_python}({cfg_origin})") + + mod = _import_rfauto_mcp(cfg_src) + if mod is not None: + try: + mod.main() # 进入 fastmcp 的 stdio 循环,此后 stdout 归它所有 + return 0 + except SystemExit as exc: # fastmcp 关停时可能抛 SystemExit + return int(exc.code or 0) + except KeyboardInterrupt: + return 130 + return run_diagnostic_server(f"{SERVER_MODULE} 在 {sys.executable} 上不可导入") + + +def _import_rfauto_mcp(src: str): + """进程内导入服务器模块;失败返回 None。""" + if src and os.path.isdir(src): + sys.path.insert(0, src) + try: + with redirect_stdout(sys.stderr): + if SERVER_MODULE in sys.modules: + del sys.modules[SERVER_MODULE] + import importlib + + return importlib.import_module(SERVER_MODULE) + except Exception as exc: # noqa: BLE001 - 诊断路径负责报告 + print(f"[rfauto-plugin] 进程内导入失败:{exc}", file=sys.stderr) + return None + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/external_plugins/rfauto/skills/rf-verdict/SKILL.md b/external_plugins/rfauto/skills/rf-verdict/SKILL.md new file mode 100644 index 00000000..11c1de00 --- /dev/null +++ b/external_plugins/rfauto/skills/rf-verdict/SKILL.md @@ -0,0 +1,56 @@ +--- +name: rf-verdict +description: >- + 用 rfauto 质量门工具链判读任意来源(人工、脚本、其他 agent)的仿真结果是否可信,给出 TRUSTED / SUSPECT / STALE / UNVERIFIABLE 四态判定和逐门证据。用户问"这个仿真结果可信吗"、采信数字前要核验 run 或 Touchstone、对比两个 run,或仿真完成后需要质检时使用。触发词:判读、可信、验证、质检、verdict、verify、run 目录、touchstone。数值一律来自 rfauto 工具返回。 +--- + +# rf-verdict:仿真结果判读工作流 + +本技能是验证层:不管结果是谁产出的(人、脚本或其他 agent),流程都一样。全程只读,不改动任何产物。数值只来自工具返回,你的输出是判定结论和证据引用。 + +四态判定(TRUSTED、SUSPECT、STALE、UNVERIFIABLE)是本插件的判定约定,上游 rfauto 没有同名定义。输入来自上游的字段:`runs_verify` 返回的 fresh、stale、legacy、error,以及 `em_*` 工具的结果。上游另有 `solve_health` 的 healthy / suspect / unhealthy 词表,与本判定无关。 + +## 四态判定(输出口径,固定) + +| 判定 | 语义 | 触发条件 | +|---|---|---| +| **TRUSTED 可信** | 可采信 | freshness=fresh,且本轮所有能跑的门都 PASS | +| **SUSPECT 存疑** | 有数值假象的嫌疑,需人工复查 | freshness=fresh,但有任一门 FAIL 或 WARN(假结果往往看起来很合理);或 freshness=legacy(无 manifest,最高只能到 SUSPECT) | +| **STALE 失效** | 不可采信 | freshness=stale(产物被顶替、丢失或手改,manifest 指纹对不上) | +| **UNVERIFIABLE 无法验证** | 判不了,如实说明 | 工具不可用;run 目录不存在(freshness=error);输入既不是 run 也不是可解析的文件 | + +门判 FAIL 就如实报 FAIL,写清是哪道门、差多少,证据引用工具原文。 + +## 判读流程(按序执行,括号内是提前终止或跳过的条件) + +1. **定位输入**:`run_id`、run 目录或 Touchstone 文件路径。找不到目录就判 UNVERIFIABLE,并列出你试过的路径。 +2. **新鲜度**:`runs_verify`。status 为 stale 时判 STALE,逐条列出 issues(盘上 sha 与登记 sha 的对比),流程到此结束。status 为 legacy 时记一条 note 继续,但最终结论不得高于 SUSPECT。status 为 error 时判 UNVERIFIABLE。 +3. **建模期体检**(有模型清单 .yaml/.json 时):`em_doctor_check`。16 项表中只有 10 项已实装(例如 aperture 覆盖金属、薄层厚度、S 参数合理性),其余 6 项返回 SKIP。已实装项任一 FAIL,就从 SUSPECT 起步。没有清单时记为 skip,这只代表有清单数据的那部分,不要硬凑。 +4. **指标提取与物理合理性**:`em_metrics_from_run`。把读出的指标和配方目标(如有)对照。深谷器件要留意判据用的统计量(s11_db_min 还是 max,见工具文档)。 +5. **双 run 对比**(用户给了两个 run):`em_diff_runs`,看 params、manifest、sparams、freshness 四节。 +6. **失败归因**(有 FAIL 时):`explain_run` → `diagnose`,引用确定性规则的输出,不用领域直觉替代规则。 +7. **输出判定报告**,格式见下。 + +## 输出格式(固定) + +```markdown +## 判定: +对象:|通道:|引擎:<引擎名> +| 门 | 结论 | 证据(工具原文摘录) | +|---|---|---| +| freshness(runs_verify) | fresh | … | +| em doctor(已实装 10 项) | PASS/FAIL/skip | … | +| 指标合理性 | … | 数字全部来自 em_metrics_from_run | +数字出处:每个物理数字后注明来源工具调用。 +下一动作:按判定给出 1–3 条(SUSPECT → 建议用 em_diff_runs 对照或换引擎仲裁;STALE → 去找回收的 manifest;UNVERIFIABLE → 说明需要什么输入才能判)。 +``` + +## 原始 Touchstone(.sNp,无 run 目录) + +能判的只是其中一部分:`touchstone_info` 可以看端口数、频率轴和数据完整性。`em_doctor_check` 需要清单,裸 sNp 无法判断建模语义。裸文件最高只能给到 SUSPECT,因为没有新鲜度锚点,也没有建模体检,除非配有清单和 manifest。宁可少判,也不要猜。 + +## 边界 + +- 只读。任何判读路径都不写文件、不发起新仿真。需要复跑时,建议用户走 navigator 的流程;判读只针对已有产物。 +- legacy(老档案,无 manifest)既不是错误,也不是 PASS:如实标注证据等级下降。 +- 服务器未能启动、只剩 `rf_env_doctor` 时,先调它报告环境,判 UNVERIFIABLE,不凭记忆判。 diff --git a/external_plugins/rfauto/skills/rfauto-branchline-coupler/LICENSE.txt b/external_plugins/rfauto/skills/rfauto-branchline-coupler/LICENSE.txt new file mode 100644 index 00000000..e62463fa --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-branchline-coupler/LICENSE.txt @@ -0,0 +1,38 @@ +MIT License + +Copyright (c) 2026 rfauto contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +## FAQ + +**Q: Does rfauto's MIT license conflict with openEMS's GPL-3.0?** + +A: No. rfauto's main process never imports openEMS or CSXCAD Python bindings. These GPL-licensed +bindings are used only within child processes spawned by `simulation.py` (subprocess execution). +The rfauto repository itself contains no GPL code. Users compile bindings separately from the +openEMS source repository. + +**Q: Can I use rfauto commercially?** + +A: Yes, rfauto itself is MIT-licensed. However, you need valid licenses for any commercial EDA +software you use with it (Ansys AEDT/HFSS, Keysight ADS). rfauto does not provide or facilitate +any license circumvention. diff --git a/external_plugins/rfauto/skills/rfauto-branchline-coupler/SKILL.md b/external_plugins/rfauto/skills/rfauto-branchline-coupler/SKILL.md new file mode 100644 index 00000000..676ace42 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-branchline-coupler/SKILL.md @@ -0,0 +1,80 @@ +--- +name: rfauto-branchline-coupler +description: >- + 用 rfauto 设计、仿真或调参 branchline coupler(90° hybrid)时使用。内容包括 λ/4 臂阻抗综合,以及配方驱动的 run、tune、autotune、calibrate 工作流。触发词:branchline、branch-line、hybrid、90 degree coupler、quadrature、分支线电桥、90度电桥、正交电桥。ratrace(180°)与 Lange、gysel 耦合器不适用本卡,见其他 rfauto 卡。数值只来自 rfauto 内核与 references/ 下的卡片文件。 +license: 完整条款见本目录 LICENSE.txt +compatibility: 需要 PATH 中可用的 rfauto 命令(公开仓源码安装:在仓根执行 pip install -e .)。闭式综合可离线运行;引擎步骤需本机装有 openEMS 或 HFSS。 +metadata: + author: rfauto + version: '2' + rfauto_model: branchline_coupler + card_kind: recipe+capability+kernel + generator: 'curated from recipe_to_skill; spec: agentskills.io / rfauto T-Q10' + source_recipe: recipes/branchline_coupler_v1.yaml + source_cards: docs/capability_cards/branchline.md, docs_site/kernel_cards/branchline.md +allowed-tools: Bash(rfauto:*) Read +--- + +# rfauto skill:branchline_coupler + +## 器件与目标 + +- 模型插件:`branchline_coupler`;扫频 1.5–3.5 GHz。 +- 带内目标(objectives): + - `s11_db` max_below -15 @ [2.3, 2.5] GHz + - `s21_db` mean_within [-4.0, -2.5] @ [2.3, 2.5] GHz + +## 可调参数(optimization.params) + +| 参数 | low | high | +|---|---|---| +| arm_len_mm | 18.0 | 23.0 | +| series_w_mm | 1.7 | 2.05 | +| shunt_w_mm | 0.95 | 1.25 | + +## 标准工作流(typed 命令,数值由确定性内核产出) + +```bash +rfauto validate branchline_coupler_v1.yaml # 配方校验 +rfauto run branchline_coupler_v1.yaml -a fake # fake 快验证(秒级) +rfauto autotune branchline_coupler_v1.yaml --budget 3 # 确定性 critique 自治环 +rfauto tune branchline_coupler_v1.yaml -a openems --max-trials 30 # 外环寻优 +rfauto calibrate branchline_coupler_v1.yaml --sampler openems # 代理校准(如接入) +rfauto p0 --high-adapter hfss # 终验(商业求解器收口) +``` + +## 扫描 notebook 骨架(openEMS 快验证) + +```python +from rfauto.adapters.em_solver_base import EMSolverConfig +from rfauto.adapters.openems_solver import OpenEMSSolver + +solver = OpenEMSSolver(EMSolverConfig( + solver_type="openems", + freq_range_ghz=tuple([1.5, 3.5]), + mesh_resolution_mm=0.45, # 网格 base 覆盖;0=自动 λ_sub/50 +)) +solver.connect() +solver.build_geometry({"template": None, "params": {}}) # 填参数点 +result = solver.solve() +``` + +## 边界(硬约束) + +- LLM/agent 不产生物理数字:所有指标来自求解器与确定性评判器。 +- 对配方的任何修改走沙箱草稿 → 三层 Gate 审批(agent 写面隔离)。 +- FAIL 如实记录,不凑绿。 + +## When to open the reference files + +| you need | open | +|---|---| +| the full capability card (playbook, all anchors, engine precision) | `references/capability_card.md` | +| formulas, docstring pins, precision profile, code entries, test surface | `references/kernel_card.md` | +| a symptom → pitfall → fix lookup | `references/pitfalls.md` | +| the read-only stackup facts behind this recipe | `configs/materials.yaml` (source of truth) | + +## Verify before you finish + +Run `python scripts/verify_output.py --json [--expect KEY=VALUE ... --tol 1e-3]`. +FAIL is reported as FAIL (rfauto rule #122); never retry a FAIL into green. diff --git a/external_plugins/rfauto/skills/rfauto-branchline-coupler/references/capability_card.md b/external_plugins/rfauto/skills/rfauto-branchline-coupler/references/capability_card.md new file mode 100644 index 00000000..dc4a6008 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-branchline-coupler/references/capability_card.md @@ -0,0 +1,71 @@ +# 能力卡:branchline + +> 由 scripts/capability_cards_export.py 离线生成(确定性输出);数据源与坑号链见文中逐条标注。 + +## 适用场景 + +- 拓扑:标准角馈 branchline:正方形环(横臂 series_w=35.35Ω、竖臂 shunt_w=50Ω,各 λ/4)+ 四角 50Ω 馈线至端口面;四端全为 MSLPort(port4 隔离端 2026-09-16 起由 PML 端接升级为真端口,端口面贴板边) +- f0:2.4 GHz | 端口:4 | 时长 ≤30.0 ns | 网格档:0.0 mm +- 提取口径:S11/S21/S31/S41 @ MSLPort 1-4(单激励 9 列 CSV;整 4×4 由 excite_port=1..4 进程隔离轮转装配 → .s4p,#208;2026-09-16 前 port4 为 PML 端接不提取) +- 参数:arm_len_mm, series_w_mm, shunt_w_mm +- 基板:{"er":3.66,"h_mm":0.508} + +## 名义参数 + +| 参数 | 名义值 | +|---|---| +| arm_len_mm | 20.5 | +| series_w_mm | 1.87 | +| shunt_w_mm | 1.11 | +- 名义参数来源:`docs/templates/branchline/meta.yaml`(与 TEMPLATE_NOMINAL 一致性由 test_gallery_export 钉) + +## 敏感性排序(R9 先承诺) + +- 出处=computed(幅值分数登记表 `knowledge/sensitivity_rankings.yaml`;证据 scripts/sensitivity_rankings_build.py;坏条目拒收如实降级 #105) + +- 方法 central_finite_difference_elasticity | n=7 | 证据:scripts/sensitivity_rankings_build.py + +| rank | 参数 | 分数 | +|---|---|---| +| 1 | arm_len_mm | 1.0 | +| 2 | series_w_mm | 0.043068 | +| 3 | shunt_w_mm | 0.0 | +- 排序=R9 commitment_order(optimization/eipu;高敏感先钉死,平局按参数名升序) + +## 判据 + +- 锚覆盖 5:branchline.f_match.openems-hfss-v1、coupled_microstrip.kj_even_domain.lit-v1、cps.gamma_er.fdref-v1、mmt.inductive_post_b.hfss-v1、mmt.resonant_window_fres.hfss-v1(core/anchors;通配 + 专属) +- 健康门:无模板作用域专属健康门(gate 如实不判,#274 口径) +- 通用体检:求解健康度体检 G11 九因子(core/solve_health;service/health_service.health_check_run 按 run 装载产物判定) + +## 引擎精度卡(跨引擎仲裁锚) + +- `branchline.f_match.openems-hfss-v1`(pointer/experimental;引擎对 openems(hfss 仲裁)):branchline_f_match_dev_pct 双值 hfss=2.2275 / openems=2.1360000000000006 GHz(不取平均,#122);±4.283708(arbitration_interval);verdict DISAGREE;证据:runs/hfss_window_b2a/branchline +- `coupled_microstrip.kj_even_domain.lit-v1`(constant/active;闭式/文献锚(无引擎对)):kj_even_domain_dev_pct = 0.66 percent;±1.0(arbitration_interval);verdict KJ_VINDICATED_J1_PASS(Elmer 三紧缝/域缘点 even −0.180%/−0.590%/−0.439% 全 J1 PASS;p2_summary.json overall=FAIL 属 HFSS 测量面非 KJ 本体,勿混淆);证据:runs/df7_kjeven +- `cps.gamma_er.fdref-v1`(formula/active;闭式/文献锚(无引擎对)):cps_gamma_er expr = 1 + 0.9014*er**-0.6361(变量:er);±0.006(relative);证据:runs/df6_dp14m1、runs/df6_dp18c9 +- `mmt.inductive_post_b.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):inductive_post_b_dev_pct = 9.224 percent;±7.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- `mmt.resonant_window_fres.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):resonant_window_f_res_dev_pct = 16.6 percent;±3.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- 数据源:`knowledge/anchors.yaml`(仲裁锚注册表,status/版本演进口径见该文件头注;本节零计算零求值) + +## 已知边界 + +- 参数语义:series_w_mm=横臂(串联臂,1↔2 / 4↔3)35.35Ω,shunt_w_mm=竖臂(并联臂)50Ω,arm_len_mm=环边长 λ/4——2026-09-05 对照 Microwaves101/PMC 口径修正(旧版横竖阻抗反置+臂中点馈电+隔离端悬空,三处结构性错误)。名义臂注记(R2-1 审查批 2026-10-04):arm_len_mm=20.5 为薄线极限捷径口径(HJ 精算正解 18.09mm,偏差 +11.8%,已裁定维持锚定基线不改数值);出处:runs/review_ge8e/r2_synthesis_templates_anchors/REPORT.md R2-1 与坑#252 +- 网格:x/y 双轴有端口面 → 双轴 PML +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-branchline-coupler/references/kernel_card.md b/external_plugins/rfauto/skills/rfauto-branchline-coupler/references/kernel_card.md new file mode 100644 index 00000000..f526c4af --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-branchline-coupler/references/kernel_card.md @@ -0,0 +1,240 @@ + + +# 内核文档卡:branchline + +> E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +| 字段 | 值 | +|---|---| +| 内核 ID | `branchline` | +| 主模块 | `src/rfauto/core/synthesis.py`(`rfauto.core.synthesis`) | +| 计算器注册表 | 未注册(AST 无 @register_calculator 装饰器——service 直调型内核,免 #231 注册表消费者三表同步) | +| KD-1 出处注册 | 2 条(kernel_file=src/rfauto/core/synthesis.py) | +| XC-P 精度档案 | 见下方「精度域」节(机读判定) | +| 数据来源 | XC-P + KD-1 + 模块 docstring/AST + anchors.yaml + tests/service 扫描 | + +## 物理语义 + +分支线耦合器综合:Z0/√2 串联臂与 Z0 并联臂各按自身线宽 εeff 取 λ/4(XA-3 迭代序)——两臂 εeff 差数个百分点,不可共用同一臂长;旧 arm_len 键保留为弃用别名(#315 兼容)。 + +模块自述(docstring 首行,机读):E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +## 公式与口径 + +### 两臂各自 λ/4(自身 εeff) + +(docstring 原文转写) + +```latex +L_{s}=\frac{c}{4f_0\sqrt{\varepsilon_{\mathrm{eff}}(w_s)}},\; w_s:\ Z_0/\sqrt{2};\qquad L_{h}=\frac{c}{4f_0\sqrt{\varepsilon_{\mathrm{eff}}(w_h)}},\; w_h:\ Z_0 +``` + +出处:synthesize_branchline docstring「闭式公式(XA-3 迭代序修正)」节;shunt 臂同式按自身 εeff。 + +docstring 逐字引文(防漂移钉):"series_len = λ/4 @ εeff(inverse_width(Z0/√2))——35.35Ω series 臂按自身" + "series_w: 35.35Ω (Z0/sqrt(2)) line width for series arms" + +### 两臂 εeff 差异(不可共用臂长) + +(口径示意(非 docstring 原式,读代码为准)) + +```latex +\varepsilon_{\mathrm{eff}}(w_s)\ne\varepsilon_{\mathrm{eff}}(w_h)\;\Rightarrow\;L_s\ne L_h +``` + +出处:synthesize_branchline docstring——旧口径 arm_len=λ/4@εeff(w=1mm) 对两臂都是双重近似。 + +docstring 逐字引文(防漂移钉):"两臂 εeff 差数个百分点,不可再共用同一臂长(旧口径" + +### #315 弃用别名 + +(docstring 原文转写) + +```latex +\texttt{arm\_len\_mm}\equiv\texttt{series\_len\_mm}\ \text{(弃用别名)} +``` + +出处:synthesize_branchline docstring #315 节。 + +docstring 逐字引文(防漂移钉):"#315 兼容:arm_len_mm 保留为弃用别名(=series_len_mm),旧消费方" + +### KD-1 出处注册(`src/rfauto/core/synthesis.py`,knowledge/formula_provenance.yaml 过滤) + +命中 **2** 条: + +| formula_id | symbol | kind | source_doi | refs | +|---|---|---|---|---| +| synthesis:chebyshev_lpf_g_values:01 | chebyshev_lpf_g_values | pointer | — | — | +| synthesis:patch_rin_edge_balanis:01 | patch_rin_edge_balanis | source | — | — | + +## 精度域(XC-P 精度档案) + +**未收录**:XC-P 首批建档内核共 **10** 个(bounds、conductor_loss、coupled_microstrip、dielectric_extract、etch_trapezoid、high_power、ridged_waveguide、shield_cavity_mode、synthesis.forward_z0、thermal_iteration),不含 `branchline`。因此: + +- 典型偏差分档:**UNVERIFIED**(无档案即无分档;本卡不编造任何精度数字——铁律 7 / #122 如实标注); +- 域判查询:`core/precision_profiles.py` 对未知 kernel 如实降级(收集器=`tests/unit/test_precision_profiles.py` 逐条对照防漂移); +- 建档入口:precision_profiles.yaml 增键(schema 见该文件头)+ `KERNEL_MODULES` 映射 + 模块 docstring 末尾「精度档案」镜像行 + 重跑本生成器。 + +> 本节为机读聚合:XC-P 收录状态与键清单构建时实测;本内核建档后此节自动展开为分档表(渲染支路已备)。 + +## 使用边界 + +- series/shunt 严格设计(方环变矩形环)需渲染透传双键——综合内核已双键齐备,渲染层改动另行立项。 + - docstring 逐字引文:"透传双键,属渲染层改动不在本批(报告主代理)。" + +## 代码入口 + +主入口(file:symbol,AST 校验存在): + +- `src/rfauto/core/synthesis.py:synthesize_branchline` + +src/rfauto/core/synthesis.py 公开符号 **43** 个(AST 机读): + +`Stackup`、`ForwardMedia`、`forward_media`、`forward_z0`、`inverse_width`、`nominal_width_mm`、`lossless_width_mm`、`SynthesisResult`、`synthesize_mline`、`synthesize_batch`、`ModelSynthesisResult`、`synthesize_wilkinson`、`synthesize_branchline`、`patch_fringing_delta_l`、`patch_rin_edge_balanis`、`patch_cavity_metrics`、`synthesize_patch`、`synthesize_mline_model`、`synthesize_cpw_model`、`synthesize_dipole_model`、`synthesize_wstep_model`、`synthesize_tjunc_model`、`synthesize_bend_model`、`synthesize_via_model`、`synthesize_atten_pi_model`、`synthesize_atten_t_model`、`synthesize_ratrace_model`、`synthesize_gysel_model`、`synthesize_stripline_model`、`synthesize_cps_model`、`synthesize_suspended_stripline_model`、`synthesize_msl_cpw_model`、`synthesize_siw_model`、`synthesize_msl_siw_taper_model`、`synthesize_sma_launcher_model`、`synthesize_bpf_model`、`hairpin_design_from_order`、`synthesize_hairpin_model`、`chebyshev_lpf_g_values`、`synthesize_multisection_quarter_wave`、`synthesize_nway_wilkinson`、`schiffman_delta_phase`、`synthesize_schiffman` + +消费面(service/adapters 引用扫描,机读): + +- service:`src/rfauto/service/anchor_family_service.py` +- service:`src/rfauto/service/diagram_stackup_service.py` +- service:`src/rfauto/service/em_bench_service.py` +- service:`src/rfauto/service/even_odd_service.py` +- service:`src/rfauto/service/kicad_em_service.py` +- service:`src/rfauto/service/level2_design.py` +- service:`src/rfauto/service/meep_sampling.py` +- service:`src/rfauto/service/package_chain_service.py` +- service:`src/rfauto/service/qucsator_service.py` +- service:`src/rfauto/service/teaching_service.py` +- service:`src/rfauto/service/unit_convert_service.py` +- adapters:`src/rfauto/adapters/comsol_adapter.py` +- adapters:`src/rfauto/adapters/edb_templates/schema.py` +- adapters:`src/rfauto/adapters/fake_adapter/adapter.py` +- adapters:`src/rfauto/adapters/fake_adapter/antenna_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/coupler_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/filter_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/tl_family.py` +- adapters:`src/rfauto/adapters/layout_generator.py` +- adapters:`src/rfauto/adapters/meep_adapter.py` +- adapters:`src/rfauto/adapters/oe_templates/_nominal_width.py` +- adapters:`src/rfauto/adapters/oe_templates/closedform.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c3.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c4.py` +- adapters:`src/rfauto/adapters/oe_templates/render_coupled_bpf.py` +- adapters:`src/rfauto/adapters/oe_templates/render_diplexer_ridged.py` +- adapters:`src/rfauto/adapters/oe_templates/render_hairpin.py` +- adapters:`src/rfauto/adapters/oe_templates/render_phase_qwt.py` +- adapters:`src/rfauto/adapters/oe_templates/render_sicl_nway.py` +- adapters:`src/rfauto/adapters/oe_templates/render_siw.py` +- adapters:`src/rfauto/adapters/oe_templates/render_ta_wave_c.py` +- adapters:`src/rfauto/adapters/qucsator_adapter.py` + +## 锚与测试入口 + +analytic-anchor(knowledge/anchors.yaml 机读命中): + +| anchor_id | quantity | +|---|---| +| `c3.k_of_g.openems-hfss-v1` | k_of_g | +| `mline.z0_ohm.closedform-v1` | mline_z0_ohm | +| `ratrace.r_ring_mm.closedform-v1` | ratrace_r_ring_mm | +| `ratrace.ring_z_ohm.closedform-v1` | ratrace_ring_z_ohm | +| `schiffman.delta_phase.closedform-v1` | schiffman_delta_phase_deg | + +测试面(tests/unit 引用扫描,机读;合计 **1642** 个 test 函数): + +| 测试文件 | test 函数数 | +|---|---| +| `tests/unit/test_a3c_coupled_interdigital.py` | 20 | +| `tests/unit/test_anchd_analytic_anchors.py` | 7 | +| `tests/unit/test_anchors_correction.py` | 30 | +| `tests/unit/test_aniso_separation.py` | 7 | +| `tests/unit/test_array_templates.py` | 25 | +| `tests/unit/test_atten_pi_template.py` | 10 | +| `tests/unit/test_atten_t_template.py` | 9 | +| `tests/unit/test_audit_fix_core_visibility.py` | 15 | +| `tests/unit/test_bend_template.py` | 7 | +| `tests/unit/test_cal_wizard.py` | 37 | +| `tests/unit/test_calculators.py` | 49 | +| `tests/unit/test_coupled_bpf_template.py` | 34 | +| `tests/unit/test_coupling_matrix.py` | 52 | +| `tests/unit/test_cps_template.py` | 20 | +| `tests/unit/test_cpw_template.py` | 11 | +| `tests/unit/test_diplexer_ridged_templates.py` | 28 | +| `tests/unit/test_dipole_template.py` | 7 | +| `tests/unit/test_edb_templates.py` | 25 | +| `tests/unit/test_edb_templates_ext.py` | 38 | +| `tests/unit/test_eep_templates.py` | 19 | +| `tests/unit/test_engine_benchmark_expand_golden.py` | 25 | +| `tests/unit/test_gysel_template.py` | 15 | +| `tests/unit/test_hairpin_alt_template.py` | 26 | +| `tests/unit/test_hairpin_kgap_correction.py` | 16 | +| `tests/unit/test_hairpin_template.py` | 37 | +| `tests/unit/test_impedance_drc.py` | 27 | +| `tests/unit/test_interdigital_template.py` | 31 | +| `tests/unit/test_level2_design.py` | 62 | +| `tests/unit/test_marchand_two_section.py` | 22 | +| `tests/unit/test_marchand_via_ab.py` | 18 | +| `tests/unit/test_materials_loader.py` | 15 | +| `tests/unit/test_meep_adapter.py` | 38 | +| `tests/unit/test_mf_synthesis.py` | 33 | +| `tests/unit/test_mline_template.py` | 7 | +| `tests/unit/test_msl_cpw_template.py` | 19 | +| `tests/unit/test_msl_siw_taper_template.py` | 15 | +| `tests/unit/test_mtrl_kit_kicad.py` | 16 | +| `tests/unit/test_oe_phase3_driver.py` | 42 | +| `tests/unit/test_package_chain.py` | 37 | +| `tests/unit/test_patch_feed_offset_unification.py` | 6 | +| `tests/unit/test_pk2_vertical_lit_and_wiring.py` | 10 | +| `tests/unit/test_port_renormalize.py` | 14 | +| `tests/unit/test_qucsator_adapter.py` | 35 | +| `tests/unit/test_qw10_qw11.py` | 14 | +| `tests/unit/test_ratrace_template.py` | 19 | +| `tests/unit/test_rf_matrix_branchline.py` | 53 | +| `tests/unit/test_ring_resonator_template.py` | 25 | +| `tests/unit/test_rp1_myj_sec4_05_prototype.py` | 6 | +| `tests/unit/test_rp1_pozar_patch_example.py` | 3 | +| `tests/unit/test_rules_verify.py` | 6 | +| `tests/unit/test_schiffman_qwt_templates.py` | 26 | +| `tests/unit/test_sensanc_analytic_anchors.py` | 11 | +| `tests/unit/test_shell_below_service_ratchet.py` | 3 | +| `tests/unit/test_sicl_nway_templates.py` | 26 | +| `tests/unit/test_siw_template.py` | 26 | +| `tests/unit/test_sma_launcher_template.py` | 22 | +| `tests/unit/test_stackup_diagram.py` | 39 | +| `tests/unit/test_stepped_coupled_line_specs.py` | 8 | +| `tests/unit/test_stripline_template.py` | 12 | +| `tests/unit/test_suspended_stripline_template.py` | 19 | +| `tests/unit/test_symbolic_fit.py` | 15 | +| `tests/unit/test_synthesis.py` | 14 | +| `tests/unit/test_synthesis_bpf_asym_tz.py` | 8 | +| `tests/unit/test_synthesis_bpf_polish_backsub.py` | 8 | +| `tests/unit/test_synthesis_multisection.py` | 31 | +| `tests/unit/test_synthesis_patch_anchor.py` | 16 | +| `tests/unit/test_tjunc_template.py` | 8 | +| `tests/unit/test_unit_convert_service.py` | 13 | +| `tests/unit/test_varactor.py` | 26 | +| `tests/unit/test_varactor_bpf_template.py` | 12 | +| `tests/unit/test_via_template.py` | 7 | +| `tests/unit/test_w1s3_lange_stepped.py` | 11 | +| `tests/unit/test_w3s11_ring.py` | 12 | +| `tests/unit/test_w3s15_analytic_anchors.py` | 7 | +| `tests/unit/test_w4_a_sm_core.py` | 21 | +| `tests/unit/test_w4_w4e_anchors.py` | 10 | +| `tests/unit/test_w4s15_anchor_batch.py` | 11 | +| `tests/unit/test_w6_d_so_leftovers.py` | 32 | +| `tests/unit/test_w6_f_anchors_cpw.py` | 7 | +| `tests/unit/test_width_single_source.py` | 11 | +| `tests/unit/test_wilkinson_synthesis_semantics.py` | 7 | +| `tests/unit/test_wstep_template.py` | 8 | +| `tests/unit/test_x5_analytic_anchors.py` | 13 | + +XC-P 精度档案收集器(防漂移对照面):`tests/unit/test_precision_profiles.py`;本卡保鲜门:`tests/unit/test_kernel_cards.py`。 + +## 关联 + +- [架构与方法论(锚体系/判据先行)](../architecture/methodology.md) +- [分层架构](../explanation/layered-architecture.md) +- [计算器注册表](../reference/calculators.md)——本内核的注册状态见元数据表 +- 同批内核卡:[macromodel](macromodel.md)、[rwg_mmt](rwg_mmt.md)、[pdn](pdn.md)、[pce](pce.md)、[cascade](cascade.md)、[mline](mline.md)、[wilkinson](wilkinson.md)、[ratrace](ratrace.md)、[patch](patch.md)、[hairpin](hairpin.md)、[cpw](cpw.md)、[slotline](slotline.md)、[coupled_microstrip](coupled_microstrip.md)、[finline](finline.md)、[wilkinson_unequal](wilkinson_unequal.md)、[atten_pi](atten_pi.md)、[atten_t](atten_t.md)、[qwt_multisection](qwt_multisection.md)、[nway_wilkinson](nway_wilkinson.md)、[schiffman](schiffman.md)、[bethe_hole_coupler](bethe_hole_coupler.md)、[gysel_core](gysel_core.md)、[coupled_line_bpf](coupled_line_bpf.md)、[lange](lange.md)、[stepped_impedance](stepped_impedance.md)、[ring_resonator](ring_resonator.md)、[mixer_conversion](mixer_conversion.md)、[ruthroff_balun](ruthroff_balun.md)、[gd_equalizer](gd_equalizer.md)、[measurement_drift](measurement_drift.md)、[agc_loop](agc_loop.md)、[cal_kit_verify](cal_kit_verify.md)、[six_port](six_port.md)、[iss_on_wafer](iss_on_wafer.md)、[source_power_cal](source_power_cal.md)、[combline](combline.md)、[cps](cps.md)、[interdigital](interdigital.md)、[siw](siw.md)、[slot](slot.md)、[stripline](stripline.md)、[suspended_stripline](suspended_stripline.md)、[dipole](dipole.md)、[helix](helix.md)、[link_limits](link_limits.md)、[fec_codes](fec_codes.md)、[directional_bridge](directional_bridge.md)、[rf_switch](rf_switch.md)、[kuroda_identities](kuroda_identities.md)、[pll_lock_time](pll_lock_time.md)、[multisection_coupler](multisection_coupler.md)、[itu_link](itu_link.md)、[link](link.md)、[dgs](dgs.md)、[if_digitizer](if_digitizer.md)、[wg_dielectric_window](wg_dielectric_window.md)、[waveguide_closed_form](waveguide_closed_form.md)、[waveguide_iris](waveguide_iris.md)、[hybrid_junction](hybrid_junction.md)、[radar_eq](radar_eq.md)、[modulation_ber](modulation_ber.md)、[coax_line](coax_line.md)、[analog_modulation](analog_modulation.md)、[si_ctle](si_ctle.md)、[propagation](propagation.md)、[hf_skywave](hf_skywave.md)、[fmcw_radar](fmcw_radar.md)、[sar_geometry](sar_geometry.md)、[gnss_geometry](gnss_geometry.md)、[radar_clutter](radar_clutter.md)、[microstrip_disc](microstrip_disc.md)、[open_wire_line](open_wire_line.md)、[wg_cavity_bpf](wg_cavity_bpf.md) diff --git a/external_plugins/rfauto/skills/rfauto-branchline-coupler/references/pitfalls.md b/external_plugins/rfauto/skills/rfauto-branchline-coupler/references/pitfalls.md new file mode 100644 index 00000000..ba8d9626 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-branchline-coupler/references/pitfalls.md @@ -0,0 +1,26 @@ +# rfauto branchline · failure-mode playbook + +> Extracted verbatim from the capability card「失败模式坑账链」section (docs/capability_cards/branchline.md; deterministic +> regeneration). Pit numbers (#NNN) are rfauto DEVLOG ledger +> markers. Symptom → pitfall chain → disposition; open this file +> when a run shows one of the listed symptoms. + +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-branchline-coupler/scripts/verify_output.py b/external_plugins/rfauto/skills/rfauto-branchline-coupler/scripts/verify_output.py new file mode 100644 index 00000000..c92392dd --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-branchline-coupler/scripts/verify_output.py @@ -0,0 +1,97 @@ +"""Deterministic output verifier for the rfauto branchline skill package. + +Structural checks only — zero physics claims (rfauto rule 7: numbers come +from the rfauto kernel or the card files in references/, never from this +script or from model memory): + + 1. every --json file parses as JSON and contains no non-finite floats + (NaN/Infinity anywhere in the document); + 2. each --expect KEY=VALUE: KEY exists in the JSON, is a finite number, + and abs(value - VALUE) <= --tol (default 1e-3). + +Pass KEY/VALUE pairs only from rfauto kernel output or from the card files +in references/. Exit codes: 0 = all checks pass; 1 = any check fails. +Report FAIL as FAIL (rfauto rule #122); never retry a FAIL into green. +""" +from __future__ import annotations + +import argparse +import json +import math +import sys + + +def _non_finite_paths(node, prefix="$"): + bad = [] + if isinstance(node, float) and not math.isfinite(node): + bad.append(prefix) + elif isinstance(node, dict): + for key, value in node.items(): + bad += _non_finite_paths(value, prefix + "." + str(key)) + elif isinstance(node, list): + for i, value in enumerate(node): + bad += _non_finite_paths(value, prefix + "[" + str(i) + "]") + return bad + + +def main(argv=None): + parser = argparse.ArgumentParser( + description="Structural verifier for saved rfauto JSON output.") + parser.add_argument("--json", action="append", required=True, + help="saved rfauto kernel JSON (repeatable)") + parser.add_argument("--expect", action="append", default=[], + help="KEY=VALUE numeric cross-check (repeatable)") + parser.add_argument("--tol", type=float, default=1e-3) + args = parser.parse_args(argv) + + failures = [] + for path in args.json: + try: + with open(path, encoding="utf-8") as handle: + raw = handle.read() + except OSError as exc: + failures.append(path + ": unreadable (" + str(exc) + ")") + continue + try: + data = json.loads(raw) + except ValueError as exc: + failures.append(path + ": not JSON (" + str(exc) + ")") + continue + for where in _non_finite_paths(data): + failures.append(path + ": non-finite float at " + where) + if not isinstance(data, dict): + failures.append(path + ": top-level JSON is not an object") + continue + for spec in args.expect: + key, sep, value = spec.partition("=") + if not sep: + failures.append( + path + ": bad --expect " + repr(spec) + " (want KEY=VALUE)") + continue + if key not in data: + failures.append(path + ": missing key " + repr(key)) + continue + try: + got = float(data[key]) + except (TypeError, ValueError): + failures.append(path + ": key " + repr(key) + " not numeric") + continue + if not math.isfinite(got): + failures.append(path + ": key " + repr(key) + " non-finite") + continue + want = float(value) + if abs(got - want) > args.tol: + failures.append( + path + ": " + key + "=" + repr(got) + " vs expected " + + repr(want) + " (tol " + repr(args.tol) + ")") + if failures: + for line in failures: + print("FAIL " + line) + return 1 + print("PASS " + str(len(args.json)) + " file(s), " + + str(len(args.expect)) + " expectation(s)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/external_plugins/rfauto/skills/rfauto-cpw/LICENSE.txt b/external_plugins/rfauto/skills/rfauto-cpw/LICENSE.txt new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-cpw/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/external_plugins/rfauto/skills/rfauto-cpw/SKILL.md b/external_plugins/rfauto/skills/rfauto-cpw/SKILL.md new file mode 100644 index 00000000..4a6da103 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-cpw/SKILL.md @@ -0,0 +1,87 @@ +--- +name: rfauto-cpw +description: >- + 涉及 rfauto 的 `cpw` 卡时使用:均匀共面波导(锚族,中心带加两侧地,地延伸到域边;CPWPort 为一等端口,按 gap_width 口径)。可调参数:w_mm、gap_mm、line_len_mm。指标提取:CPWPort 1-2 处的 S11、S21,其中 S21 的相位斜率给出 εeff。触发词:cpw。其他卡族不适用,请改用对应的 rfauto 卡或 skill。数值只来自 rfauto 内核与 references/ 下的卡片文件。 +license: 完整条款见本目录 LICENSE.txt +compatibility: 需要 PATH 中可用的 rfauto 命令(公开仓源码安装:在仓根执行 pip install -e .)。闭式综合可离线运行;引擎步骤需本机装有 openEMS 或 HFSS。 +metadata: + author: rfauto + version: '1' + rfauto_card: cpw + card_kind: capability+kernel + generator: rfauto.service.skill_service.card_to_skill + source_cards: docs/capability_cards/cpw.md, docs_site/kernel_cards/cpw.md +allowed-tools: Bash(rfauto:*) Read +--- + +# rfauto · cpw + +> Generated by `rfauto.service.skill_service.card_to_skill` from the +> rfauto deterministic cards (byte-copied under `references/`); +> regeneration is idempotent. Rule 7: every number must come from the +> rfauto kernel or these cards — never from model memory, never +> invented to be helpful. + +## When this skill applies + +- 拓扑:均匀共面波导(锚族:中心带+两侧地,地延伸到域边;CPWPort 一等端口,gap_width 口径) +- f0:2.5 GHz | 端口:2 | 时长 ≤30.0 ns | 网格档:0.0 mm +- 提取口径:S11/S21 @ CPWPort 1-2(均匀共面线:S21 相位斜率→εeff) +- 参数:w_mm, gap_mm, line_len_mm +- 基板:{"er":3.66,"h_mm":0.508} + +## Workflow (typed commands; every value comes from the kernel) + +Run `rfauto --help` and consult the code entry points listed in the kernel card (`references/kernel_card.md`, section「代码入口」) — the CLI surface for card `cpw` is not pinned by this package. + +## Nominal parameters + +| 参数 | 名义值 | +|---|---| +| gap_mm | 0.2 | +| line_len_mm | 40.0 | +| w_mm | 0.849 | +- 名义参数来源:`docs/templates/cpw/meta.yaml`(与 TEMPLATE_NOMINAL 一致性由 test_gallery_export 钉) + +## Sensitivity ranking + +- 出处=computed(幅值分数登记表 `knowledge/sensitivity_rankings.yaml`;证据 scripts/sensitivity_rankings_build.py;坏条目拒收如实降级 #105) +- 方法 central_finite_difference_elasticity | n=7 | 证据:scripts/sensitivity_rankings_build.py +| rank | 参数 | 分数 | +|---|---|---| +| 1 | w_mm | 0.510468 | +| 2 | gap_mm | 0.16042 | +| 3 | line_len_mm | 0.0 | +- 排序=R9 commitment_order(optimization/eipu;高敏感先钉死,平局按参数名升序) + +## Judgment gates and anchors + +- 锚覆盖 5:coupled_microstrip.kj_even_domain.lit-v1、cps.gamma_er.fdref-v1、cpw.z0_ohm.closedform-v1、mmt.inductive_post_b.hfss-v1、mmt.resonant_window_fres.hfss-v1(core/anchors;通配 + 专属) +- 健康门:无模板作用域专属健康门(gate 如实不判,#274 口径) +- 通用体检:求解健康度体检 G11 九因子(core/solve_health;service/health_service.health_check_run 按 run 装载产物判定) + +## Card-specific arbitration anchors + +- `cpw.z0_ohm.closedform-v1`(constant/experimental;引擎对 closedform(None 仲裁)):cpw_z0_ohm = 50.0 ohm;±0.005(rounding_band);证据:runs/w4_phase4/w4e + +- Wildcard anchors from other families that also cover this card: see the「判据」section above and `references/capability_card.md`. + +## Known boundaries + +- 参数语义:w_mm=中心带宽(Z0 由 CPWG 共形映射闭式综合定:50Ω@rogers4350b gap=0.2 → w=0.849mm,#198 参照系修正——openEMS 官方口径底面强制地,实际结构即 CPWG),gap_mm=缝宽,line_len_mm=两端口间线长 +- 网格:mesh_resolution_mm=网格 base 覆盖(mm);0=自动 λ_sub/50;带缘+地内缘(缝两侧)x 向 near 加密 + +- Failure-mode playbook (symptom → pitfall → fix, cpw-relevant): open `references/pitfalls.md` when a run shows one of the listed symptoms. + +## When to open the reference files + +| you need | open | +|---|---| +| the full capability card (playbook, all anchors, engine precision) | `references/capability_card.md` | +| formulas, docstring pins, precision profile, code entries, test surface | `references/kernel_card.md` | +| a symptom → pitfall → fix lookup | `references/pitfalls.md` | + +## Verify before you finish + +Run `python scripts/verify_output.py --json [--expect KEY=VALUE ... --tol 1e-3]`. +FAIL is reported as FAIL (rfauto rule #122); never retry a FAIL into green. diff --git a/external_plugins/rfauto/skills/rfauto-cpw/references/capability_card.md b/external_plugins/rfauto/skills/rfauto-cpw/references/capability_card.md new file mode 100644 index 00000000..f9948f92 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-cpw/references/capability_card.md @@ -0,0 +1,71 @@ +# 能力卡:cpw + +> 由 scripts/capability_cards_export.py 离线生成(确定性输出);数据源与坑号链见文中逐条标注。 + +## 适用场景 + +- 拓扑:均匀共面波导(锚族:中心带+两侧地,地延伸到域边;CPWPort 一等端口,gap_width 口径) +- f0:2.5 GHz | 端口:2 | 时长 ≤30.0 ns | 网格档:0.0 mm +- 提取口径:S11/S21 @ CPWPort 1-2(均匀共面线:S21 相位斜率→εeff) +- 参数:w_mm, gap_mm, line_len_mm +- 基板:{"er":3.66,"h_mm":0.508} + +## 名义参数 + +| 参数 | 名义值 | +|---|---| +| gap_mm | 0.2 | +| line_len_mm | 40.0 | +| w_mm | 0.849 | +- 名义参数来源:`docs/templates/cpw/meta.yaml`(与 TEMPLATE_NOMINAL 一致性由 test_gallery_export 钉) + +## 敏感性排序(R9 先承诺) + +- 出处=computed(幅值分数登记表 `knowledge/sensitivity_rankings.yaml`;证据 scripts/sensitivity_rankings_build.py;坏条目拒收如实降级 #105) + +- 方法 central_finite_difference_elasticity | n=7 | 证据:scripts/sensitivity_rankings_build.py + +| rank | 参数 | 分数 | +|---|---|---| +| 1 | w_mm | 0.510468 | +| 2 | gap_mm | 0.16042 | +| 3 | line_len_mm | 0.0 | +- 排序=R9 commitment_order(optimization/eipu;高敏感先钉死,平局按参数名升序) + +## 判据 + +- 锚覆盖 5:coupled_microstrip.kj_even_domain.lit-v1、cps.gamma_er.fdref-v1、cpw.z0_ohm.closedform-v1、mmt.inductive_post_b.hfss-v1、mmt.resonant_window_fres.hfss-v1(core/anchors;通配 + 专属) +- 健康门:无模板作用域专属健康门(gate 如实不判,#274 口径) +- 通用体检:求解健康度体检 G11 九因子(core/solve_health;service/health_service.health_check_run 按 run 装载产物判定) + +## 引擎精度卡(跨引擎仲裁锚) + +- `coupled_microstrip.kj_even_domain.lit-v1`(constant/active;闭式/文献锚(无引擎对)):kj_even_domain_dev_pct = 0.66 percent;±1.0(arbitration_interval);verdict KJ_VINDICATED_J1_PASS(Elmer 三紧缝/域缘点 even −0.180%/−0.590%/−0.439% 全 J1 PASS;p2_summary.json overall=FAIL 属 HFSS 测量面非 KJ 本体,勿混淆);证据:runs/df7_kjeven +- `cps.gamma_er.fdref-v1`(formula/active;闭式/文献锚(无引擎对)):cps_gamma_er expr = 1 + 0.9014*er**-0.6361(变量:er);±0.006(relative);证据:runs/df6_dp14m1、runs/df6_dp18c9 +- `cpw.z0_ohm.closedform-v1`(constant/experimental;引擎对 closedform(None 仲裁)):cpw_z0_ohm = 50.0 ohm;±0.005(rounding_band);证据:runs/w4_phase4/w4e +- `mmt.inductive_post_b.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):inductive_post_b_dev_pct = 9.224 percent;±7.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- `mmt.resonant_window_fres.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):resonant_window_f_res_dev_pct = 16.6 percent;±3.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- 数据源:`knowledge/anchors.yaml`(仲裁锚注册表,status/版本演进口径见该文件头注;本节零计算零求值) + +## 已知边界 + +- 参数语义:w_mm=中心带宽(Z0 由 CPWG 共形映射闭式综合定:50Ω@rogers4350b gap=0.2 → w=0.849mm,#198 参照系修正——openEMS 官方口径底面强制地,实际结构即 CPWG),gap_mm=缝宽,line_len_mm=两端口间线长 +- 网格:mesh_resolution_mm=网格 base 覆盖(mm);0=自动 λ_sub/50;带缘+地内缘(缝两侧)x 向 near 加密 +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-cpw/references/kernel_card.md b/external_plugins/rfauto/skills/rfauto-cpw/references/kernel_card.md new file mode 100644 index 00000000..0a5f539f --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-cpw/references/kernel_card.md @@ -0,0 +1,232 @@ + + +# 内核文档卡:cpw + +> E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +| 字段 | 值 | +|---|---| +| 内核 ID | `cpw` | +| 主模块 | `src/rfauto/core/synthesis.py`(`rfauto.core.synthesis`) | +| 计算器注册表 | 未注册(AST 无 @register_calculator 装饰器——service 直调型内核,免 #231 注册表消费者三表同步) | +| KD-1 出处注册 | 2 条(kernel_file=src/rfauto/core/synthesis.py) | +| XC-P 精度档案 | 见下方「精度域」节(机读判定) | +| 数据来源 | XC-P + KD-1 + 模块 docstring/AST + anchors.yaml + tests/service 扫描 | + +## 物理语义 + +共面波导综合(底接地 CPWG 口径):共形映射闭式 εeff/Z0 + brentq 反解线宽——合成参照系必须与真实结构同口径(#193 参照系错位教训)。 + +模块自述(docstring 首行,机读):E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +## 公式与口径 + +### CPWG 共形映射闭式(_cpwg_ri 单源) + +(口径示意(非 docstring 原式,读代码为准)) + +```latex +\bigl(\varepsilon_{\mathrm{eff}},\ Z_0\bigr)=f_{\mathrm{CPWG}}\bigl(w,\mathrm{gap},h,\varepsilon_r\bigr),\qquad w=\operatorname{brentq}_{w}\bigl[Z_0(w)-Z_{0,\mathrm{target}}\bigr] +``` + +出处:synthesize_cpw_model docstring;共形映射闭式在 core/calculators._cpwg_ri,Z0 随 w 单调递减反解后回代自洽;CALC 键 cpw_synthesis/cpw_analysis(calc_families/rf_line)同族面。 + +docstring 逐字引文(防漂移钉):"core/calculators._cpwg_ri(实测 εeff/S11 双锚校验,#198)。" + +### #193 参照系错位教训 + +(口径示意(非 docstring 原式,读代码为准)) + +```latex +Z_0^{\mathrm{CPW_{open}}}\ne Z_0^{\mathrm{CPWG}}\;\Rightarrow\;\text{无地口径合成线在真实接地结构中失配} +``` + +出处:synthesize_cpw_model docstring #193 节(在真实结构里失配的具体量化同节)。 + +docstring 逐字引文(防漂移钉):"必须同口径(#193 参照系错位教训:skrf CPW 无地口径合成的 50Ω 线" + +### KD-1 出处注册(`src/rfauto/core/synthesis.py`,knowledge/formula_provenance.yaml 过滤) + +命中 **2** 条: + +| formula_id | symbol | kind | source_doi | refs | +|---|---|---|---|---| +| synthesis:chebyshev_lpf_g_values:01 | chebyshev_lpf_g_values | pointer | — | — | +| synthesis:patch_rin_edge_balanis:01 | patch_rin_edge_balanis | source | — | — | + +## 精度域(XC-P 精度档案) + +**未收录**:XC-P 首批建档内核共 **10** 个(bounds、conductor_loss、coupled_microstrip、dielectric_extract、etch_trapezoid、high_power、ridged_waveguide、shield_cavity_mode、synthesis.forward_z0、thermal_iteration),不含 `cpw`。因此: + +- 典型偏差分档:**UNVERIFIED**(无档案即无分档;本卡不编造任何精度数字——铁律 7 / #122 如实标注); +- 域判查询:`core/precision_profiles.py` 对未知 kernel 如实降级(收集器=`tests/unit/test_precision_profiles.py` 逐条对照防漂移); +- 建档入口:precision_profiles.yaml 增键(schema 见该文件头)+ `KERNEL_MODULES` 映射 + 模块 docstring 末尾「精度档案」镜像行 + 重跑本生成器。 + +> 本节为机读聚合:XC-P 收录状态与键清单构建时实测;本内核建档后此节自动展开为分档表(渲染支路已备)。 + +## 使用边界 + +- gap 固定参与反解存在性——越界显式报错,不做静默延拓。 + - docstring 逐字引文:"Z0 随 w 单调递减;brentq 反解后回代自洽。gap 为固定参数" + +## 代码入口 + +主入口(file:symbol,AST 校验存在): + +- `src/rfauto/core/synthesis.py:synthesize_cpw_model` + +src/rfauto/core/synthesis.py 公开符号 **43** 个(AST 机读): + +`Stackup`、`ForwardMedia`、`forward_media`、`forward_z0`、`inverse_width`、`nominal_width_mm`、`lossless_width_mm`、`SynthesisResult`、`synthesize_mline`、`synthesize_batch`、`ModelSynthesisResult`、`synthesize_wilkinson`、`synthesize_branchline`、`patch_fringing_delta_l`、`patch_rin_edge_balanis`、`patch_cavity_metrics`、`synthesize_patch`、`synthesize_mline_model`、`synthesize_cpw_model`、`synthesize_dipole_model`、`synthesize_wstep_model`、`synthesize_tjunc_model`、`synthesize_bend_model`、`synthesize_via_model`、`synthesize_atten_pi_model`、`synthesize_atten_t_model`、`synthesize_ratrace_model`、`synthesize_gysel_model`、`synthesize_stripline_model`、`synthesize_cps_model`、`synthesize_suspended_stripline_model`、`synthesize_msl_cpw_model`、`synthesize_siw_model`、`synthesize_msl_siw_taper_model`、`synthesize_sma_launcher_model`、`synthesize_bpf_model`、`hairpin_design_from_order`、`synthesize_hairpin_model`、`chebyshev_lpf_g_values`、`synthesize_multisection_quarter_wave`、`synthesize_nway_wilkinson`、`schiffman_delta_phase`、`synthesize_schiffman` + +消费面(service/adapters 引用扫描,机读): + +- service:`src/rfauto/service/anchor_family_service.py` +- service:`src/rfauto/service/diagram_stackup_service.py` +- service:`src/rfauto/service/em_bench_service.py` +- service:`src/rfauto/service/even_odd_service.py` +- service:`src/rfauto/service/kicad_em_service.py` +- service:`src/rfauto/service/level2_design.py` +- service:`src/rfauto/service/meep_sampling.py` +- service:`src/rfauto/service/package_chain_service.py` +- service:`src/rfauto/service/qucsator_service.py` +- service:`src/rfauto/service/teaching_service.py` +- service:`src/rfauto/service/unit_convert_service.py` +- adapters:`src/rfauto/adapters/comsol_adapter.py` +- adapters:`src/rfauto/adapters/edb_templates/schema.py` +- adapters:`src/rfauto/adapters/fake_adapter/adapter.py` +- adapters:`src/rfauto/adapters/fake_adapter/antenna_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/coupler_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/filter_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/tl_family.py` +- adapters:`src/rfauto/adapters/layout_generator.py` +- adapters:`src/rfauto/adapters/meep_adapter.py` +- adapters:`src/rfauto/adapters/oe_templates/_nominal_width.py` +- adapters:`src/rfauto/adapters/oe_templates/closedform.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c3.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c4.py` +- adapters:`src/rfauto/adapters/oe_templates/render_coupled_bpf.py` +- adapters:`src/rfauto/adapters/oe_templates/render_diplexer_ridged.py` +- adapters:`src/rfauto/adapters/oe_templates/render_hairpin.py` +- adapters:`src/rfauto/adapters/oe_templates/render_phase_qwt.py` +- adapters:`src/rfauto/adapters/oe_templates/render_sicl_nway.py` +- adapters:`src/rfauto/adapters/oe_templates/render_siw.py` +- adapters:`src/rfauto/adapters/oe_templates/render_ta_wave_c.py` +- adapters:`src/rfauto/adapters/qucsator_adapter.py` + +## 锚与测试入口 + +analytic-anchor(knowledge/anchors.yaml 机读命中): + +| anchor_id | quantity | +|---|---| +| `c3.k_of_g.openems-hfss-v1` | k_of_g | +| `mline.z0_ohm.closedform-v1` | mline_z0_ohm | +| `ratrace.r_ring_mm.closedform-v1` | ratrace_r_ring_mm | +| `ratrace.ring_z_ohm.closedform-v1` | ratrace_ring_z_ohm | +| `schiffman.delta_phase.closedform-v1` | schiffman_delta_phase_deg | + +判据书/规格指针(docstring 逐字引文钉): + +- `src/rfauto/core/calculators.py`——引文:"在真实结构里是 18Ω,|S11| 卡 −6.5dB)。共形映射闭式见" + +测试面(tests/unit 引用扫描,机读;合计 **1642** 个 test 函数): + +| 测试文件 | test 函数数 | +|---|---| +| `tests/unit/test_a3c_coupled_interdigital.py` | 20 | +| `tests/unit/test_anchd_analytic_anchors.py` | 7 | +| `tests/unit/test_anchors_correction.py` | 30 | +| `tests/unit/test_aniso_separation.py` | 7 | +| `tests/unit/test_array_templates.py` | 25 | +| `tests/unit/test_atten_pi_template.py` | 10 | +| `tests/unit/test_atten_t_template.py` | 9 | +| `tests/unit/test_audit_fix_core_visibility.py` | 15 | +| `tests/unit/test_bend_template.py` | 7 | +| `tests/unit/test_cal_wizard.py` | 37 | +| `tests/unit/test_calculators.py` | 49 | +| `tests/unit/test_coupled_bpf_template.py` | 34 | +| `tests/unit/test_coupling_matrix.py` | 52 | +| `tests/unit/test_cps_template.py` | 20 | +| `tests/unit/test_cpw_template.py` | 11 | +| `tests/unit/test_diplexer_ridged_templates.py` | 28 | +| `tests/unit/test_dipole_template.py` | 7 | +| `tests/unit/test_edb_templates.py` | 25 | +| `tests/unit/test_edb_templates_ext.py` | 38 | +| `tests/unit/test_eep_templates.py` | 19 | +| `tests/unit/test_engine_benchmark_expand_golden.py` | 25 | +| `tests/unit/test_gysel_template.py` | 15 | +| `tests/unit/test_hairpin_alt_template.py` | 26 | +| `tests/unit/test_hairpin_kgap_correction.py` | 16 | +| `tests/unit/test_hairpin_template.py` | 37 | +| `tests/unit/test_impedance_drc.py` | 27 | +| `tests/unit/test_interdigital_template.py` | 31 | +| `tests/unit/test_level2_design.py` | 62 | +| `tests/unit/test_marchand_two_section.py` | 22 | +| `tests/unit/test_marchand_via_ab.py` | 18 | +| `tests/unit/test_materials_loader.py` | 15 | +| `tests/unit/test_meep_adapter.py` | 38 | +| `tests/unit/test_mf_synthesis.py` | 33 | +| `tests/unit/test_mline_template.py` | 7 | +| `tests/unit/test_msl_cpw_template.py` | 19 | +| `tests/unit/test_msl_siw_taper_template.py` | 15 | +| `tests/unit/test_mtrl_kit_kicad.py` | 16 | +| `tests/unit/test_oe_phase3_driver.py` | 42 | +| `tests/unit/test_package_chain.py` | 37 | +| `tests/unit/test_patch_feed_offset_unification.py` | 6 | +| `tests/unit/test_pk2_vertical_lit_and_wiring.py` | 10 | +| `tests/unit/test_port_renormalize.py` | 14 | +| `tests/unit/test_qucsator_adapter.py` | 35 | +| `tests/unit/test_qw10_qw11.py` | 14 | +| `tests/unit/test_ratrace_template.py` | 19 | +| `tests/unit/test_rf_matrix_branchline.py` | 53 | +| `tests/unit/test_ring_resonator_template.py` | 25 | +| `tests/unit/test_rp1_myj_sec4_05_prototype.py` | 6 | +| `tests/unit/test_rp1_pozar_patch_example.py` | 3 | +| `tests/unit/test_rules_verify.py` | 6 | +| `tests/unit/test_schiffman_qwt_templates.py` | 26 | +| `tests/unit/test_sensanc_analytic_anchors.py` | 11 | +| `tests/unit/test_shell_below_service_ratchet.py` | 3 | +| `tests/unit/test_sicl_nway_templates.py` | 26 | +| `tests/unit/test_siw_template.py` | 26 | +| `tests/unit/test_sma_launcher_template.py` | 22 | +| `tests/unit/test_stackup_diagram.py` | 39 | +| `tests/unit/test_stepped_coupled_line_specs.py` | 8 | +| `tests/unit/test_stripline_template.py` | 12 | +| `tests/unit/test_suspended_stripline_template.py` | 19 | +| `tests/unit/test_symbolic_fit.py` | 15 | +| `tests/unit/test_synthesis.py` | 14 | +| `tests/unit/test_synthesis_bpf_asym_tz.py` | 8 | +| `tests/unit/test_synthesis_bpf_polish_backsub.py` | 8 | +| `tests/unit/test_synthesis_multisection.py` | 31 | +| `tests/unit/test_synthesis_patch_anchor.py` | 16 | +| `tests/unit/test_tjunc_template.py` | 8 | +| `tests/unit/test_unit_convert_service.py` | 13 | +| `tests/unit/test_varactor.py` | 26 | +| `tests/unit/test_varactor_bpf_template.py` | 12 | +| `tests/unit/test_via_template.py` | 7 | +| `tests/unit/test_w1s3_lange_stepped.py` | 11 | +| `tests/unit/test_w3s11_ring.py` | 12 | +| `tests/unit/test_w3s15_analytic_anchors.py` | 7 | +| `tests/unit/test_w4_a_sm_core.py` | 21 | +| `tests/unit/test_w4_w4e_anchors.py` | 10 | +| `tests/unit/test_w4s15_anchor_batch.py` | 11 | +| `tests/unit/test_w6_d_so_leftovers.py` | 32 | +| `tests/unit/test_w6_f_anchors_cpw.py` | 7 | +| `tests/unit/test_width_single_source.py` | 11 | +| `tests/unit/test_wilkinson_synthesis_semantics.py` | 7 | +| `tests/unit/test_wstep_template.py` | 8 | +| `tests/unit/test_x5_analytic_anchors.py` | 13 | + +XC-P 精度档案收集器(防漂移对照面):`tests/unit/test_precision_profiles.py`;本卡保鲜门:`tests/unit/test_kernel_cards.py`。 + +## 关联 + +- [架构与方法论(锚体系/判据先行)](../architecture/methodology.md) +- [分层架构](../explanation/layered-architecture.md) +- [计算器注册表](../reference/calculators.md)——本内核的注册状态见元数据表 +- 同批内核卡:[macromodel](macromodel.md)、[rwg_mmt](rwg_mmt.md)、[pdn](pdn.md)、[pce](pce.md)、[cascade](cascade.md)、[mline](mline.md)、[wilkinson](wilkinson.md)、[branchline](branchline.md)、[ratrace](ratrace.md)、[patch](patch.md)、[hairpin](hairpin.md)、[slotline](slotline.md)、[coupled_microstrip](coupled_microstrip.md)、[finline](finline.md)、[wilkinson_unequal](wilkinson_unequal.md)、[atten_pi](atten_pi.md)、[atten_t](atten_t.md)、[qwt_multisection](qwt_multisection.md)、[nway_wilkinson](nway_wilkinson.md)、[schiffman](schiffman.md)、[bethe_hole_coupler](bethe_hole_coupler.md)、[gysel_core](gysel_core.md)、[coupled_line_bpf](coupled_line_bpf.md)、[lange](lange.md)、[stepped_impedance](stepped_impedance.md)、[ring_resonator](ring_resonator.md)、[mixer_conversion](mixer_conversion.md)、[ruthroff_balun](ruthroff_balun.md)、[gd_equalizer](gd_equalizer.md)、[measurement_drift](measurement_drift.md)、[agc_loop](agc_loop.md)、[cal_kit_verify](cal_kit_verify.md)、[six_port](six_port.md)、[iss_on_wafer](iss_on_wafer.md)、[source_power_cal](source_power_cal.md)、[combline](combline.md)、[cps](cps.md)、[interdigital](interdigital.md)、[siw](siw.md)、[slot](slot.md)、[stripline](stripline.md)、[suspended_stripline](suspended_stripline.md)、[dipole](dipole.md)、[helix](helix.md)、[link_limits](link_limits.md)、[fec_codes](fec_codes.md)、[directional_bridge](directional_bridge.md)、[rf_switch](rf_switch.md)、[kuroda_identities](kuroda_identities.md)、[pll_lock_time](pll_lock_time.md)、[multisection_coupler](multisection_coupler.md)、[itu_link](itu_link.md)、[link](link.md)、[dgs](dgs.md)、[if_digitizer](if_digitizer.md)、[wg_dielectric_window](wg_dielectric_window.md)、[waveguide_closed_form](waveguide_closed_form.md)、[waveguide_iris](waveguide_iris.md)、[hybrid_junction](hybrid_junction.md)、[radar_eq](radar_eq.md)、[modulation_ber](modulation_ber.md)、[coax_line](coax_line.md)、[analog_modulation](analog_modulation.md)、[si_ctle](si_ctle.md)、[propagation](propagation.md)、[hf_skywave](hf_skywave.md)、[fmcw_radar](fmcw_radar.md)、[sar_geometry](sar_geometry.md)、[gnss_geometry](gnss_geometry.md)、[radar_clutter](radar_clutter.md)、[microstrip_disc](microstrip_disc.md)、[open_wire_line](open_wire_line.md)、[wg_cavity_bpf](wg_cavity_bpf.md) diff --git a/external_plugins/rfauto/skills/rfauto-cpw/references/pitfalls.md b/external_plugins/rfauto/skills/rfauto-cpw/references/pitfalls.md new file mode 100644 index 00000000..ca86e266 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-cpw/references/pitfalls.md @@ -0,0 +1,26 @@ +# rfauto cpw · failure-mode playbook + +> Extracted verbatim from the capability card「失败模式坑账链」section (docs/capability_cards/cpw.md; deterministic +> regeneration). Pit numbers (#NNN) are rfauto DEVLOG ledger +> markers. Symptom → pitfall chain → disposition; open this file +> when a run shows one of the listed symptoms. + +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-cpw/scripts/verify_output.py b/external_plugins/rfauto/skills/rfauto-cpw/scripts/verify_output.py new file mode 100644 index 00000000..1061fde6 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-cpw/scripts/verify_output.py @@ -0,0 +1,97 @@ +"""Deterministic output verifier for the rfauto cpw skill package. + +Structural checks only — zero physics claims (rfauto rule 7: numbers come +from the rfauto kernel or the card files in references/, never from this +script or from model memory): + + 1. every --json file parses as JSON and contains no non-finite floats + (NaN/Infinity anywhere in the document); + 2. each --expect KEY=VALUE: KEY exists in the JSON, is a finite number, + and abs(value - VALUE) <= --tol (default 1e-3). + +Pass KEY/VALUE pairs only from rfauto kernel output or from the card files +in references/. Exit codes: 0 = all checks pass; 1 = any check fails. +Report FAIL as FAIL (rfauto rule #122); never retry a FAIL into green. +""" +from __future__ import annotations + +import argparse +import json +import math +import sys + + +def _non_finite_paths(node, prefix="$"): + bad = [] + if isinstance(node, float) and not math.isfinite(node): + bad.append(prefix) + elif isinstance(node, dict): + for key, value in node.items(): + bad += _non_finite_paths(value, prefix + "." + str(key)) + elif isinstance(node, list): + for i, value in enumerate(node): + bad += _non_finite_paths(value, prefix + "[" + str(i) + "]") + return bad + + +def main(argv=None): + parser = argparse.ArgumentParser( + description="Structural verifier for saved rfauto JSON output.") + parser.add_argument("--json", action="append", required=True, + help="saved rfauto kernel JSON (repeatable)") + parser.add_argument("--expect", action="append", default=[], + help="KEY=VALUE numeric cross-check (repeatable)") + parser.add_argument("--tol", type=float, default=1e-3) + args = parser.parse_args(argv) + + failures = [] + for path in args.json: + try: + with open(path, encoding="utf-8") as handle: + raw = handle.read() + except OSError as exc: + failures.append(path + ": unreadable (" + str(exc) + ")") + continue + try: + data = json.loads(raw) + except ValueError as exc: + failures.append(path + ": not JSON (" + str(exc) + ")") + continue + for where in _non_finite_paths(data): + failures.append(path + ": non-finite float at " + where) + if not isinstance(data, dict): + failures.append(path + ": top-level JSON is not an object") + continue + for spec in args.expect: + key, sep, value = spec.partition("=") + if not sep: + failures.append( + path + ": bad --expect " + repr(spec) + " (want KEY=VALUE)") + continue + if key not in data: + failures.append(path + ": missing key " + repr(key)) + continue + try: + got = float(data[key]) + except (TypeError, ValueError): + failures.append(path + ": key " + repr(key) + " not numeric") + continue + if not math.isfinite(got): + failures.append(path + ": key " + repr(key) + " non-finite") + continue + want = float(value) + if abs(got - want) > args.tol: + failures.append( + path + ": " + key + "=" + repr(got) + " vs expected " + + repr(want) + " (tol " + repr(args.tol) + ")") + if failures: + for line in failures: + print("FAIL " + line) + return 1 + print("PASS " + str(len(args.json)) + " file(s), " + + str(len(args.expect)) + " expectation(s)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/external_plugins/rfauto/skills/rfauto-mcp-navigator/SKILL.md b/external_plugins/rfauto/skills/rfauto-mcp-navigator/SKILL.md new file mode 100644 index 00000000..30e4ff46 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-mcp-navigator/SKILL.md @@ -0,0 +1,65 @@ +--- +name: rfauto-mcp-navigator +description: >- + 导航并驱动 RFAuto(rfauto)射频/微波 EDA 框架的 208 个 MCP 工具。用户要综合或仿真射频器件(滤波器、耦合器、功分器、天线、电感等)、创建或轮询仿真 run、读取 S 参数指标、调参优化,或核对仿真结果是否可信时使用。触发词:rfauto、射频、微波、功分器、滤波器、耦合器、天线、S 参数、仿真、调参、synthesis、simulate。物理数字只能来自 rfauto 确定性内核,不由模型生成。 +--- + +# rfauto MCP 导航(按需展开) + +## 铁律 7(先读) + +频率、损耗、尺寸、S 参数这些物理数字,一律来自 rfauto 确定性内核或求解器的工具返回值。你负责编排工具调用、读懂返回信封、如实转述。想估算某个物理量时,不要自己算,改为调用对应的工具,例如 `synthesize`、`run_calculator`、`create_run_async`。 + +## 工具面约定 + +- 工具名形如 `mcp__plugin_rfauto_rfauto__`。服务器共注册 208 个工具,完整列表用 `tools/list` 获取。分组目录见 [references/toolsets.md](references/toolsets.md)。 +- 工具返回统一信封:`{ok: bool, data: ...}`,失败时为 `{ok: false, error: ...}`。体检类工具的业务结论(例如 verdict=FAIL)写在 data 里。`ok=false` 只表示调用失败,或门判了 FAIL。读字段,别只看 ok。 +- 会话开工第一步:调用 `doctor`(无参数,秒级返回),确认环境和可用通道。 +- 资源:工具集目录是 `rfauto://toolsets/definition`。7 张器件卡以 `skill://<卡名>/SKILL.md` 暴露,卡内参考文件经 `skill://<卡名>/references/` 读取。 + +## 常用工具(插件精选 18 个) + +上游没有官方的高频清单。下表是本插件挑选的常用工具,不是上游定义。其余工具见 references/toolsets.md。 + +| 生命周期 | 工具 | 用途 | +|---|---|---| +| 体检 | `doctor` | 盘点 AEDT、ADS 等通道的环境,无许可的流程不受影响 | +| 体检 | `list_models` | 已注册的器件模型和模板族 | +| 体检 | `validate_recipe` | 校验配方 YAML:文件、结构、模板、键名、单位和目标。建 run 之前必须先调 | +| 求解 | `create_run_async` | 发起仿真作业(异步,长时间运行的首选) | +| 求解 | `poll_job` / `wait_job` | 轮询或等待作业。`wait_job` 默认等待 600 秒,长作业请显式传 `timeout_s` | +| 求解 | `get_metrics` | 读取 run 指标(s11、s21、iso 等,机器可读) | +| 求解 | `get_run_artifacts` | 列出 run 产物(Touchstone、manifest、报告) | +| 求解 | `compare_runs` | 跨 run 对比 | +| 综合 | `synthesize` | 器件综合,用闭式物理给出初始尺寸 | +| 综合 | `synthesize_bpf` | 带通滤波器综合 | +| 综合 | `run_calculator` | 确定性物理计算器(默认可见 340 个键)。任何闭式量先查这里 | +| 判读 | `runs_verify` | 产物新鲜度:fresh / stale / legacy / error。采信前必须调 | +| 判读 | `em_doctor_check` | 建模期端口语义体检。16 项中已实装 10 项,其余 6 项返回 SKIP | +| 判读 | `em_metrics_from_run` | 从 run 提取器件指标(L/Q/SRF/S21,另有 C/R) | +| 判读 | `em_diff_runs` | 两个 run 的对拍(params、manifest、sparams、freshness 四节) | +| 判读 | `explain_run` | 对失败给出确定性规则面的解释 | +| 判读 | `diagnose` | run 诊断 | + +## 三个工作流模式 + +1. **综合 → 仿真 → 判读**:synthesize → validate_recipe → create_run_async → poll_job → get_metrics → runs_verify,不放心时再用 explain_run。配方模板从 `list_template_specs` 查起。 +2. **判读既有结果**(不确定能不能信):直接用 rf-verdict 技能(从 `runs_verify` 起手),或派发 `rf-judge` 子代理。 +3. **调参闭环**:配方的 objectives 就绪后调用 `start_tune`,拿到作业号后 `poll_job`,再 `get_metrics`。调参结果的修正只用 rfauto 确定性工具,不要自己编数值。 + +## 引擎阶梯纪律(必须转述给用户) + +- `fake` 通道是闭式解析近似,秒级返回,无需许可,只用来验证配方和管线。**不要用 fake 的数字下物理结论。** +- `openems`(开源 FDTD,需自行从源码编译)是扫描和校准的主力;`hfss`、`ads` 是商用通道,用来仲裁和终验。 +- 每层只做它能证明的事。跨引擎仲裁看 `em_diff_runs`,以及锚注册表(`anchors_list` / `anchors_inspect`)。 + +## 全集发现(按需,别一次读完) + +208 个工具中,124 个归入 14 个工具集(见 [references/toolsets.md](references/toolsets.md)),每个工具集附调用纪律和坑号出处。其余 84 个工具未归入任何工具集,用 `tools/list` 查看。遇到不熟的领域(EMC、PDN、UQ、数据平台、格式解析、KiCad、远程多机等),先读对应小节。 + +## 反模式(禁止) + +- 不要用常识"补算"工具没有给出的物理数字。 +- 不要跳过 `validate_recipe` 直接建 run,也不要采信未通过 `runs_verify` 的产物。 +- 不要把 `ok=false` 的信封当成功转述。 +- 工具找不到时,先调 `doctor` 看环境。只剩 `rf_env_doctor` 时,说明服务器未能启动(插件诊断模式),按它的报告修复。不要凭记忆编造工具名。 diff --git a/external_plugins/rfauto/skills/rfauto-mcp-navigator/references/toolsets.md b/external_plugins/rfauto/skills/rfauto-mcp-navigator/references/toolsets.md new file mode 100644 index 00000000..825836be --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-mcp-navigator/references/toolsets.md @@ -0,0 +1,197 @@ +# rfauto MCP 工具集目录(14 集) + +> 由 `rfauto knowledge/toolsets.yaml`(schema rfauto-toolsets-v1)生成; +**成员名单以 MCP 注册面为准**,此处 tools_hint 为导航启发。 +每个工具集的 `skill` 字段是该域的调用时序纪律(含坑号出处)——进入 +不熟的域之前先读对应小节。 + +## platform_lifecycle + +平台生命周期——环境体检/模型与模板目录/配方校验/战役计划面 + +提示成员: `doctor`, `list_models`, `validate_recipe`, `list_template_specs`, `list_calculators`, `run_calculator`, `get_model_3d`, `draft_recipe_from_spec`, `plan_campaign`, `get_campaign_status`, `save_campaign_plan`, `multi_agent_run` + +**调用纪律**: + +会话开工先 doctor 探环境(对应官方 lifecycle 工具集 check_aedt_installed 的 +同位语义);配方改动先 validate_recipe 过三层 Gate 再建 run(#317 配方写 +守卫:UI 表单整文档回写是污染源);战役先 plan_campaign 冻结全参数再放量 +(#253 探针不带全参数会撞不可变校验);模板目录先 list_template_specs 再 +draft_recipe_from_spec(登记行只作线索不作现状,#222)。 + +## simulation_runs + +求解作业生命周期——创建/轮询/取消/指标读取/工件对账/战役执行 + +提示成员: `create_run`, `create_run_async`, `poll_job`, `wait_job`, `cancel_job`, `get_metrics`, `get_run_artifacts`, `run_monitor`, `run_campaign`, `compare_runs` + +**调用纪律**: + +先 doctor 探环境再 create_run;轮询用 poll_job(前台长跑 wait_job 需显式超时, +竞态完成的真结果要接受,见 #145);run 结束先 explain_run/run_monitor 看门再 +get_metrics;判 run 真伪看 meta.json 的 adapter/study 字段(#144);战役类走 +run_campaign 内部 executor(零 shell 出,VI-2);跨 run 对比用 compare_runs。 + +## hfss_arbitration + +HFSS 真机求解与跨引擎仲裁(HFSS 结果为对齐基准) + +提示成员: `read_hfss_touchstone_comments`, `marchand_balun_design`, `marchand_two_section_synthesis`, `msl_slot_transition_design`, `slotline_analysis`, `slotline_synthesis`, `certify_design` + +**调用纪律**: + +HFSS 结果为对齐基准(A220);真机异常第一时间查官方文档再改模型(A216, +#191 波端口尺寸实证)。仲裁前先验收敛——ΔS 达标不等于关键标量收敛,做 +阶梯看饱和(#335);薄片导电用 assign_perfecte_to_sheets 而非 pec 盒(#356); +unite 后只引用首对象名(#285);pyaedt 退出必 release_desktop,防孤儿 +ansysedt 占轨(#265)。Touchstone 读回先 read_hfss_touchstone_comments +看注释块口径。 + +## openems_fdtd + +openEMS/FDTD 渲染守卫与真机求解 + +提示成员: `mmt_solve`, `render_constraint_check`, `dispersion_report` + +**调用纪律**: + +网格构建末尾必做最小间距守卫,防 CFL 时间步塌缩(#152);FC 窗要覆盖脉冲 +全程,max|S11| 大于 1 先查截断再疑物理(#262/#266);跨 Run 绑定对象禁复用, +多端口走进程隔离单激励(#208);柱坐标不支持 MUR、一律 PML_8(#232);预算 +外推看 port_ut 末行时间轴,et 文件 mtime 停止不等于卡死(#268/#323);旋钮 +效力断言必须在同参最终网格上做(#368)。渲染约束先过 render_constraint_check。 + +## synthesis_design + +射频综合设计面——滤波器/功分器/链路预算/交调/NFC 线圈 + +提示成员: `synthesize`, `synthesize_bpf`, `budget_analysis`, `cascade_budget`, `spur_search`, `if_plan_sweep`, `nfc_coil_synthesize`, `nfc_coil_q`, `nfc_coil_evaluate` + +**调用纪律**: + +线宽与名义几何一律 skrf HJ 综合精算(core/synthesis.py),禁沿用其他模型或 +文档的毫米数(AGENTS 规则 1c;#252 名义臂长手算捷径致谐振负偏一成);合成 +产物先 validate_recipe 过三层 Gate 再真跑;预算/交调用 budget_analysis 与 +spur_search(ADS 侧同源核对走 compose_netlist)。 + +## calibration_optimization + +校准/优化闭环——采样/提案/确定性批判/自动调参/暖启动 + +提示成员: `rf_run_sampler`, `rf_propose_params`, `rf_critique_point`, `rf_spec_cost`, `warm_start_optimize`, `autotune_self_verify`, `self_heal_run`, `robustness_report` + +**调用纪律**: + +LLM 永不产生物理数字,数值只在确定性内核(铁律 7);批判/修正走 +rf_critique_point 等 service 确定性函数;同种子重跑秒回是缓存合法、新轨迹 +换 study 或 seed(#158);warm-start 历史集上界剔除阈值必须等于判据同款 +target(#273);自治环 critique 结果先过 autotune_self_verify 再采信。 + +## measurement_correlation + +测量互证与相关性——VNA/NF 测量/带限查询/跨通道对拍 + +提示成员: `correlate_measurement`, `vna_en_report`, `vna_offline_replay`, `nfmeas_cut_view`, `nfmeas_ffs_info`, `bands_list`, `bands_find`, `bands_get`, `bands_spec_bounds`, `bands_env_list`, `bands_env_find`, `bands_env_get`, `bands_env_points`, `bands_env_uq_axis`, `bands_env_delta_t` + +**调用纪律**: + +跨适配器比较先统一单位并显式归一,空交集会静默通过(#121);频轴对齐用 +最近邻加 ulp 容差,禁 searchsorted 越位(#287/#294);深谐振谷族的 dB 域 +判据换线性域幅值或加 eps 锚(#370/#371);测量侧入口 correlate_measurement, +ENR/离线回放走 vna 系,近场走 nfmeas 系,带限查询先 bands_list 再 bands_find, +环境扫与规格界走 bands_env 系与 bands_spec_bounds。 + +## knowledge_diagnostics + +知识总线与诊断——坑账检索/失败指纹/锚点/指南/解释 + +提示成员: `search_knowledge`, `get_guidelines_for`, `error_hints_lookup`, `explain_run`, `diagnose`, `rag_query`, `rag_explain`, `anchors_list`, `anchors_inspect` + +**调用纪律**: + +动手前先检索坑账(pitfalls_index 加 playbook 指纹加 rules 三源,本工具集的 +get_guidelines_for 与 search_knowledge 同走确定性检索);诊断规则只收症状可 +机器观测的确定性指纹(playbook 设计约束,无检测器支撑的坑不硬塞,#122 哲学); +观测工具自身失真会掩盖真实 tag(#331:审计 dump 打印 tag 原文);坑号是 +Devlog 出处标记(D1 裁决保留口径);锚点查证走 anchors_list 与 +anchors_inspect,环境体检先 `rfauto doctor`。 + +## layout_kicad + +KiCad 版图面——提取/CPW 优化/远场联动 + +提示成员: `kicad_extract`, `kicad_optimize_cpw`, `farfield_runs`, `farfield_view` + +**调用纪律**: + +KiCad 一律子进程调用自带 Python 3.11(AGENTS 规则 2,ABI 硬限制,项目 venv +禁 import pcbnew);zone 自有多边形一律 AppendCorner 写入(#220 SWIG 归属 +陷阱);层 id 禁写死数值(#210 族重排);远场联动产物对账走 farfield_runs +与 farfield_view。 + +## remote_multihost + +远程多机协同——探活/状态/队列(lab_server 通道) + +提示成员: `remote_probe_machine`, `remote_machine_status` + +**调用纪律**: + +服务器侧版本必须等于本机(AGENTS 规则 0,gRPC 客户端-服务端版本配对); +先 remote_probe_machine 探活、remote_machine_status 看队列再发射;任务毕 +必清理(杀 ansysedt 删 schtasks,remote_hfss_cleanup);发射后存活复核, +隐藏形态进程易被杀毒静默击杀(#157 家族);中间文件只落服务器工作盘, +禁写生产云盘。 + +## uq_robustness + +不确定性与稳健性——良率/设计中心/温度带/稀有失效 + +提示成员: `uq_yield_at`, `uq_design_center`, `uq_temperature_zone`, `uq_rare_yield` + +**调用纪律**: + +Saltelli 一阶估计量先对目标做常数居中,防大数相减失效(#234);判据统计量 +必须匹配响应形态——窄带谐振器件带内 max 是常数陷阱,谷深语义走显式指标名 +s11_db_min(#195);新器件族接校准前先离线小样本验证 cost 分布非退化; +稀有失效走 uq_rare_yield 重要抽样。 + +## signals_integrity + +信号/电源完整性——SI 通道/PDN/EMC/ADC 预算/编织偏斜 + +提示成员: `si_channel_report`, `pdn_analyze`, `pdn_gate`, `pdn_select`, `emc_cispr_band_params`, `emc_cispr_detect`, `emc_ground_spacing_check`, `emc_cm_radiated_budget`, `adc_interleave_spurs`, `jitter_budget_snr`, `com_pam4_run`, `weave_skew_estimate`, `weave_style_info`, `cm_cat_critique`, `cm_diagnose_q`, `cm_extract_refine` + +**调用纪律**: + +跨适配器与跨域比较先统一单位并显式归一,空交集会静默通过(#121);判据 +统计量必须匹配响应形态(#195,深谐振谷族 dB 域病态换线性域口径 #370); +PDN 门/分域预声明先行(W4 批 MS-3 口径:预声明门错了也如实记 FAIL 不事后 +改门,#122);EMC 检波器/辐射预算走 emc 系确定性内核,零 LLM。 + +## data_platform + +数据平台——工作目录导入/数据集查询/导出/标注/湖仓 + +提示成员: `discover_workdir_runs`, `import_workdir_runs`, `list_datasets`, `query_dataset`, `dataset_annotate_ground_truth`, `dataset_coverage`, `dataset_export_hf`, `dataset_set_visibility`, `import_solid_payload`, `lake_pack_campaign`, `lake_query_runs`, `db_init`, `db_migrate`, `db_query`, `db_status`, `db_reindex_runs`, `db_analytics_attach` + +**调用纪律**: + +工作目录产物导入三坑先读(#320 键路径优先级 params 大于 calib_params 大于 +design_params;#321 多曲线目录显式引用归属,只比文件名会张冠李戴;#322 +study_name 置空会跨战役折叠);先 discover_workdir_runs 干跑核对再 +import_workdir_runs 放量(#251 新战役先跑 1 点 ingest 核对成行);query_dataset +的行数语义先实测一次返回再当总数消费(#369)。 + +## explain_report + +解释与报告——失败解释/叙事报告/PDF 导出/清单核对 + +提示成员: `report_narrative`, `export_report_pdf`, `build_datasheet`, `fault_tree_report`, `log_digest`, `agentbench_regression`, `rationale_checklist`, `rationale_recall` + +**调用纪律**: + +文档与报告的统计数字必须代码实测,不沿用上一份(#97);校准/判读结果 +如实记 FAIL 或 PARTIAL,不凑绿(#122 学术诚信原则);失败解释先 +explain_run 走确定性规则面,叙事化走 report_narrative,落盘走 +export_report_pdf(中文图逐张目检,matplotlib CJK 字形)。 diff --git a/external_plugins/rfauto/skills/rfauto-mline-synthesis/LICENSE.txt b/external_plugins/rfauto/skills/rfauto-mline-synthesis/LICENSE.txt new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-mline-synthesis/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/external_plugins/rfauto/skills/rfauto-mline-synthesis/SKILL.md b/external_plugins/rfauto/skills/rfauto-mline-synthesis/SKILL.md new file mode 100644 index 00000000..68dc7ea0 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-mline-synthesis/SKILL.md @@ -0,0 +1,115 @@ +--- +name: rfauto-mline-synthesis +description: >- + 需要在给定基板上求微带线(mline)的线宽或阻抗时使用。例如:Rogers 4350B 0.508 mm 上的 50 欧线宽,1.1 mm 线在 2.4 GHz 下的 Z0,这条微带的 epsilon_eff;或者求 λ/4 臂长。Wilkinson、branchline、patch 馈线需要 50、70.7、35.35 欧线宽时也用。用户贴来一段 openEMS 或 HFSS 的 mline run,问 |S11| 为何非零,或怎样从 S21 相位斜率读出 epsilon_eff,同样适用。触发词:mline、microstrip、line width、impedance、Z0、epsilon_eff、stackup、微带线、线宽、阻抗、等效介电常数、λ/4 臂长、层叠。CPW、CPS、stripline、SIW(同族的 rfauto 卡)、ADS LineCalc 图形界面问题和 PCB 载流能力问题不适用本卡。数值只来自 rfauto 内核与 references/ 下的卡片文件。 +license: 完整条款见本目录 LICENSE.txt +compatibility: 需要 PATH 中可用的 rfauto 命令(公开仓源码安装:在仓根执行 pip install -e .)。闭式综合可离线运行;引擎步骤需本机装有 openEMS 或 HFSS。 +metadata: + author: rfauto + version: '1' + rfauto_card: mline + card_kind: capability+kernel + generator: rfauto.service.skill_service.card_to_skill + source_cards: docs/capability_cards/mline.md, docs_site/kernel_cards/mline.md +allowed-tools: Bash(rfauto:*) Read +--- + +# rfauto · mline + +> Generated by `rfauto.service.skill_service.card_to_skill` from the +> rfauto deterministic cards (byte-copied under `references/`); +> regeneration is idempotent. Rule 7: every number must come from the +> rfauto kernel or these cards — never from model memory, never +> invented to be helpful. + +## When this skill applies + +- 拓扑:均匀微带线(锚模板,WP2.1:校准件+引擎仲裁探针+数据工厂,单点秒-分钟级) +- f0:2.5 GHz | 端口:2 | 时长 ≤30.0 ns | 网格档:0.0 mm +- 提取口径:S11/S21 @ MSLPort 1-2(均匀线:S21 相位斜率→εeff,β 金标准(#162);|S11| 显著非零=端口/网格判废信号) +- 参数:w_mm, line_len_mm +- 基板:{"er":3.66,"h_mm":0.508} + +## Workflow (typed commands; every value comes from the kernel) + +```bash +rfauto syn mline --freq --stackup --json +rfauto syn wilkinson --f0 --z0 --stackup --json # family synthesis (per-arm epsilon_eff) +``` + +How to read the kernel JSON envelope: + +| key | meaning | act on it | +|---|---|---| +| `status` | three-state machine: ok / er_eff_fallback / needs_calibration | only ok is a design value; er_eff_fallback means epsilon_eff fell back to bulk er (lambda-based lengths are not trustworthy); needs_calibration means back-substitution missed the 0.5 ohm self-consistency band | +| `delta_z0` | back-substituted Z0 minus target | must be < 0.5 ohm for status ok | +| `er_eff_source` | provenance of epsilon_eff (ep_reff = skrf effective permittivity) | surface it verbatim; never invent an epsilon_eff | +| `width_mm` | the authoritative synthesized width for this stackup | do not copy widths from other docs or templates (single-source rule, test_width_single_source) | + +## Nominal parameters + +| 参数 | 名义值 | +|---|---| +| line_len_mm | 40.0 | +| w_mm | 1.113 | +- 名义参数来源:`docs/templates/mline/meta.yaml`(与 TEMPLATE_NOMINAL 一致性由 test_gallery_export 钉) + +## Sensitivity ranking + +- 出处=computed(幅值分数登记表 `knowledge/sensitivity_rankings.yaml`;证据 scripts/sensitivity_rankings_build.py;坏条目拒收如实降级 #105) +- 方法 central_finite_difference_elasticity | n=5 | 证据:scripts/sensitivity_rankings_build.py +| rank | 参数 | 分数 | +|---|---|---| +| 1 | w_mm | 0.622096 | +| 2 | line_len_mm | 0.0 | +- 排序=R9 commitment_order(optimization/eipu;高敏感先钉死,平局按参数名升序) + +## Judgment gates and anchors + +- 锚覆盖 5:coupled_microstrip.kj_even_domain.lit-v1、cps.gamma_er.fdref-v1、mline.z0_ohm.closedform-v1、mmt.inductive_post_b.hfss-v1、mmt.resonant_window_fres.hfss-v1(core/anchors;通配 + 专属) +- 健康门:无模板作用域专属健康门(gate 如实不判,#274 口径) +- 通用体检:求解健康度体检 G11 九因子(core/solve_health;service/health_service.health_check_run 按 run 装载产物判定) + +## Card-specific arbitration anchors + +- `mline.z0_ohm.closedform-v1`(constant/experimental;引擎对 closedform(None 仲裁)):mline_z0_ohm = 50.0 ohm;±0.05(rounding_band);证据:runs/aurora_e_w3s15 + +- Wildcard anchors from other families that also cover this card: see the「判据」section above and `references/capability_card.md`. + +## Known boundaries + +- 参数语义:w_mm=线宽(Z0 由 skrf HJ 综合定:50Ω@rogers4350b=1.113mm),line_len_mm=两端口间线长 +- 网格:mesh_resolution_mm=网格 base 覆盖(mm);0=自动 λ_sub/50(官方口径);线缘 x 向 + 端口 junction y 向 near 加密 + +- Failure-mode playbook (symptom → pitfall → fix, mline-relevant): open `references/pitfalls.md` when a run shows one of the listed symptoms. + +## Recorded kernel output (real rfauto run, captured at +generation time; ground truth for exactly this input) + +```json +{ + "delta_z0": 0.0, + "epsilon_eff": 2.853, + "er_eff_source": "ep_reff", + "freq_ghz": 2.4, + "skrf_version": "2.1.0", + "stackup": "rogers4350b_h0.508", + "status": "ok", + "width_mm": 1.1133, + "z0_actual": 50.0, + "z0_target": 50.0 +} +``` + +## When to open the reference files + +| you need | open | +|---|---| +| the full capability card (playbook, all anchors, engine precision) | `references/capability_card.md` | +| formulas, docstring pins, precision profile, code entries, test surface | `references/kernel_card.md` | +| a symptom → pitfall → fix lookup | `references/pitfalls.md` | + +## Verify before you finish + +Run `python scripts/verify_output.py --json [--expect KEY=VALUE ... --tol 1e-3]`. +FAIL is reported as FAIL (rfauto rule #122); never retry a FAIL into green. diff --git a/external_plugins/rfauto/skills/rfauto-mline-synthesis/assets/stackups.yaml b/external_plugins/rfauto/skills/rfauto-mline-synthesis/assets/stackups.yaml new file mode 100644 index 00000000..04473c13 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-mline-synthesis/assets/stackups.yaml @@ -0,0 +1,28 @@ +# Read-only subset of rfauto configs/materials.yaml for the mline skill. +# Source of truth: configs/materials.yaml (full provenance: source / verified_by in that file). +# If the user's substrate is not listed here, ask for er / h / +# tan_delta instead of guessing a key (no invented values). +materials: + rogers4350b_h0.508: + hfss_name: Rogers RO4350 (tm) + epsilon_r: 3.66 + loss_tangent: 0.0037 + thickness_mm: 0.508 + description: Rogers 4350B, 0.508mm, 2.4GHz 典型 + epsilon_r_tol_abs: 0.05 + epsilon_r_tol_source: Rogers 官方 RO4000 系列 datasheet 属性表(rogerscorp.com/advanced-electronics-solutions/ro4000-series-laminates/ro4350b-laminates,2026-09-25 + verified-web):process Dk 3.48±0.05 @10GHz/23°C(clamped stripline process specification);Design + Dk 3.66(Rogers 推荐阻抗设计名义,本条目 epsilon_r 取此值)无官方容差发布 → 制造容差半宽取 process spec ±0.05。原登记 + process Dk 3.66±0.08 与官方不符且无出处,2026-09-25 复核修正 + linewidth: + z0_50ohm_mm: 1.11 + z0_35ohm_mm: 1.87 + source: 'G0 gate: skrf MLine (HJ) + Pozar + Schneider, max dev 0.45%' + verified_by: scripts/g0_linewidth_verification.py + verified_date: 2026-09 + note: 旧值 2.20mm 实测 ~31ohm (非标称35.35ohm), -6dB plateau 部分根因 + fr4_h1.6: + hfss_name: FR4_epoxy + epsilon_r: 4.4 + loss_tangent: 0.02 + thickness_mm: 1.6 diff --git a/external_plugins/rfauto/skills/rfauto-mline-synthesis/references/capability_card.md b/external_plugins/rfauto/skills/rfauto-mline-synthesis/references/capability_card.md new file mode 100644 index 00000000..ad8f1790 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-mline-synthesis/references/capability_card.md @@ -0,0 +1,69 @@ +# 能力卡:mline + +> 由 scripts/capability_cards_export.py 离线生成(确定性输出);数据源与坑号链见文中逐条标注。 + +## 适用场景 + +- 拓扑:均匀微带线(锚模板,WP2.1:校准件+引擎仲裁探针+数据工厂,单点秒-分钟级) +- f0:2.5 GHz | 端口:2 | 时长 ≤30.0 ns | 网格档:0.0 mm +- 提取口径:S11/S21 @ MSLPort 1-2(均匀线:S21 相位斜率→εeff,β 金标准(#162);|S11| 显著非零=端口/网格判废信号) +- 参数:w_mm, line_len_mm +- 基板:{"er":3.66,"h_mm":0.508} + +## 名义参数 + +| 参数 | 名义值 | +|---|---| +| line_len_mm | 40.0 | +| w_mm | 1.113 | +- 名义参数来源:`docs/templates/mline/meta.yaml`(与 TEMPLATE_NOMINAL 一致性由 test_gallery_export 钉) + +## 敏感性排序(R9 先承诺) + +- 出处=computed(幅值分数登记表 `knowledge/sensitivity_rankings.yaml`;证据 scripts/sensitivity_rankings_build.py;坏条目拒收如实降级 #105) + +- 方法 central_finite_difference_elasticity | n=5 | 证据:scripts/sensitivity_rankings_build.py + +| rank | 参数 | 分数 | +|---|---|---| +| 1 | w_mm | 0.622096 | +| 2 | line_len_mm | 0.0 | +- 排序=R9 commitment_order(optimization/eipu;高敏感先钉死,平局按参数名升序) + +## 判据 + +- 锚覆盖 5:coupled_microstrip.kj_even_domain.lit-v1、cps.gamma_er.fdref-v1、mline.z0_ohm.closedform-v1、mmt.inductive_post_b.hfss-v1、mmt.resonant_window_fres.hfss-v1(core/anchors;通配 + 专属) +- 健康门:无模板作用域专属健康门(gate 如实不判,#274 口径) +- 通用体检:求解健康度体检 G11 九因子(core/solve_health;service/health_service.health_check_run 按 run 装载产物判定) + +## 引擎精度卡(跨引擎仲裁锚) + +- `coupled_microstrip.kj_even_domain.lit-v1`(constant/active;闭式/文献锚(无引擎对)):kj_even_domain_dev_pct = 0.66 percent;±1.0(arbitration_interval);verdict KJ_VINDICATED_J1_PASS(Elmer 三紧缝/域缘点 even −0.180%/−0.590%/−0.439% 全 J1 PASS;p2_summary.json overall=FAIL 属 HFSS 测量面非 KJ 本体,勿混淆);证据:runs/df7_kjeven +- `cps.gamma_er.fdref-v1`(formula/active;闭式/文献锚(无引擎对)):cps_gamma_er expr = 1 + 0.9014*er**-0.6361(变量:er);±0.006(relative);证据:runs/df6_dp14m1、runs/df6_dp18c9 +- `mline.z0_ohm.closedform-v1`(constant/experimental;引擎对 closedform(None 仲裁)):mline_z0_ohm = 50.0 ohm;±0.05(rounding_band);证据:runs/aurora_e_w3s15 +- `mmt.inductive_post_b.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):inductive_post_b_dev_pct = 9.224 percent;±7.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- `mmt.resonant_window_fres.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):resonant_window_f_res_dev_pct = 16.6 percent;±3.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- 数据源:`knowledge/anchors.yaml`(仲裁锚注册表,status/版本演进口径见该文件头注;本节零计算零求值) + +## 已知边界 + +- 参数语义:w_mm=线宽(Z0 由 skrf HJ 综合定:50Ω@rogers4350b=1.113mm),line_len_mm=两端口间线长 +- 网格:mesh_resolution_mm=网格 base 覆盖(mm);0=自动 λ_sub/50(官方口径);线缘 x 向 + 端口 junction y 向 near 加密 +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-mline-synthesis/references/kernel_card.md b/external_plugins/rfauto/skills/rfauto-mline-synthesis/references/kernel_card.md new file mode 100644 index 00000000..ab5b90da --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-mline-synthesis/references/kernel_card.md @@ -0,0 +1,268 @@ + + +# 内核文档卡:mline + +> E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +| 字段 | 值 | +|---|---| +| 内核 ID | `mline` | +| 主模块 | `src/rfauto/core/synthesis.py`(`rfauto.core.synthesis`) | +| 计算器注册表 | 未注册(AST 无 @register_calculator 装饰器——service 直调型内核,免 #231 注册表消费者三表同步) | +| KD-1 出处注册 | 2 条(kernel_file=src/rfauto/core/synthesis.py) | +| XC-P 精度档案 | 见下方「精度域」节(机读判定) | +| 数据来源 | XC-P + KD-1 + 模块 docstring/AST + anchors.yaml + tests/service 扫描 | + +## 物理语义 + +微带线综合主干:skrf Hammerstad-Jensen 正向算 Z0/εeff,brentq 反解线宽并回代自洽——全仓 50Ω 标称线宽与各族 λ/4 臂长的唯一计算源(XC-W 单源),εeff 通道来源与回退显式标记。 + +模块自述(docstring 首行,机读):E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +## 公式与口径 + +### 正向 HJ 模型(skrf MLine,hammerstadjensen 锁死) + +(docstring 原文转写) + +```latex +(Z_0,\ \varepsilon_{\mathrm{eff}})=\mathrm{MLine}_{\mathrm{HJ}}\bigl(w,h,\varepsilon_r,\tan\delta,\rho,\mathrm{rough}\bigr) +``` + +出处:core/synthesis.py 模块头「设计决策」节(正向锁死 model='hammerstadjensen');XC-P 精度档案 synthesis.forward_z0 已建档(行为=WARN)。 + +docstring 逐字引文(防漂移钉):"使用 skrf MLine (Hammerstad-Jensen) 模型(与 G0 验证一致)" + +### 反解(brentq 求逆 + 回代自洽断言) + +(docstring 原文转写) + +```latex +w^{*}=\operatorname{brentq}_{w}\,\bigl[Z_0(w)-Z_{0,\mathrm{target}}\bigr],\quad\bigl|Z_0(w^{*})-Z_{0,\mathrm{target}}\bigr|<0.5\,\Omega +``` + +出处:core/synthesis.inverse_width docstring;自洽阈与三态状态机(ok/er_eff_fallback/needs_calibration)见模块头「验收」节。 + +docstring 逐字引文(防漂移钉):"使用 brentq 求逆,反解结果回代正向做自洽断言。" + +### λ/4 臂长恒等式(各臂自身 εeff 口径,XA-3 迭代序) + +(docstring 原文转写) + +```latex +L_{\lambda/4}=\frac{c}{4 f_0\sqrt{\varepsilon_{\mathrm{eff}}(w_{\mathrm{arm}})}} +``` + +出处:synthesize_wilkinson docstring「闭式公式」节;XA-3 迭代序=εeff 取臂线宽自身(inverse_width→forward_z0 链),旧近似偏差量化同节在档。 + +docstring 逐字引文(防漂移钉):"arm_len = lambda/4 = c / (4 * f0 * sqrt(epsilon_eff))" + +### 锚模板三重身份(mline 锚链) + +(docstring 原文转写) + +```latex +\text{校准件}\;+\;\text{引擎仲裁探针}\;+\;\text{数据工厂} +``` + +出处:synthesize_mline_model docstring(β 金标准 #162;线宽绝不沿用文档毫米数,铁律 1c)。 + +docstring 逐字引文(防漂移钉):"锚模板三重身份:校准件 + 引擎仲裁探针(S21 相位斜率→εeff,β 金" + +### KD-1 出处注册(`src/rfauto/core/synthesis.py`,knowledge/formula_provenance.yaml 过滤) + +命中 **2** 条: + +| formula_id | symbol | kind | source_doi | refs | +|---|---|---|---|---| +| synthesis:chebyshev_lpf_g_values:01 | chebyshev_lpf_g_values | pointer | — | — | +| synthesis:patch_rin_edge_balanis:01 | patch_rin_edge_balanis | source | — | — | + +## 精度域(XC-P 精度档案) + +**未收录**:XC-P 首批建档内核共 **10** 个(bounds、conductor_loss、coupled_microstrip、dielectric_extract、etch_trapezoid、high_power、ridged_waveguide、shield_cavity_mode、synthesis.forward_z0、thermal_iteration),不含 `mline`。因此: + +- 典型偏差分档:**UNVERIFIED**(无档案即无分档;本卡不编造任何精度数字——铁律 7 / #122 如实标注); +- 域判查询:`core/precision_profiles.py` 对未知 kernel 如实降级(收集器=`tests/unit/test_precision_profiles.py` 逐条对照防漂移); +- 建档入口:precision_profiles.yaml 增键(schema 见该文件头)+ `KERNEL_MODULES` 映射 + 模块 docstring 末尾「精度档案」镜像行 + 重跑本生成器。 + +> 本节为机读聚合:XC-P 收录状态与键清单构建时实测;本内核建档后此节自动展开为分档表(渲染支路已备)。 + +## 使用边界 + +- 状态机三态(ok/er_eff_fallback/needs_calibration)全部显式下泄给消费面——回代失败与 εeff 回退两真并存时保留更严重的前者。 + - docstring 逐字引文:"④ 超限标 needs_calibration 而非静默通过" +- εeff 回退体介电常数时长度系设计不可信——来源标记(.source)随量下泄,不静默(#316 多报方向)。 + - docstring 逐字引文:"``.z0/.er_eff/.source`` 属性。εeff 回退体介电常数的通道显式见" +- XC-W 单源:历史五档 50Ω 宽字面量副本已收敛到本计算点,归档字面量只做逐位一致性钉扎(tests/unit/test_width_single_source.py)。 + - docstring 逐字引文:"「50Ω 馈线宽」缺省档的唯一计算点:inverse_width(50)@各 (εr,h,f) 即权威" +- yaml 层叠档与无耗裸层叠档两系并存是参数系不同(tanδ 是否进正向),不是同参漂移——跨档缺省有守卫。 + - docstring 逐字引文:"是参数系不同,非同参漂移,一致性测试分系钉住)。" + +## 代码入口 + +主入口(file:symbol,AST 校验存在): + +- `src/rfauto/core/synthesis.py:synthesize_mline` +- `src/rfauto/core/synthesis.py:inverse_width` +- `src/rfauto/core/synthesis.py:forward_media` +- `src/rfauto/core/synthesis.py:forward_z0` +- `src/rfauto/core/synthesis.py:nominal_width_mm` +- `src/rfauto/core/synthesis.py:lossless_width_mm` +- `src/rfauto/core/synthesis.py:synthesize_mline_model` + +src/rfauto/core/synthesis.py 公开符号 **43** 个(AST 机读): + +`Stackup`、`ForwardMedia`、`forward_media`、`forward_z0`、`inverse_width`、`nominal_width_mm`、`lossless_width_mm`、`SynthesisResult`、`synthesize_mline`、`synthesize_batch`、`ModelSynthesisResult`、`synthesize_wilkinson`、`synthesize_branchline`、`patch_fringing_delta_l`、`patch_rin_edge_balanis`、`patch_cavity_metrics`、`synthesize_patch`、`synthesize_mline_model`、`synthesize_cpw_model`、`synthesize_dipole_model`、`synthesize_wstep_model`、`synthesize_tjunc_model`、`synthesize_bend_model`、`synthesize_via_model`、`synthesize_atten_pi_model`、`synthesize_atten_t_model`、`synthesize_ratrace_model`、`synthesize_gysel_model`、`synthesize_stripline_model`、`synthesize_cps_model`、`synthesize_suspended_stripline_model`、`synthesize_msl_cpw_model`、`synthesize_siw_model`、`synthesize_msl_siw_taper_model`、`synthesize_sma_launcher_model`、`synthesize_bpf_model`、`hairpin_design_from_order`、`synthesize_hairpin_model`、`chebyshev_lpf_g_values`、`synthesize_multisection_quarter_wave`、`synthesize_nway_wilkinson`、`schiffman_delta_phase`、`synthesize_schiffman` + +消费面(service/adapters 引用扫描,机读): + +- service:`src/rfauto/service/anchor_family_service.py` +- service:`src/rfauto/service/diagram_stackup_service.py` +- service:`src/rfauto/service/em_bench_service.py` +- service:`src/rfauto/service/even_odd_service.py` +- service:`src/rfauto/service/kicad_em_service.py` +- service:`src/rfauto/service/level2_design.py` +- service:`src/rfauto/service/meep_sampling.py` +- service:`src/rfauto/service/package_chain_service.py` +- service:`src/rfauto/service/qucsator_service.py` +- service:`src/rfauto/service/teaching_service.py` +- service:`src/rfauto/service/unit_convert_service.py` +- adapters:`src/rfauto/adapters/comsol_adapter.py` +- adapters:`src/rfauto/adapters/edb_templates/schema.py` +- adapters:`src/rfauto/adapters/fake_adapter/adapter.py` +- adapters:`src/rfauto/adapters/fake_adapter/antenna_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/coupler_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/filter_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/tl_family.py` +- adapters:`src/rfauto/adapters/layout_generator.py` +- adapters:`src/rfauto/adapters/meep_adapter.py` +- adapters:`src/rfauto/adapters/oe_templates/_nominal_width.py` +- adapters:`src/rfauto/adapters/oe_templates/closedform.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c3.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c4.py` +- adapters:`src/rfauto/adapters/oe_templates/render_coupled_bpf.py` +- adapters:`src/rfauto/adapters/oe_templates/render_diplexer_ridged.py` +- adapters:`src/rfauto/adapters/oe_templates/render_hairpin.py` +- adapters:`src/rfauto/adapters/oe_templates/render_phase_qwt.py` +- adapters:`src/rfauto/adapters/oe_templates/render_sicl_nway.py` +- adapters:`src/rfauto/adapters/oe_templates/render_siw.py` +- adapters:`src/rfauto/adapters/oe_templates/render_ta_wave_c.py` +- adapters:`src/rfauto/adapters/qucsator_adapter.py` + +## 锚与测试入口 + +analytic-anchor(knowledge/anchors.yaml 机读命中): + +| anchor_id | quantity | +|---|---| +| `c3.k_of_g.openems-hfss-v1` | k_of_g | +| `mline.z0_ohm.closedform-v1` | mline_z0_ohm | +| `ratrace.r_ring_mm.closedform-v1` | ratrace_r_ring_mm | +| `ratrace.ring_z_ohm.closedform-v1` | ratrace_ring_z_ohm | +| `schiffman.delta_phase.closedform-v1` | schiffman_delta_phase_deg | + +判据书/规格指针(docstring 逐字引文钉): + +- `configs/materials.yaml`——引文:"层叠复用 configs/materials.yaml(带 source/verified_by)" + +测试面(tests/unit 引用扫描,机读;合计 **1642** 个 test 函数): + +| 测试文件 | test 函数数 | +|---|---| +| `tests/unit/test_a3c_coupled_interdigital.py` | 20 | +| `tests/unit/test_anchd_analytic_anchors.py` | 7 | +| `tests/unit/test_anchors_correction.py` | 30 | +| `tests/unit/test_aniso_separation.py` | 7 | +| `tests/unit/test_array_templates.py` | 25 | +| `tests/unit/test_atten_pi_template.py` | 10 | +| `tests/unit/test_atten_t_template.py` | 9 | +| `tests/unit/test_audit_fix_core_visibility.py` | 15 | +| `tests/unit/test_bend_template.py` | 7 | +| `tests/unit/test_cal_wizard.py` | 37 | +| `tests/unit/test_calculators.py` | 49 | +| `tests/unit/test_coupled_bpf_template.py` | 34 | +| `tests/unit/test_coupling_matrix.py` | 52 | +| `tests/unit/test_cps_template.py` | 20 | +| `tests/unit/test_cpw_template.py` | 11 | +| `tests/unit/test_diplexer_ridged_templates.py` | 28 | +| `tests/unit/test_dipole_template.py` | 7 | +| `tests/unit/test_edb_templates.py` | 25 | +| `tests/unit/test_edb_templates_ext.py` | 38 | +| `tests/unit/test_eep_templates.py` | 19 | +| `tests/unit/test_engine_benchmark_expand_golden.py` | 25 | +| `tests/unit/test_gysel_template.py` | 15 | +| `tests/unit/test_hairpin_alt_template.py` | 26 | +| `tests/unit/test_hairpin_kgap_correction.py` | 16 | +| `tests/unit/test_hairpin_template.py` | 37 | +| `tests/unit/test_impedance_drc.py` | 27 | +| `tests/unit/test_interdigital_template.py` | 31 | +| `tests/unit/test_level2_design.py` | 62 | +| `tests/unit/test_marchand_two_section.py` | 22 | +| `tests/unit/test_marchand_via_ab.py` | 18 | +| `tests/unit/test_materials_loader.py` | 15 | +| `tests/unit/test_meep_adapter.py` | 38 | +| `tests/unit/test_mf_synthesis.py` | 33 | +| `tests/unit/test_mline_template.py` | 7 | +| `tests/unit/test_msl_cpw_template.py` | 19 | +| `tests/unit/test_msl_siw_taper_template.py` | 15 | +| `tests/unit/test_mtrl_kit_kicad.py` | 16 | +| `tests/unit/test_oe_phase3_driver.py` | 42 | +| `tests/unit/test_package_chain.py` | 37 | +| `tests/unit/test_patch_feed_offset_unification.py` | 6 | +| `tests/unit/test_pk2_vertical_lit_and_wiring.py` | 10 | +| `tests/unit/test_port_renormalize.py` | 14 | +| `tests/unit/test_qucsator_adapter.py` | 35 | +| `tests/unit/test_qw10_qw11.py` | 14 | +| `tests/unit/test_ratrace_template.py` | 19 | +| `tests/unit/test_rf_matrix_branchline.py` | 53 | +| `tests/unit/test_ring_resonator_template.py` | 25 | +| `tests/unit/test_rp1_myj_sec4_05_prototype.py` | 6 | +| `tests/unit/test_rp1_pozar_patch_example.py` | 3 | +| `tests/unit/test_rules_verify.py` | 6 | +| `tests/unit/test_schiffman_qwt_templates.py` | 26 | +| `tests/unit/test_sensanc_analytic_anchors.py` | 11 | +| `tests/unit/test_shell_below_service_ratchet.py` | 3 | +| `tests/unit/test_sicl_nway_templates.py` | 26 | +| `tests/unit/test_siw_template.py` | 26 | +| `tests/unit/test_sma_launcher_template.py` | 22 | +| `tests/unit/test_stackup_diagram.py` | 39 | +| `tests/unit/test_stepped_coupled_line_specs.py` | 8 | +| `tests/unit/test_stripline_template.py` | 12 | +| `tests/unit/test_suspended_stripline_template.py` | 19 | +| `tests/unit/test_symbolic_fit.py` | 15 | +| `tests/unit/test_synthesis.py` | 14 | +| `tests/unit/test_synthesis_bpf_asym_tz.py` | 8 | +| `tests/unit/test_synthesis_bpf_polish_backsub.py` | 8 | +| `tests/unit/test_synthesis_multisection.py` | 31 | +| `tests/unit/test_synthesis_patch_anchor.py` | 16 | +| `tests/unit/test_tjunc_template.py` | 8 | +| `tests/unit/test_unit_convert_service.py` | 13 | +| `tests/unit/test_varactor.py` | 26 | +| `tests/unit/test_varactor_bpf_template.py` | 12 | +| `tests/unit/test_via_template.py` | 7 | +| `tests/unit/test_w1s3_lange_stepped.py` | 11 | +| `tests/unit/test_w3s11_ring.py` | 12 | +| `tests/unit/test_w3s15_analytic_anchors.py` | 7 | +| `tests/unit/test_w4_a_sm_core.py` | 21 | +| `tests/unit/test_w4_w4e_anchors.py` | 10 | +| `tests/unit/test_w4s15_anchor_batch.py` | 11 | +| `tests/unit/test_w6_d_so_leftovers.py` | 32 | +| `tests/unit/test_w6_f_anchors_cpw.py` | 7 | +| `tests/unit/test_width_single_source.py` | 11 | +| `tests/unit/test_wilkinson_synthesis_semantics.py` | 7 | +| `tests/unit/test_wstep_template.py` | 8 | +| `tests/unit/test_x5_analytic_anchors.py` | 13 | + +XC-P 精度档案收集器(防漂移对照面):`tests/unit/test_precision_profiles.py`;本卡保鲜门:`tests/unit/test_kernel_cards.py`。 + +## 关联 + +- [架构与方法论(锚体系/判据先行)](../architecture/methodology.md) +- [分层架构](../explanation/layered-architecture.md) +- [计算器注册表](../reference/calculators.md)——本内核的注册状态见元数据表 +- 同批内核卡:[macromodel](macromodel.md)、[rwg_mmt](rwg_mmt.md)、[pdn](pdn.md)、[pce](pce.md)、[cascade](cascade.md)、[wilkinson](wilkinson.md)、[branchline](branchline.md)、[ratrace](ratrace.md)、[patch](patch.md)、[hairpin](hairpin.md)、[cpw](cpw.md)、[slotline](slotline.md)、[coupled_microstrip](coupled_microstrip.md)、[finline](finline.md)、[wilkinson_unequal](wilkinson_unequal.md)、[atten_pi](atten_pi.md)、[atten_t](atten_t.md)、[qwt_multisection](qwt_multisection.md)、[nway_wilkinson](nway_wilkinson.md)、[schiffman](schiffman.md)、[bethe_hole_coupler](bethe_hole_coupler.md)、[gysel_core](gysel_core.md)、[coupled_line_bpf](coupled_line_bpf.md)、[lange](lange.md)、[stepped_impedance](stepped_impedance.md)、[ring_resonator](ring_resonator.md)、[mixer_conversion](mixer_conversion.md)、[ruthroff_balun](ruthroff_balun.md)、[gd_equalizer](gd_equalizer.md)、[measurement_drift](measurement_drift.md)、[agc_loop](agc_loop.md)、[cal_kit_verify](cal_kit_verify.md)、[six_port](six_port.md)、[iss_on_wafer](iss_on_wafer.md)、[source_power_cal](source_power_cal.md)、[combline](combline.md)、[cps](cps.md)、[interdigital](interdigital.md)、[siw](siw.md)、[slot](slot.md)、[stripline](stripline.md)、[suspended_stripline](suspended_stripline.md)、[dipole](dipole.md)、[helix](helix.md)、[link_limits](link_limits.md)、[fec_codes](fec_codes.md)、[directional_bridge](directional_bridge.md)、[rf_switch](rf_switch.md)、[kuroda_identities](kuroda_identities.md)、[pll_lock_time](pll_lock_time.md)、[multisection_coupler](multisection_coupler.md)、[itu_link](itu_link.md)、[link](link.md)、[dgs](dgs.md)、[if_digitizer](if_digitizer.md)、[wg_dielectric_window](wg_dielectric_window.md)、[waveguide_closed_form](waveguide_closed_form.md)、[waveguide_iris](waveguide_iris.md)、[hybrid_junction](hybrid_junction.md)、[radar_eq](radar_eq.md)、[modulation_ber](modulation_ber.md)、[coax_line](coax_line.md)、[analog_modulation](analog_modulation.md)、[si_ctle](si_ctle.md)、[propagation](propagation.md)、[hf_skywave](hf_skywave.md)、[fmcw_radar](fmcw_radar.md)、[sar_geometry](sar_geometry.md)、[gnss_geometry](gnss_geometry.md)、[radar_clutter](radar_clutter.md)、[microstrip_disc](microstrip_disc.md)、[open_wire_line](open_wire_line.md)、[wg_cavity_bpf](wg_cavity_bpf.md) diff --git a/external_plugins/rfauto/skills/rfauto-mline-synthesis/references/pitfalls.md b/external_plugins/rfauto/skills/rfauto-mline-synthesis/references/pitfalls.md new file mode 100644 index 00000000..17d45df3 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-mline-synthesis/references/pitfalls.md @@ -0,0 +1,26 @@ +# rfauto mline · failure-mode playbook + +> Extracted verbatim from the capability card「失败模式坑账链」section (docs/capability_cards/mline.md; deterministic +> regeneration). Pit numbers (#NNN) are rfauto DEVLOG ledger +> markers. Symptom → pitfall chain → disposition; open this file +> when a run shows one of the listed symptoms. + +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-mline-synthesis/scripts/verify_output.py b/external_plugins/rfauto/skills/rfauto-mline-synthesis/scripts/verify_output.py new file mode 100644 index 00000000..c1dfccec --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-mline-synthesis/scripts/verify_output.py @@ -0,0 +1,97 @@ +"""Deterministic output verifier for the rfauto mline skill package. + +Structural checks only — zero physics claims (rfauto rule 7: numbers come +from the rfauto kernel or the card files in references/, never from this +script or from model memory): + + 1. every --json file parses as JSON and contains no non-finite floats + (NaN/Infinity anywhere in the document); + 2. each --expect KEY=VALUE: KEY exists in the JSON, is a finite number, + and abs(value - VALUE) <= --tol (default 1e-3). + +Pass KEY/VALUE pairs only from rfauto kernel output or from the card files +in references/. Exit codes: 0 = all checks pass; 1 = any check fails. +Report FAIL as FAIL (rfauto rule #122); never retry a FAIL into green. +""" +from __future__ import annotations + +import argparse +import json +import math +import sys + + +def _non_finite_paths(node, prefix="$"): + bad = [] + if isinstance(node, float) and not math.isfinite(node): + bad.append(prefix) + elif isinstance(node, dict): + for key, value in node.items(): + bad += _non_finite_paths(value, prefix + "." + str(key)) + elif isinstance(node, list): + for i, value in enumerate(node): + bad += _non_finite_paths(value, prefix + "[" + str(i) + "]") + return bad + + +def main(argv=None): + parser = argparse.ArgumentParser( + description="Structural verifier for saved rfauto JSON output.") + parser.add_argument("--json", action="append", required=True, + help="saved rfauto kernel JSON (repeatable)") + parser.add_argument("--expect", action="append", default=[], + help="KEY=VALUE numeric cross-check (repeatable)") + parser.add_argument("--tol", type=float, default=1e-3) + args = parser.parse_args(argv) + + failures = [] + for path in args.json: + try: + with open(path, encoding="utf-8") as handle: + raw = handle.read() + except OSError as exc: + failures.append(path + ": unreadable (" + str(exc) + ")") + continue + try: + data = json.loads(raw) + except ValueError as exc: + failures.append(path + ": not JSON (" + str(exc) + ")") + continue + for where in _non_finite_paths(data): + failures.append(path + ": non-finite float at " + where) + if not isinstance(data, dict): + failures.append(path + ": top-level JSON is not an object") + continue + for spec in args.expect: + key, sep, value = spec.partition("=") + if not sep: + failures.append( + path + ": bad --expect " + repr(spec) + " (want KEY=VALUE)") + continue + if key not in data: + failures.append(path + ": missing key " + repr(key)) + continue + try: + got = float(data[key]) + except (TypeError, ValueError): + failures.append(path + ": key " + repr(key) + " not numeric") + continue + if not math.isfinite(got): + failures.append(path + ": key " + repr(key) + " non-finite") + continue + want = float(value) + if abs(got - want) > args.tol: + failures.append( + path + ": " + key + "=" + repr(got) + " vs expected " + + repr(want) + " (tol " + repr(args.tol) + ")") + if failures: + for line in failures: + print("FAIL " + line) + return 1 + print("PASS " + str(len(args.json)) + " file(s), " + + str(len(args.expect)) + " expectation(s)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/external_plugins/rfauto/skills/rfauto-patch-antenna/LICENSE.txt b/external_plugins/rfauto/skills/rfauto-patch-antenna/LICENSE.txt new file mode 100644 index 00000000..e62463fa --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-patch-antenna/LICENSE.txt @@ -0,0 +1,38 @@ +MIT License + +Copyright (c) 2026 rfauto contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +## FAQ + +**Q: Does rfauto's MIT license conflict with openEMS's GPL-3.0?** + +A: No. rfauto's main process never imports openEMS or CSXCAD Python bindings. These GPL-licensed +bindings are used only within child processes spawned by `simulation.py` (subprocess execution). +The rfauto repository itself contains no GPL code. Users compile bindings separately from the +openEMS source repository. + +**Q: Can I use rfauto commercially?** + +A: Yes, rfauto itself is MIT-licensed. However, you need valid licenses for any commercial EDA +software you use with it (Ansys AEDT/HFSS, Keysight ADS). rfauto does not provide or facilitate +any license circumvention. diff --git a/external_plugins/rfauto/skills/rfauto-patch-antenna/SKILL.md b/external_plugins/rfauto/skills/rfauto-patch-antenna/SKILL.md new file mode 100644 index 00000000..4e43794d --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-patch-antenna/SKILL.md @@ -0,0 +1,78 @@ +--- +name: rfauto-patch-antenna +description: >- + 用 rfauto 设计、仿真或调参矩形微带贴片天线时使用。涵盖腔模型谐振、贴片宽度与长度综合、馈电内缩(inset feed),以及配方驱动的 run、tune、autotune、calibrate 工作流。触发词:patch antenna、microstrip antenna、patch width、inset feed、resonance frequency、贴片天线、微带天线、谐振频率、馈电。PIFA、IFA 和贴片阵列(见其他 rfauto 卡),以及一般性 PCB 天线问题,不适用本卡。数值只来自 rfauto 内核与 references/ 下的卡片文件。 +license: 完整条款见本目录 LICENSE.txt +compatibility: 需要 PATH 中可用的 rfauto 命令(公开仓源码安装:在仓根执行 pip install -e .)。闭式综合可离线运行;引擎步骤需本机装有 openEMS 或 HFSS。 +metadata: + author: rfauto + version: '2' + rfauto_model: patch_antenna + card_kind: recipe+capability+kernel + generator: 'curated from recipe_to_skill; spec: agentskills.io / rfauto T-Q10' + source_recipe: recipes/patch_antenna_v1.yaml + source_cards: docs/capability_cards/patch.md, docs_site/kernel_cards/patch.md +allowed-tools: Bash(rfauto:*) Read +--- + +# rfauto skill:patch_antenna + +## 器件与目标 + +- 模型插件:`patch_antenna`;扫频 1.5–3.5 GHz。 +- 带内目标(objectives): + - `s11_db_min` max_below -10 @ [1.8, 2.1] GHz + +## 可调参数(optimization.params) + +| 参数 | low | high | +|---|---|---| +| patch_len_mm | 37.5 | 42.5 | +| patch_w_mm | 40.0 | 45.0 | + +## 标准工作流(typed 命令,数值由确定性内核产出) + +```bash +rfauto validate patch_antenna_v1.yaml # 配方校验 +rfauto run patch_antenna_v1.yaml -a fake # fake 快验证(秒级) +rfauto autotune patch_antenna_v1.yaml --budget 3 # 确定性 critique 自治环 +rfauto tune patch_antenna_v1.yaml -a openems --max-trials 30 # 外环寻优 +rfauto calibrate patch_antenna_v1.yaml --sampler openems # 代理校准(如接入) +rfauto p0 --high-adapter hfss # 终验(商业求解器收口) +``` + +## 扫描 notebook 骨架(openEMS 快验证) + +```python +from rfauto.adapters.em_solver_base import EMSolverConfig +from rfauto.adapters.openems_solver import OpenEMSSolver + +solver = OpenEMSSolver(EMSolverConfig( + solver_type="openems", + freq_range_ghz=tuple([1.5, 3.5]), + mesh_resolution_mm=0.45, # 网格 base 覆盖;0=自动 λ_sub/50 +)) +solver.connect() +solver.build_geometry({"template": None, "params": {}}) # 填参数点 +result = solver.solve() +``` + +## 边界(硬约束) + +- LLM/agent 不产生物理数字:所有指标来自求解器与确定性评判器。 +- 对配方的任何修改走沙箱草稿 → 三层 Gate 审批(agent 写面隔离)。 +- FAIL 如实记录,不凑绿。 + +## When to open the reference files + +| you need | open | +|---|---| +| the full capability card (playbook, all anchors, engine precision) | `references/capability_card.md` | +| formulas, docstring pins, precision profile, code entries, test surface | `references/kernel_card.md` | +| a symptom → pitfall → fix lookup | `references/pitfalls.md` | +| the read-only stackup facts behind this recipe | `configs/materials.yaml` (source of truth) | + +## Verify before you finish + +Run `python scripts/verify_output.py --json [--expect KEY=VALUE ... --tol 1e-3]`. +FAIL is reported as FAIL (rfauto rule #122); never retry a FAIL into green. diff --git a/external_plugins/rfauto/skills/rfauto-patch-antenna/references/capability_card.md b/external_plugins/rfauto/skills/rfauto-patch-antenna/references/capability_card.md new file mode 100644 index 00000000..36651135 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-patch-antenna/references/capability_card.md @@ -0,0 +1,72 @@ +# 能力卡:patch + +> 由 scripts/capability_cards_export.py 离线生成(确定性输出);数据源与坑号链见文中逐条标注。 + +## 适用场景 + +- 拓扑:矩形贴片(patch_len = 谐振 λ/2 轴,沿馈电方向 y)+ 边缘微带馈电 +- f0:2.4 GHz | 端口:1 | 时长 ≤30.0 ns | 网格档:0.0 mm +- 提取口径:S11 @ MSLPort 1(单端口回退) +- 参数:patch_len_mm, patch_w_mm, feed_offset_mm +- 基板:{"er":3.66,"h_mm":0.508} + +## 名义参数 + +| 参数 | 名义值 | +|---|---| +| feed_offset_mm | 10.0 | +| patch_len_mm | 34.9 | +| patch_w_mm | 50.0 | +- 名义参数来源:`docs/templates/patch/meta.yaml`(与 TEMPLATE_NOMINAL 一致性由 test_gallery_export 钉) + +## 敏感性排序(R9 先承诺) + +- 出处=computed(幅值分数登记表 `knowledge/sensitivity_rankings.yaml`;证据 scripts/sensitivity_rankings_build.py;坏条目拒收如实降级 #105) + +- 方法 central_finite_difference_elasticity | n=7 | 证据:scripts/sensitivity_rankings_build.py + +| rank | 参数 | 分数 | +|---|---|---| +| 1 | patch_len_mm | 0.986254 | +| 2 | patch_w_mm | 0.009582 | +| 3 | feed_offset_mm | 0.0 | +- 排序=R9 commitment_order(optimization/eipu;高敏感先钉死,平局按参数名升序) + +## 判据 + +- 锚覆盖 6:coupled_microstrip.kj_even_domain.lit-v1、cps.gamma_er.fdref-v1、mmt.inductive_post_b.hfss-v1、mmt.resonant_window_fres.hfss-v1、patch.f_dip_l.hfss-v1、patch.f_dip_l.openems-v1(core/anchors;通配 + 专属) +- 健康门:效率窗门 η∈[0.55, 0.79](ui_service.PATCH_ETA_GATE;#274 模板作用域:仅 patch 族适用) +- 通用体检:求解健康度体检 G11 九因子(core/solve_health;service/health_service.health_check_run 按 run 装载产物判定) + +## 引擎精度卡(跨引擎仲裁锚) + +- `coupled_microstrip.kj_even_domain.lit-v1`(constant/active;闭式/文献锚(无引擎对)):kj_even_domain_dev_pct = 0.66 percent;±1.0(arbitration_interval);verdict KJ_VINDICATED_J1_PASS(Elmer 三紧缝/域缘点 even −0.180%/−0.590%/−0.439% 全 J1 PASS;p2_summary.json overall=FAIL 属 HFSS 测量面非 KJ 本体,勿混淆);证据:runs/df7_kjeven +- `cps.gamma_er.fdref-v1`(formula/active;闭式/文献锚(无引擎对)):cps_gamma_er expr = 1 + 0.9014*er**-0.6361(变量:er);±0.006(relative);证据:runs/df6_dp14m1、runs/df6_dp18c9 +- `mmt.inductive_post_b.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):inductive_post_b_dev_pct = 9.224 percent;±7.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- `mmt.resonant_window_fres.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):resonant_window_f_res_dev_pct = 16.6 percent;±3.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- `patch.f_dip_l.hfss-v1`(constant/active;引擎对 hfss(hfss 仲裁)):f_dip_L = 99.8 GHz·mm;±0.05(relative);证据:runs/wp39_probe_patch +- `patch.f_dip_l.openems-v1`(constant/active;引擎对 openems(hfss 仲裁)):f_dip_L = 76.8 GHz·mm;±0.05(relative);证据:runs/wp39_mvp_followup +- 数据源:`knowledge/anchors.yaml`(仲裁锚注册表,status/版本演进口径见该文件头注;本节零计算零求值) + +## 已知边界 + +- 参数语义:patch_len_mm=谐振 λ/2 轴长,patch_w_mm=贴片宽度(非谐振轴,影响 εeff/匹配),feed_offset_mm=底馈探针沿谐振轴距中心偏置(渲染 _patch_lines/geometry_spec/LumpedPort 三处实读,决定馈电匹配深度;fake/schema 同名同语义)。历史漂移修正(0aq):原声明的 feed_w_mm 为幽灵参数(无任何消费者),已替换为真实参数 +- 网格:辐射器件:上方/侧向空气隙 λ0/4(guided 模板 5mm) +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-patch-antenna/references/kernel_card.md b/external_plugins/rfauto/skills/rfauto-patch-antenna/references/kernel_card.md new file mode 100644 index 00000000..79f3bd58 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-patch-antenna/references/kernel_card.md @@ -0,0 +1,265 @@ + + +# 内核文档卡:patch + +> E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +| 字段 | 值 | +|---|---| +| 内核 ID | `patch` | +| 主模块 | `src/rfauto/core/synthesis.py`(`rfauto.core.synthesis`) | +| 计算器注册表 | 未注册(AST 无 @register_calculator 装饰器——service 直调型内核,免 #231 注册表消费者三表同步) | +| KD-1 出处注册 | 2 条(kernel_file=src/rfauto/core/synthesis.py) | +| XC-P 精度档案 | 见下方「精度域」节(机读判定) | +| 数据来源 | XC-P + KD-1 + 模块 docstring/AST + anchors.yaml + tests/service 扫描 | + +## 物理语义 + +矩形贴片天线综合(Hammerstad 模型):宽/长闭式 + 边缘馈电阻抗的 sin² 腔体驻波变换定馈点,附带 Balanis 腔模读数面板(Q 分解/分数带宽/方向性/辐射效率)——ΔL 与 Rin_edge 全仓单源。 + +模块自述(docstring 首行,机读):E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +## 公式与口径 + +### 贴片宽/长(Hammerstad 口径) + +(docstring 原文转写) + +```latex +W=\frac{c}{2f_0}\sqrt{\frac{2}{\varepsilon_r+1}},\qquad L=\frac{c}{2f_0\sqrt{\varepsilon_{\mathrm{eff}}}}-2\,dL +``` + +出处:synthesize_patch docstring「闭式公式」节;总扣语义仲裁 INCONCLUSIVE 在档,语义终裁挂 L5 v2 批。 + +docstring 逐字引文(防漂移钉):"W = c / (2*f0) * sqrt(2/(er+1))" + "L = c/(2*f0*sqrt(er_eff)) - 2*dL [总扣口径=4ΔL(三副本一致,历史" + +### 边缘等效伸长 ΔL(Hammerstad 1975 原式,全仓单源) + +(docstring 原文转写) + +```latex +\frac{\Delta L}{h}=\frac{0.412\,(\varepsilon_{\mathrm{eff}}+0.3)(w/h+0.264)}{(\varepsilon_{\mathrm{eff}}-0.258)(w/h+0.8)} +``` + +出处:patch_fringing_delta_l docstring(Hammerstad 1975;Pozar eq.4.23 同口径);XA-1/PV-016 三副本收敛,本函数是全仓唯一 ΔL 算术单源。 + +docstring 逐字引文(防漂移钉):"ΔL/h = 0.412·(εeff+0.3)(w/h+0.264) / [(εeff−0.258)(w/h+0.8)]" + +### 馈点位置(腔体驻波 sin² 变换,XA-2 闭式) + +(docstring 原文转写) + +```latex +R_{\mathrm{in}}(\mathrm{off})=R_{\mathrm{in,edge}}\sin^2\!\Bigl(\frac{\pi\,\mathrm{off}}{L}\Bigr),\qquad \mathrm{off}=\frac{L}{\pi}\arcsin\sqrt{\frac{R_{\mathrm{in,t}}}{R_{\mathrm{in,edge}}}} +``` + +出处:synthesize_patch docstring XA-2 节;Rin_edge 由 patch_rin_edge_balanis 闭式(Balanis 4th §14-8 口径);输出口径=自贴片中心沿谐振轴偏移(#154 单源化)。 + +docstring 逐字引文(防漂移钉):"Rin(off) = Rin_edge·sin²(π·off/L) (腔体驻波,off 自中心)" + "off = (L/π)·arcsin√(Rin_t/Rin_edge) ≡ L/2 − y0" + +### 腔模读数面板(Balanis 4th Ch.14 式链) + +(docstring 原文转写) + +```latex +\frac{1}{Q_t}=\frac{1}{Q_{\mathrm{rad}}}+\frac{1}{Q_c}+\frac{1}{Q_d},\qquad \mathrm{BW}=\frac{\mathrm{VSWR}-1}{Q_t\sqrt{\mathrm{VSWR}}},\qquad e_{\mathrm{cds}}=\frac{Q_t}{Q_{\mathrm{rad}}} +``` + +出处:patch_cavity_metrics docstring(#1c 原文核对:Balanis 4th ed. Ch.14 原文页 852-854 + Table 14.2 逐式核对);方向性 D0 式 14-55 经 Jacobi-Anger 降维一维确定性求积。 + +docstring 逐字引文(防漂移钉):"1/Qt = 1/Qrad + 1/Qc + 1/Qd" + "- 分数带宽(式 14-88a):BW = (VSWR−1)/(Qt·√VSWR);" + +### KD-1 出处注册(`src/rfauto/core/synthesis.py`,knowledge/formula_provenance.yaml 过滤) + +命中 **2** 条: + +| formula_id | symbol | kind | source_doi | refs | +|---|---|---|---|---| +| synthesis:chebyshev_lpf_g_values:01 | chebyshev_lpf_g_values | pointer | — | — | +| synthesis:patch_rin_edge_balanis:01 | patch_rin_edge_balanis | source | — | — | + +## 精度域(XC-P 精度档案) + +**未收录**:XC-P 首批建档内核共 **10** 个(bounds、conductor_loss、coupled_microstrip、dielectric_extract、etch_trapezoid、high_power、ridged_waveguide、shield_cavity_mode、synthesis.forward_z0、thermal_iteration),不含 `patch`。因此: + +- 典型偏差分档:**UNVERIFIED**(无档案即无分档;本卡不编造任何精度数字——铁律 7 / #122 如实标注); +- 域判查询:`core/precision_profiles.py` 对未知 kernel 如实降级(收集器=`tests/unit/test_precision_profiles.py` 逐条对照防漂移); +- 建档入口:precision_profiles.yaml 增键(schema 见该文件头)+ `KERNEL_MODULES` 映射 + 模块 docstring 末尾「精度档案」镜像行 + 重跑本生成器。 + +> 本节为机读聚合:XC-P 收录状态与键清单构建时实测;本内核建档后此节自动展开为分档表(渲染支路已备)。 + +## 使用边界 + +- 越域显式 ValueError 不外推(=Rin_edge 退化边缘馈 off=L/2);off∈(0, L/2] 由 arcsin 值域自动保证。 + - docstring 逐字引文:"物理有效域 0 < Rin_t ≤ Rin_edge(馈点只能从中心向边缘提阻;" +- Rin_edge 出处页码/式号 UNVERIFIED 待核——章节级引用可用,页码级声称必须先回原文(#122)。 + - docstring 逐字引文:"原文逐位核对,引用该出处前必须回原文核验,不冒充已核)。" +- ΔL 总扣语义(2ΔL vs 4ΔL)离线锚仲裁 INCONCLUSIVE——现行口径零行为维持,不凑裁决;语义翻转需联动多面另批。 + - docstring 逐字引文:"离线锚仲裁判 INCONCLUSIVE:两语义" +- 腔模口径是薄基板假设——厚基板越域显式报错不外推。 + - docstring 逐字引文:"适用域:k0·h ≪ 1(守卫同 patch_rin_edge_balanis <0.3,腔模口径)。" + +## 代码入口 + +主入口(file:symbol,AST 校验存在): + +- `src/rfauto/core/synthesis.py:synthesize_patch` +- `src/rfauto/core/synthesis.py:patch_fringing_delta_l` +- `src/rfauto/core/synthesis.py:patch_rin_edge_balanis` +- `src/rfauto/core/synthesis.py:patch_cavity_metrics` + +src/rfauto/core/synthesis.py 公开符号 **43** 个(AST 机读): + +`Stackup`、`ForwardMedia`、`forward_media`、`forward_z0`、`inverse_width`、`nominal_width_mm`、`lossless_width_mm`、`SynthesisResult`、`synthesize_mline`、`synthesize_batch`、`ModelSynthesisResult`、`synthesize_wilkinson`、`synthesize_branchline`、`patch_fringing_delta_l`、`patch_rin_edge_balanis`、`patch_cavity_metrics`、`synthesize_patch`、`synthesize_mline_model`、`synthesize_cpw_model`、`synthesize_dipole_model`、`synthesize_wstep_model`、`synthesize_tjunc_model`、`synthesize_bend_model`、`synthesize_via_model`、`synthesize_atten_pi_model`、`synthesize_atten_t_model`、`synthesize_ratrace_model`、`synthesize_gysel_model`、`synthesize_stripline_model`、`synthesize_cps_model`、`synthesize_suspended_stripline_model`、`synthesize_msl_cpw_model`、`synthesize_siw_model`、`synthesize_msl_siw_taper_model`、`synthesize_sma_launcher_model`、`synthesize_bpf_model`、`hairpin_design_from_order`、`synthesize_hairpin_model`、`chebyshev_lpf_g_values`、`synthesize_multisection_quarter_wave`、`synthesize_nway_wilkinson`、`schiffman_delta_phase`、`synthesize_schiffman` + +消费面(service/adapters 引用扫描,机读): + +- service:`src/rfauto/service/anchor_family_service.py` +- service:`src/rfauto/service/diagram_stackup_service.py` +- service:`src/rfauto/service/em_bench_service.py` +- service:`src/rfauto/service/even_odd_service.py` +- service:`src/rfauto/service/kicad_em_service.py` +- service:`src/rfauto/service/level2_design.py` +- service:`src/rfauto/service/meep_sampling.py` +- service:`src/rfauto/service/package_chain_service.py` +- service:`src/rfauto/service/qucsator_service.py` +- service:`src/rfauto/service/teaching_service.py` +- service:`src/rfauto/service/unit_convert_service.py` +- adapters:`src/rfauto/adapters/comsol_adapter.py` +- adapters:`src/rfauto/adapters/edb_templates/schema.py` +- adapters:`src/rfauto/adapters/fake_adapter/adapter.py` +- adapters:`src/rfauto/adapters/fake_adapter/antenna_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/coupler_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/filter_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/tl_family.py` +- adapters:`src/rfauto/adapters/layout_generator.py` +- adapters:`src/rfauto/adapters/meep_adapter.py` +- adapters:`src/rfauto/adapters/oe_templates/_nominal_width.py` +- adapters:`src/rfauto/adapters/oe_templates/closedform.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c3.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c4.py` +- adapters:`src/rfauto/adapters/oe_templates/render_coupled_bpf.py` +- adapters:`src/rfauto/adapters/oe_templates/render_diplexer_ridged.py` +- adapters:`src/rfauto/adapters/oe_templates/render_hairpin.py` +- adapters:`src/rfauto/adapters/oe_templates/render_phase_qwt.py` +- adapters:`src/rfauto/adapters/oe_templates/render_sicl_nway.py` +- adapters:`src/rfauto/adapters/oe_templates/render_siw.py` +- adapters:`src/rfauto/adapters/oe_templates/render_ta_wave_c.py` +- adapters:`src/rfauto/adapters/qucsator_adapter.py` + +## 锚与测试入口 + +analytic-anchor(knowledge/anchors.yaml 机读命中): + +| anchor_id | quantity | +|---|---| +| `c3.k_of_g.openems-hfss-v1` | k_of_g | +| `mline.z0_ohm.closedform-v1` | mline_z0_ohm | +| `ratrace.r_ring_mm.closedform-v1` | ratrace_r_ring_mm | +| `ratrace.ring_z_ohm.closedform-v1` | ratrace_ring_z_ohm | +| `schiffman.delta_phase.closedform-v1` | schiffman_delta_phase_deg | + +判据书/规格指针(docstring 逐字引文钉): + +- `runs/xa1_arbitration/l5_sweep/criteria.md`(runs/ 证据面,gitignored,存在性不作测试断言)——引文:"在真实结构里是 18Ω,|S11| 卡 −6.5dB)。共形映射闭式见" + +测试面(tests/unit 引用扫描,机读;合计 **1642** 个 test 函数): + +| 测试文件 | test 函数数 | +|---|---| +| `tests/unit/test_a3c_coupled_interdigital.py` | 20 | +| `tests/unit/test_anchd_analytic_anchors.py` | 7 | +| `tests/unit/test_anchors_correction.py` | 30 | +| `tests/unit/test_aniso_separation.py` | 7 | +| `tests/unit/test_array_templates.py` | 25 | +| `tests/unit/test_atten_pi_template.py` | 10 | +| `tests/unit/test_atten_t_template.py` | 9 | +| `tests/unit/test_audit_fix_core_visibility.py` | 15 | +| `tests/unit/test_bend_template.py` | 7 | +| `tests/unit/test_cal_wizard.py` | 37 | +| `tests/unit/test_calculators.py` | 49 | +| `tests/unit/test_coupled_bpf_template.py` | 34 | +| `tests/unit/test_coupling_matrix.py` | 52 | +| `tests/unit/test_cps_template.py` | 20 | +| `tests/unit/test_cpw_template.py` | 11 | +| `tests/unit/test_diplexer_ridged_templates.py` | 28 | +| `tests/unit/test_dipole_template.py` | 7 | +| `tests/unit/test_edb_templates.py` | 25 | +| `tests/unit/test_edb_templates_ext.py` | 38 | +| `tests/unit/test_eep_templates.py` | 19 | +| `tests/unit/test_engine_benchmark_expand_golden.py` | 25 | +| `tests/unit/test_gysel_template.py` | 15 | +| `tests/unit/test_hairpin_alt_template.py` | 26 | +| `tests/unit/test_hairpin_kgap_correction.py` | 16 | +| `tests/unit/test_hairpin_template.py` | 37 | +| `tests/unit/test_impedance_drc.py` | 27 | +| `tests/unit/test_interdigital_template.py` | 31 | +| `tests/unit/test_level2_design.py` | 62 | +| `tests/unit/test_marchand_two_section.py` | 22 | +| `tests/unit/test_marchand_via_ab.py` | 18 | +| `tests/unit/test_materials_loader.py` | 15 | +| `tests/unit/test_meep_adapter.py` | 38 | +| `tests/unit/test_mf_synthesis.py` | 33 | +| `tests/unit/test_mline_template.py` | 7 | +| `tests/unit/test_msl_cpw_template.py` | 19 | +| `tests/unit/test_msl_siw_taper_template.py` | 15 | +| `tests/unit/test_mtrl_kit_kicad.py` | 16 | +| `tests/unit/test_oe_phase3_driver.py` | 42 | +| `tests/unit/test_package_chain.py` | 37 | +| `tests/unit/test_patch_feed_offset_unification.py` | 6 | +| `tests/unit/test_pk2_vertical_lit_and_wiring.py` | 10 | +| `tests/unit/test_port_renormalize.py` | 14 | +| `tests/unit/test_qucsator_adapter.py` | 35 | +| `tests/unit/test_qw10_qw11.py` | 14 | +| `tests/unit/test_ratrace_template.py` | 19 | +| `tests/unit/test_rf_matrix_branchline.py` | 53 | +| `tests/unit/test_ring_resonator_template.py` | 25 | +| `tests/unit/test_rp1_myj_sec4_05_prototype.py` | 6 | +| `tests/unit/test_rp1_pozar_patch_example.py` | 3 | +| `tests/unit/test_rules_verify.py` | 6 | +| `tests/unit/test_schiffman_qwt_templates.py` | 26 | +| `tests/unit/test_sensanc_analytic_anchors.py` | 11 | +| `tests/unit/test_shell_below_service_ratchet.py` | 3 | +| `tests/unit/test_sicl_nway_templates.py` | 26 | +| `tests/unit/test_siw_template.py` | 26 | +| `tests/unit/test_sma_launcher_template.py` | 22 | +| `tests/unit/test_stackup_diagram.py` | 39 | +| `tests/unit/test_stepped_coupled_line_specs.py` | 8 | +| `tests/unit/test_stripline_template.py` | 12 | +| `tests/unit/test_suspended_stripline_template.py` | 19 | +| `tests/unit/test_symbolic_fit.py` | 15 | +| `tests/unit/test_synthesis.py` | 14 | +| `tests/unit/test_synthesis_bpf_asym_tz.py` | 8 | +| `tests/unit/test_synthesis_bpf_polish_backsub.py` | 8 | +| `tests/unit/test_synthesis_multisection.py` | 31 | +| `tests/unit/test_synthesis_patch_anchor.py` | 16 | +| `tests/unit/test_tjunc_template.py` | 8 | +| `tests/unit/test_unit_convert_service.py` | 13 | +| `tests/unit/test_varactor.py` | 26 | +| `tests/unit/test_varactor_bpf_template.py` | 12 | +| `tests/unit/test_via_template.py` | 7 | +| `tests/unit/test_w1s3_lange_stepped.py` | 11 | +| `tests/unit/test_w3s11_ring.py` | 12 | +| `tests/unit/test_w3s15_analytic_anchors.py` | 7 | +| `tests/unit/test_w4_a_sm_core.py` | 21 | +| `tests/unit/test_w4_w4e_anchors.py` | 10 | +| `tests/unit/test_w4s15_anchor_batch.py` | 11 | +| `tests/unit/test_w6_d_so_leftovers.py` | 32 | +| `tests/unit/test_w6_f_anchors_cpw.py` | 7 | +| `tests/unit/test_width_single_source.py` | 11 | +| `tests/unit/test_wilkinson_synthesis_semantics.py` | 7 | +| `tests/unit/test_wstep_template.py` | 8 | +| `tests/unit/test_x5_analytic_anchors.py` | 13 | + +XC-P 精度档案收集器(防漂移对照面):`tests/unit/test_precision_profiles.py`;本卡保鲜门:`tests/unit/test_kernel_cards.py`。 + +## 关联 + +- [架构与方法论(锚体系/判据先行)](../architecture/methodology.md) +- [分层架构](../explanation/layered-architecture.md) +- [计算器注册表](../reference/calculators.md)——本内核的注册状态见元数据表 +- 同批内核卡:[macromodel](macromodel.md)、[rwg_mmt](rwg_mmt.md)、[pdn](pdn.md)、[pce](pce.md)、[cascade](cascade.md)、[mline](mline.md)、[wilkinson](wilkinson.md)、[branchline](branchline.md)、[ratrace](ratrace.md)、[hairpin](hairpin.md)、[cpw](cpw.md)、[slotline](slotline.md)、[coupled_microstrip](coupled_microstrip.md)、[finline](finline.md)、[wilkinson_unequal](wilkinson_unequal.md)、[atten_pi](atten_pi.md)、[atten_t](atten_t.md)、[qwt_multisection](qwt_multisection.md)、[nway_wilkinson](nway_wilkinson.md)、[schiffman](schiffman.md)、[bethe_hole_coupler](bethe_hole_coupler.md)、[gysel_core](gysel_core.md)、[coupled_line_bpf](coupled_line_bpf.md)、[lange](lange.md)、[stepped_impedance](stepped_impedance.md)、[ring_resonator](ring_resonator.md)、[mixer_conversion](mixer_conversion.md)、[ruthroff_balun](ruthroff_balun.md)、[gd_equalizer](gd_equalizer.md)、[measurement_drift](measurement_drift.md)、[agc_loop](agc_loop.md)、[cal_kit_verify](cal_kit_verify.md)、[six_port](six_port.md)、[iss_on_wafer](iss_on_wafer.md)、[source_power_cal](source_power_cal.md)、[combline](combline.md)、[cps](cps.md)、[interdigital](interdigital.md)、[siw](siw.md)、[slot](slot.md)、[stripline](stripline.md)、[suspended_stripline](suspended_stripline.md)、[dipole](dipole.md)、[helix](helix.md)、[link_limits](link_limits.md)、[fec_codes](fec_codes.md)、[directional_bridge](directional_bridge.md)、[rf_switch](rf_switch.md)、[kuroda_identities](kuroda_identities.md)、[pll_lock_time](pll_lock_time.md)、[multisection_coupler](multisection_coupler.md)、[itu_link](itu_link.md)、[link](link.md)、[dgs](dgs.md)、[if_digitizer](if_digitizer.md)、[wg_dielectric_window](wg_dielectric_window.md)、[waveguide_closed_form](waveguide_closed_form.md)、[waveguide_iris](waveguide_iris.md)、[hybrid_junction](hybrid_junction.md)、[radar_eq](radar_eq.md)、[modulation_ber](modulation_ber.md)、[coax_line](coax_line.md)、[analog_modulation](analog_modulation.md)、[si_ctle](si_ctle.md)、[propagation](propagation.md)、[hf_skywave](hf_skywave.md)、[fmcw_radar](fmcw_radar.md)、[sar_geometry](sar_geometry.md)、[gnss_geometry](gnss_geometry.md)、[radar_clutter](radar_clutter.md)、[microstrip_disc](microstrip_disc.md)、[open_wire_line](open_wire_line.md)、[wg_cavity_bpf](wg_cavity_bpf.md) diff --git a/external_plugins/rfauto/skills/rfauto-patch-antenna/references/pitfalls.md b/external_plugins/rfauto/skills/rfauto-patch-antenna/references/pitfalls.md new file mode 100644 index 00000000..fa31f8fd --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-patch-antenna/references/pitfalls.md @@ -0,0 +1,26 @@ +# rfauto patch · failure-mode playbook + +> Extracted verbatim from the capability card「失败模式坑账链」section (docs/capability_cards/patch.md; deterministic +> regeneration). Pit numbers (#NNN) are rfauto DEVLOG ledger +> markers. Symptom → pitfall chain → disposition; open this file +> when a run shows one of the listed symptoms. + +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-patch-antenna/scripts/verify_output.py b/external_plugins/rfauto/skills/rfauto-patch-antenna/scripts/verify_output.py new file mode 100644 index 00000000..d9d0bb3a --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-patch-antenna/scripts/verify_output.py @@ -0,0 +1,97 @@ +"""Deterministic output verifier for the rfauto patch skill package. + +Structural checks only — zero physics claims (rfauto rule 7: numbers come +from the rfauto kernel or the card files in references/, never from this +script or from model memory): + + 1. every --json file parses as JSON and contains no non-finite floats + (NaN/Infinity anywhere in the document); + 2. each --expect KEY=VALUE: KEY exists in the JSON, is a finite number, + and abs(value - VALUE) <= --tol (default 1e-3). + +Pass KEY/VALUE pairs only from rfauto kernel output or from the card files +in references/. Exit codes: 0 = all checks pass; 1 = any check fails. +Report FAIL as FAIL (rfauto rule #122); never retry a FAIL into green. +""" +from __future__ import annotations + +import argparse +import json +import math +import sys + + +def _non_finite_paths(node, prefix="$"): + bad = [] + if isinstance(node, float) and not math.isfinite(node): + bad.append(prefix) + elif isinstance(node, dict): + for key, value in node.items(): + bad += _non_finite_paths(value, prefix + "." + str(key)) + elif isinstance(node, list): + for i, value in enumerate(node): + bad += _non_finite_paths(value, prefix + "[" + str(i) + "]") + return bad + + +def main(argv=None): + parser = argparse.ArgumentParser( + description="Structural verifier for saved rfauto JSON output.") + parser.add_argument("--json", action="append", required=True, + help="saved rfauto kernel JSON (repeatable)") + parser.add_argument("--expect", action="append", default=[], + help="KEY=VALUE numeric cross-check (repeatable)") + parser.add_argument("--tol", type=float, default=1e-3) + args = parser.parse_args(argv) + + failures = [] + for path in args.json: + try: + with open(path, encoding="utf-8") as handle: + raw = handle.read() + except OSError as exc: + failures.append(path + ": unreadable (" + str(exc) + ")") + continue + try: + data = json.loads(raw) + except ValueError as exc: + failures.append(path + ": not JSON (" + str(exc) + ")") + continue + for where in _non_finite_paths(data): + failures.append(path + ": non-finite float at " + where) + if not isinstance(data, dict): + failures.append(path + ": top-level JSON is not an object") + continue + for spec in args.expect: + key, sep, value = spec.partition("=") + if not sep: + failures.append( + path + ": bad --expect " + repr(spec) + " (want KEY=VALUE)") + continue + if key not in data: + failures.append(path + ": missing key " + repr(key)) + continue + try: + got = float(data[key]) + except (TypeError, ValueError): + failures.append(path + ": key " + repr(key) + " not numeric") + continue + if not math.isfinite(got): + failures.append(path + ": key " + repr(key) + " non-finite") + continue + want = float(value) + if abs(got - want) > args.tol: + failures.append( + path + ": " + key + "=" + repr(got) + " vs expected " + + repr(want) + " (tol " + repr(args.tol) + ")") + if failures: + for line in failures: + print("FAIL " + line) + return 1 + print("PASS " + str(len(args.json)) + " file(s), " + + str(len(args.expect)) + " expectation(s)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/external_plugins/rfauto/skills/rfauto-pifa/LICENSE.txt b/external_plugins/rfauto/skills/rfauto-pifa/LICENSE.txt new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-pifa/LICENSE.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/external_plugins/rfauto/skills/rfauto-pifa/SKILL.md b/external_plugins/rfauto/skills/rfauto-pifa/SKILL.md new file mode 100644 index 00000000..517737c8 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-pifa/SKILL.md @@ -0,0 +1,91 @@ +--- +name: rfauto-pifa +description: >- + 涉及 rfauto 的 `pifa` 卡时使用:PIFA(§10.3 C1)。结构为贴片位于 z=h,尺寸 L×W;+x 边的短路板宽 Ws,从 z=0 触地到 z=h;馈针距短路板 pin_back,y 向偏移 pin_y,针顶触贴片、针底触地。LumpedPort 沿针的 z 向放置,基板加 z-min 处的 PEC 构成无限大地。可调参数:pifa_l_mm、pifa_w_mm、pifa_ws_mm、pin_back_mm、pin_y_mm。指标提取:LumpedPort 1 处的 S11(PIFA 居中短路板 λ/4:谷位、谷深)。L 经路径式定版的标称值为 17.0785,真机 override 取 17.08,在 2.26GHz 处为 −8.79dB(−5.8%),PASS;谷点 Zin=105−14jΩ,详见 smoke_note。触发词:pifa。其他卡族不适用,请改用对应的 rfauto 卡或 skill。数值只来自 rfauto 内核与 references/ 卡片文件。 +license: 完整条款见本目录 LICENSE.txt +compatibility: 需要 PATH 中可用的 rfauto 命令(公开仓源码安装:在仓根执行 pip install -e .)。闭式综合可离线运行;引擎步骤需本机装有 openEMS 或 HFSS。 +metadata: + author: rfauto + version: '1' + rfauto_card: pifa + card_kind: capability + generator: rfauto.service.skill_service.card_to_skill + source_cards: docs/capability_cards/pifa.md +allowed-tools: Bash(rfauto:*) Read +--- + +# rfauto · pifa + +> Generated by `rfauto.service.skill_service.card_to_skill` from the +> rfauto deterministic cards (byte-copied under `references/`); +> regeneration is idempotent. Rule 7: every number must come from the +> rfauto kernel or these cards — never from model memory, never +> invented to be helpful. + +## When this skill applies + +- 拓扑:PIFA(§10.3 C1):贴片 z=h(L×W)+ +x 边短路板(宽 Ws,z 0→h 触地)+ 馈针(距短路板 pin_back,y 偏 pin_y,针顶触贴片、针底触地);LumpedPort 沿针 z 向;基板 + z-min PEC 无限大地 +- f0:2.4 GHz | 端口:1 | 时长 ≤30.0 ns | 网格档:0.0 mm +- 提取口径:S11 @ LumpedPort 1(PIFA 居中短路板 λ/4:谷位/谷深;L 路径式定版标称 17.0785 ≈ 真机 override 17.08 → −8.79dB@2.26GHz(−5.8%)PASS,Zin@谷=105−14jΩ,见 smoke_note) +- 参数:pifa_l_mm, pifa_w_mm, pifa_ws_mm, pin_back_mm, pin_y_mm +- 基板:{"er":3.66,"h_mm":0.508} + +## Workflow (typed commands; every value comes from the kernel) + +Run `rfauto --help` and consult the code entry points listed in the kernel card (`references/kernel_card.md`, section「代码入口」) — the CLI surface for card `pifa` is not pinned by this package. + +## Nominal parameters + +| 参数 | 名义值 | +|---|---| +| pifa_l_mm | 17.0785 | +| pifa_w_mm | 8.0 | +| pifa_ws_mm | 2.0 | +| pin_back_mm | 2.0 | +| pin_y_mm | 2.0 | +- 名义参数来源:`docs/templates/pifa/meta.yaml`(与 TEMPLATE_NOMINAL 一致性由 test_gallery_export 钉) + +## Sensitivity ranking + +- 出处=computed(幅值分数登记表 `knowledge/sensitivity_rankings.yaml`;证据 scripts/sensitivity_rankings_build.py;坏条目拒收如实降级 #105) +- 方法 central_finite_difference_elasticity | n=11 | 证据:scripts/sensitivity_rankings_build.py +| rank | 参数 | 分数 | +|---|---|---| +| 1 | pifa_l_mm | 1.0 | +| 2 | pifa_w_mm | 0.029987 | +| 3 | pifa_ws_mm | 0.0 | +| 4 | pin_back_mm | 0.0 | +| 5 | pin_y_mm | 0.0 | +- 排序=R9 commitment_order(optimization/eipu;高敏感先钉死,平局按参数名升序) + +## Judgment gates and anchors + +- 锚覆盖 5:coupled_microstrip.kj_even_domain.lit-v1、cps.gamma_er.fdref-v1、mmt.inductive_post_b.hfss-v1、mmt.resonant_window_fres.hfss-v1、pifa.f_res.openems-v1(core/anchors;通配 + 专属) +- 健康门:无模板作用域专属健康门(gate 如实不判,#274 口径) +- 通用体检:求解健康度体检 G11 九因子(core/solve_health;service/health_service.health_check_run 按 run 装载产物判定) + +## Card-specific arbitration anchors + +- `pifa.f_res.openems-v1`(pointer/experimental;引擎对 openems(hfss 仲裁)):pifa_f_res_ghz 双值 openems=2.268 GHz(不取平均,#122);±0.12(engine_pair_spread);verdict PASS(同 dipole 席门族全过);证据:runs/aurora_e/w2srv_r2/pifa + +- Wildcard anchors from other families that also cover this card: see the「判据」section above and `references/capability_card.md`. + +## Known boundaries + +- 参数语义:pifa_l_mm=贴片长 L(L 路径式定版 L=λ0/(4√εeff(W)),HJ @W;居中短路板电流不绕行,文献通式 L+W−Ws 的 +W−Ws 项不适用,真机两轮实证),pifa_w_mm=贴片宽 W,pifa_ws_mm=短路板宽 Ws(≤W,几何输入不进谐振式),pin_back_mm=馈针距短路板(定匹配),pin_y_mm=馈针 y 偏置( [--expect KEY=VALUE ... --tol 1e-3]`. +FAIL is reported as FAIL (rfauto rule #122); never retry a FAIL into green. diff --git a/external_plugins/rfauto/skills/rfauto-pifa/references/capability_card.md b/external_plugins/rfauto/skills/rfauto-pifa/references/capability_card.md new file mode 100644 index 00000000..1f472b8a --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-pifa/references/capability_card.md @@ -0,0 +1,76 @@ +# 能力卡:pifa + +> 由 scripts/capability_cards_export.py 离线生成(确定性输出);数据源与坑号链见文中逐条标注。 + +## 适用场景 + +- 拓扑:PIFA(§10.3 C1):贴片 z=h(L×W)+ +x 边短路板(宽 Ws,z 0→h 触地)+ 馈针(距短路板 pin_back,y 偏 pin_y,针顶触贴片、针底触地);LumpedPort 沿针 z 向;基板 + z-min PEC 无限大地 +- f0:2.4 GHz | 端口:1 | 时长 ≤30.0 ns | 网格档:0.0 mm +- 提取口径:S11 @ LumpedPort 1(PIFA 居中短路板 λ/4:谷位/谷深;L 路径式定版标称 17.0785 ≈ 真机 override 17.08 → −8.79dB@2.26GHz(−5.8%)PASS,Zin@谷=105−14jΩ,见 smoke_note) +- 参数:pifa_l_mm, pifa_w_mm, pifa_ws_mm, pin_back_mm, pin_y_mm +- 基板:{"er":3.66,"h_mm":0.508} + +## 名义参数 + +| 参数 | 名义值 | +|---|---| +| pifa_l_mm | 17.0785 | +| pifa_w_mm | 8.0 | +| pifa_ws_mm | 2.0 | +| pin_back_mm | 2.0 | +| pin_y_mm | 2.0 | +- 名义参数来源:`docs/templates/pifa/meta.yaml`(与 TEMPLATE_NOMINAL 一致性由 test_gallery_export 钉) + +## 敏感性排序(R9 先承诺) + +- 出处=computed(幅值分数登记表 `knowledge/sensitivity_rankings.yaml`;证据 scripts/sensitivity_rankings_build.py;坏条目拒收如实降级 #105) + +- 方法 central_finite_difference_elasticity | n=11 | 证据:scripts/sensitivity_rankings_build.py + +| rank | 参数 | 分数 | +|---|---|---| +| 1 | pifa_l_mm | 1.0 | +| 2 | pifa_w_mm | 0.029987 | +| 3 | pifa_ws_mm | 0.0 | +| 4 | pin_back_mm | 0.0 | +| 5 | pin_y_mm | 0.0 | +- 排序=R9 commitment_order(optimization/eipu;高敏感先钉死,平局按参数名升序) + +## 判据 + +- 锚覆盖 5:coupled_microstrip.kj_even_domain.lit-v1、cps.gamma_er.fdref-v1、mmt.inductive_post_b.hfss-v1、mmt.resonant_window_fres.hfss-v1、pifa.f_res.openems-v1(core/anchors;通配 + 专属) +- 健康门:无模板作用域专属健康门(gate 如实不判,#274 口径) +- 通用体检:求解健康度体检 G11 九因子(core/solve_health;service/health_service.health_check_run 按 run 装载产物判定) + +## 引擎精度卡(跨引擎仲裁锚) + +- `coupled_microstrip.kj_even_domain.lit-v1`(constant/active;闭式/文献锚(无引擎对)):kj_even_domain_dev_pct = 0.66 percent;±1.0(arbitration_interval);verdict KJ_VINDICATED_J1_PASS(Elmer 三紧缝/域缘点 even −0.180%/−0.590%/−0.439% 全 J1 PASS;p2_summary.json overall=FAIL 属 HFSS 测量面非 KJ 本体,勿混淆);证据:runs/df7_kjeven +- `cps.gamma_er.fdref-v1`(formula/active;闭式/文献锚(无引擎对)):cps_gamma_er expr = 1 + 0.9014*er**-0.6361(变量:er);±0.006(relative);证据:runs/df6_dp14m1、runs/df6_dp18c9 +- `mmt.inductive_post_b.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):inductive_post_b_dev_pct = 9.224 percent;±7.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- `mmt.resonant_window_fres.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):resonant_window_f_res_dev_pct = 16.6 percent;±3.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- `pifa.f_res.openems-v1`(pointer/experimental;引擎对 openems(hfss 仲裁)):pifa_f_res_ghz 双值 openems=2.268 GHz(不取平均,#122);±0.12(engine_pair_spread);verdict PASS(同 dipole 席门族全过);证据:runs/aurora_e/w2srv_r2/pifa +- 数据源:`knowledge/anchors.yaml`(仲裁锚注册表,status/版本演进口径见该文件头注;本节零计算零求值) + +## 已知边界 + +- 参数语义:pifa_l_mm=贴片长 L(L 路径式定版 L=λ0/(4√εeff(W)),HJ @W;居中短路板电流不绕行,文献通式 L+W−Ws 的 +W−Ws 项不适用,真机两轮实证),pifa_w_mm=贴片宽 W,pifa_ws_mm=短路板宽 Ws(≤W,几何输入不进谐振式),pin_back_mm=馈针距短路板(定匹配),pin_y_mm=馈针 y 偏置(1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-pifa/references/pitfalls.md b/external_plugins/rfauto/skills/rfauto-pifa/references/pitfalls.md new file mode 100644 index 00000000..eae00cb9 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-pifa/references/pitfalls.md @@ -0,0 +1,26 @@ +# rfauto pifa · failure-mode playbook + +> Extracted verbatim from the capability card「失败模式坑账链」section (docs/capability_cards/pifa.md; deterministic +> regeneration). Pit numbers (#NNN) are rfauto DEVLOG ledger +> markers. Symptom → pitfall chain → disposition; open this file +> when a run shows one of the listed symptoms. + +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-pifa/scripts/verify_output.py b/external_plugins/rfauto/skills/rfauto-pifa/scripts/verify_output.py new file mode 100644 index 00000000..fcf58979 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-pifa/scripts/verify_output.py @@ -0,0 +1,97 @@ +"""Deterministic output verifier for the rfauto pifa skill package. + +Structural checks only — zero physics claims (rfauto rule 7: numbers come +from the rfauto kernel or the card files in references/, never from this +script or from model memory): + + 1. every --json file parses as JSON and contains no non-finite floats + (NaN/Infinity anywhere in the document); + 2. each --expect KEY=VALUE: KEY exists in the JSON, is a finite number, + and abs(value - VALUE) <= --tol (default 1e-3). + +Pass KEY/VALUE pairs only from rfauto kernel output or from the card files +in references/. Exit codes: 0 = all checks pass; 1 = any check fails. +Report FAIL as FAIL (rfauto rule #122); never retry a FAIL into green. +""" +from __future__ import annotations + +import argparse +import json +import math +import sys + + +def _non_finite_paths(node, prefix="$"): + bad = [] + if isinstance(node, float) and not math.isfinite(node): + bad.append(prefix) + elif isinstance(node, dict): + for key, value in node.items(): + bad += _non_finite_paths(value, prefix + "." + str(key)) + elif isinstance(node, list): + for i, value in enumerate(node): + bad += _non_finite_paths(value, prefix + "[" + str(i) + "]") + return bad + + +def main(argv=None): + parser = argparse.ArgumentParser( + description="Structural verifier for saved rfauto JSON output.") + parser.add_argument("--json", action="append", required=True, + help="saved rfauto kernel JSON (repeatable)") + parser.add_argument("--expect", action="append", default=[], + help="KEY=VALUE numeric cross-check (repeatable)") + parser.add_argument("--tol", type=float, default=1e-3) + args = parser.parse_args(argv) + + failures = [] + for path in args.json: + try: + with open(path, encoding="utf-8") as handle: + raw = handle.read() + except OSError as exc: + failures.append(path + ": unreadable (" + str(exc) + ")") + continue + try: + data = json.loads(raw) + except ValueError as exc: + failures.append(path + ": not JSON (" + str(exc) + ")") + continue + for where in _non_finite_paths(data): + failures.append(path + ": non-finite float at " + where) + if not isinstance(data, dict): + failures.append(path + ": top-level JSON is not an object") + continue + for spec in args.expect: + key, sep, value = spec.partition("=") + if not sep: + failures.append( + path + ": bad --expect " + repr(spec) + " (want KEY=VALUE)") + continue + if key not in data: + failures.append(path + ": missing key " + repr(key)) + continue + try: + got = float(data[key]) + except (TypeError, ValueError): + failures.append(path + ": key " + repr(key) + " not numeric") + continue + if not math.isfinite(got): + failures.append(path + ": key " + repr(key) + " non-finite") + continue + want = float(value) + if abs(got - want) > args.tol: + failures.append( + path + ": " + key + "=" + repr(got) + " vs expected " + + repr(want) + " (tol " + repr(args.tol) + ")") + if failures: + for line in failures: + print("FAIL " + line) + return 1 + print("PASS " + str(len(args.json)) + " file(s), " + + str(len(args.expect)) + " expectation(s)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/LICENSE.txt b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/LICENSE.txt new file mode 100644 index 00000000..e62463fa --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/LICENSE.txt @@ -0,0 +1,38 @@ +MIT License + +Copyright (c) 2026 rfauto contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +## FAQ + +**Q: Does rfauto's MIT license conflict with openEMS's GPL-3.0?** + +A: No. rfauto's main process never imports openEMS or CSXCAD Python bindings. These GPL-licensed +bindings are used only within child processes spawned by `simulation.py` (subprocess execution). +The rfauto repository itself contains no GPL code. Users compile bindings separately from the +openEMS source repository. + +**Q: Can I use rfauto commercially?** + +A: Yes, rfauto itself is MIT-licensed. However, you need valid licenses for any commercial EDA +software you use with it (Ansys AEDT/HFSS, Keysight ADS). rfauto does not provide or facilitate +any license circumvention. diff --git a/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/SKILL.md b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/SKILL.md new file mode 100644 index 00000000..073f289c --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/SKILL.md @@ -0,0 +1,81 @@ +--- +name: rfauto-wilkinson-power-divider +description: >- + 用 rfauto 设计、仿真或调参 Wilkinson 功分器时使用。涵盖两路等分、λ/4 臂综合和隔离电阻,以及配方驱动的 run、tune、autotune、calibrate 工作流。触发词:wilkinson、power divider、splitter、isolation resistor、arm length、威尔金森、功分器、等分、隔离电阻、臂长。N 路和不等分变体(见其他 rfauto 卡),以及 branchline、ratrace、gysel 耦合器,不适用本卡。数值只来自 rfauto 内核与 references/ 下的卡片文件。 +license: 完整条款见本目录 LICENSE.txt +compatibility: 需要 PATH 中可用的 rfauto 命令(公开仓源码安装:在仓根执行 pip install -e .)。闭式综合可离线运行;引擎步骤需本机装有 openEMS 或 HFSS。 +metadata: + author: rfauto + version: '2' + rfauto_model: wilkinson_power_divider + card_kind: recipe+capability+kernel + generator: 'curated from recipe_to_skill; spec: agentskills.io / rfauto T-Q10' + source_recipe: recipes/wilkinson_pd_v1.yaml + source_cards: docs/capability_cards/wilkinson.md, docs_site/kernel_cards/wilkinson.md +allowed-tools: Bash(rfauto:*) Read +--- + +# rfauto skill:wilkinson_power_divider + +## 器件与目标 + +- 模型插件:`wilkinson_power_divider`;扫频 1.5–3.5 GHz。 +- 带内目标(objectives): + - `s11_db` max_below -15 @ [2.3, 2.5] GHz + - `s21_db` mean_within [-3.6, -3.1] @ [2.3, 2.5] GHz + - `iso_s23_db` min_above 20 @ [2.3, 2.5] GHz + +## 可调参数(optimization.params) + +| 参数 | low | high | +|---|---|---| +| arm_len_mm | 18.0 | 23.0 | +| series_w_mm | 0.25 | 0.45 | +| shunt_w_mm | 0.9 | 1.3 | + +## 标准工作流(typed 命令,数值由确定性内核产出) + +```bash +rfauto validate wilkinson_pd_v1.yaml # 配方校验 +rfauto run wilkinson_pd_v1.yaml -a fake # fake 快验证(秒级) +rfauto autotune wilkinson_pd_v1.yaml --budget 3 # 确定性 critique 自治环 +rfauto tune wilkinson_pd_v1.yaml -a openems --max-trials 30 # 外环寻优 +rfauto calibrate wilkinson_pd_v1.yaml --sampler openems # 代理校准(如接入) +rfauto p0 --high-adapter hfss # 终验(商业求解器收口) +``` + +## 扫描 notebook 骨架(openEMS 快验证) + +```python +from rfauto.adapters.em_solver_base import EMSolverConfig +from rfauto.adapters.openems_solver import OpenEMSSolver + +solver = OpenEMSSolver(EMSolverConfig( + solver_type="openems", + freq_range_ghz=tuple([1.5, 3.5]), + mesh_resolution_mm=0.45, # 网格 base 覆盖;0=自动 λ_sub/50 +)) +solver.connect() +solver.build_geometry({"template": None, "params": {}}) # 填参数点 +result = solver.solve() +``` + +## 边界(硬约束) + +- LLM/agent 不产生物理数字:所有指标来自求解器与确定性评判器。 +- 对配方的任何修改走沙箱草稿 → 三层 Gate 审批(agent 写面隔离)。 +- FAIL 如实记录,不凑绿。 + +## When to open the reference files + +| you need | open | +|---|---| +| the full capability card (playbook, all anchors, engine precision) | `references/capability_card.md` | +| formulas, docstring pins, precision profile, code entries, test surface | `references/kernel_card.md` | +| a symptom → pitfall → fix lookup | `references/pitfalls.md` | +| the read-only stackup facts behind this recipe | `configs/materials.yaml` (source of truth) | + +## Verify before you finish + +Run `python scripts/verify_output.py --json [--expect KEY=VALUE ... --tol 1e-3]`. +FAIL is reported as FAIL (rfauto rule #122); never retry a FAIL into green. diff --git a/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/references/capability_card.md b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/references/capability_card.md new file mode 100644 index 00000000..546f2aa7 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/references/capability_card.md @@ -0,0 +1,71 @@ +# 能力卡:wilkinson + +> 由 scripts/capability_cards_export.py 离线生成(确定性输出);数据源与坑号链见文中逐条标注。 + +## 适用场景 + +- 拓扑:T型分叉 + 双 λ/4 臂(x 向并列)+ 100Ω 隔离电阻(LumpedElement) +- f0:2.5 GHz | 端口:3 | 时长 ≤30.0 ns | 网格档:0.0 mm +- 提取口径:S11/S21/S31/S23 @ MSLPort 1-3(S23 双激励第二 run,#211 footer 修复后第二激励前禁用全部非 e3_ 前缀 Excitation) +- 参数:series_w_mm, shunt_w_mm, arm_len_mm +- 基板:{"er":3.66,"h_mm":0.508} + +## 名义参数 + +| 参数 | 名义值 | +|---|---| +| arm_len_mm | 18.1 | +| series_w_mm | 0.604 | +| shunt_w_mm | 1.113 | +- 名义参数来源:`docs/templates/wilkinson/meta.yaml`(与 TEMPLATE_NOMINAL 一致性由 test_gallery_export 钉) + +## 敏感性排序(R9 先承诺) + +- 出处=computed(幅值分数登记表 `knowledge/sensitivity_rankings.yaml`;证据 scripts/sensitivity_rankings_build.py;坏条目拒收如实降级 #105) + +- 方法 central_finite_difference_elasticity | n=7 | 证据:scripts/sensitivity_rankings_build.py + +| rank | 参数 | 分数 | +|---|---|---| +| 1 | arm_len_mm | 1.0 | +| 2 | series_w_mm | 0.033767 | +| 3 | shunt_w_mm | 0.0 | +- 排序=R9 commitment_order(optimization/eipu;高敏感先钉死,平局按参数名升序) + +## 判据 + +- 锚覆盖 5:coupled_microstrip.kj_even_domain.lit-v1、cps.gamma_er.fdref-v1、mmt.inductive_post_b.hfss-v1、mmt.resonant_window_fres.hfss-v1、wilkinson.f_match.openems-hfss-v1(core/anchors;通配 + 专属) +- 健康门:无模板作用域专属健康门(gate 如实不判,#274 口径) +- 通用体检:求解健康度体检 G11 九因子(core/solve_health;service/health_service.health_check_run 按 run 装载产物判定) + +## 引擎精度卡(跨引擎仲裁锚) + +- `coupled_microstrip.kj_even_domain.lit-v1`(constant/active;闭式/文献锚(无引擎对)):kj_even_domain_dev_pct = 0.66 percent;±1.0(arbitration_interval);verdict KJ_VINDICATED_J1_PASS(Elmer 三紧缝/域缘点 even −0.180%/−0.590%/−0.439% 全 J1 PASS;p2_summary.json overall=FAIL 属 HFSS 测量面非 KJ 本体,勿混淆);证据:runs/df7_kjeven +- `cps.gamma_er.fdref-v1`(formula/active;闭式/文献锚(无引擎对)):cps_gamma_er expr = 1 + 0.9014*er**-0.6361(变量:er);±0.006(relative);证据:runs/df6_dp14m1、runs/df6_dp18c9 +- `mmt.inductive_post_b.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):inductive_post_b_dev_pct = 9.224 percent;±7.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- `mmt.resonant_window_fres.hfss-v1`(constant/active;引擎对 mmt(hfss 仲裁)):resonant_window_f_res_dev_pct = 16.6 percent;±3.0(arbitration_interval);verdict AGREE_HFSS;证据:runs/mmt_anchor_20260930 +- `wilkinson.f_match.openems-hfss-v1`(constant/active;引擎对 openems(hfss 仲裁)):wilkinson_f_match_dev_pct = 1.132503 percent;±3.0(arbitration_interval);verdict AGREE_OPENEMS;证据:runs/hfss_window_b2a/wilkinson +- 数据源:`knowledge/anchors.yaml`(仲裁锚注册表,status/版本演进口径见该文件头注;本节零计算零求值) + +## 已知边界 + +- 参数语义:series_w_mm=70.7Ω 臂宽(窄),shunt_w_mm=50Ω 馈线宽(宽),arm_len_mm=λ/4 臂长——对齐 recipe/HFSS/fake 口径(2026-09-04 统一) +- 网格:mesh_resolution_mm=网格 base 覆盖(mm);0=自动 λ_sub/50(官方口径,近走线区自动 /4) +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/references/kernel_card.md b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/references/kernel_card.md new file mode 100644 index 00000000..ef481538 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/references/kernel_card.md @@ -0,0 +1,246 @@ + + +# 内核文档卡:wilkinson + +> E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +| 字段 | 值 | +|---|---| +| 内核 ID | `wilkinson` | +| 主模块 | `src/rfauto/core/synthesis.py`(`rfauto.core.synthesis`) | +| 计算器注册表 | 未注册(AST 无 @register_calculator 装饰器——service 直调型内核,免 #231 注册表消费者三表同步) | +| KD-1 出处注册 | 2 条(kernel_file=src/rfauto/core/synthesis.py) | +| XC-P 精度档案 | 见下方「精度域」节(机读判定) | +| 数据来源 | XC-P + KD-1 + 模块 docstring/AST + anchors.yaml + tests/service 扫描 | + +## 物理语义 + +等分 Wilkinson 功分器综合:两臂 λ/4、臂阻抗 √2·Z0,臂长按臂线宽自身 εeff 精算(XA-3 迭代序),隔离电阻是集总件不进线宽链——series/shunt 口径与注册表/fake 单源对齐(#154)。 + +模块自述(docstring 首行,机读):E6a 微带线综合引擎(plan-extension_v2 §E6a)。 + +## 公式与口径 + +### 两臂 λ/4 与臂阻抗 √2·Z0 + +(docstring 原文转写) + +```latex +Z_t=\sqrt{2}\,Z_0,\qquad L_{\mathrm{arm}}=\frac{c}{4 f_0\sqrt{\varepsilon_{\mathrm{eff}}(w_{\mathrm{arm}})}} +``` + +出处:synthesize_wilkinson docstring「闭式公式」节;隔离电阻 2Z0 接两臂末端(集总件,不是线宽)。 + +docstring 逐字引文(防漂移钉):"arm_len = lambda/4 = c / (4 * f0 * sqrt(epsilon_eff))" + "series_w: Z0*sqrt(2) ≈ 70.7Ω λ/4 臂线宽(标准 Wilkinson 两臂,比馈线窄;" + +### XA-3 迭代序(臂长 εeff 取臂线宽自身) + +(口径示意(非 docstring 原式,读代码为准)) + +```latex +\mathrm{inverse\_width}(\sqrt{2}Z_0)\to\mathrm{forward\_z0}(w_{\mathrm{arm}})\to\varepsilon_{\mathrm{eff}}(w_{\mathrm{arm}})\to\lambda/4 +``` + +出处:synthesize_wilkinson docstring「XA-3 迭代序修正」节;旧口径εeff@w=1mm 近似的名义点偏差量化与 XA-5 数值锚同节在档。 + +docstring 逐字引文(防漂移钉):"inverse_width(70.7Ω)→forward_z0(w_series)→εeff(w_series)→λ/4;旧口径" + +### #154 语义对齐(series/shunt 单源口径) + +(docstring 原文转写) + +```latex +w_{\mathrm{series}}:\ \sqrt{2}Z_0\ \text{臂(窄)},\qquad w_{\mathrm{shunt}}:\ Z_0\ \text{馈线(宽)} +``` + +出处:synthesize_wilkinson docstring #154 节——同名参数跨通道(注册表/模型/fake)单源语义,防同键异义家族分裂。 + +docstring 逐字引文(防漂移钉):"#154 语义对齐:series/shunt 口径与 TEMPLATE_META.param_semantics、" + "(series=70.7Ω 臂窄、shunt=50Ω 馈线宽,2026-09-04 统一口径)。" + +### KD-1 出处注册(`src/rfauto/core/synthesis.py`,knowledge/formula_provenance.yaml 过滤) + +命中 **2** 条: + +| formula_id | symbol | kind | source_doi | refs | +|---|---|---|---|---| +| synthesis:chebyshev_lpf_g_values:01 | chebyshev_lpf_g_values | pointer | — | — | +| synthesis:patch_rin_edge_balanis:01 | patch_rin_edge_balanis | source | — | — | + +## 精度域(XC-P 精度档案) + +**未收录**:XC-P 首批建档内核共 **10** 个(bounds、conductor_loss、coupled_microstrip、dielectric_extract、etch_trapezoid、high_power、ridged_waveguide、shield_cavity_mode、synthesis.forward_z0、thermal_iteration),不含 `wilkinson`。因此: + +- 典型偏差分档:**UNVERIFIED**(无档案即无分档;本卡不编造任何精度数字——铁律 7 / #122 如实标注); +- 域判查询:`core/precision_profiles.py` 对未知 kernel 如实降级(收集器=`tests/unit/test_precision_profiles.py` 逐条对照防漂移); +- 建档入口:precision_profiles.yaml 增键(schema 见该文件头)+ `KERNEL_MODULES` 映射 + 模块 docstring 末尾「精度档案」镜像行 + 重跑本生成器。 + +> 本节为机读聚合:XC-P 收录状态与键清单构建时实测;本内核建档后此节自动展开为分档表(渲染支路已备)。 + +## 使用边界 + +- 隔离电阻是集总件,不参与线宽综合——线宽链只有两臂与馈线。 + - docstring 逐字引文:"隔离电阻 2*Z0=100Ω 接两臂末端,不是线宽)" +- 旧 εeff@w=1mm 近似已被 XA-3 迭代序替换;名义点偏差量化与数值锚(tests/unit/test_synthesis_patch_anchor.py)在档。 + - docstring 逐字引文:"arm_len 的 εeff 必须取臂线宽自身——" + +## 代码入口 + +主入口(file:symbol,AST 校验存在): + +- `src/rfauto/core/synthesis.py:synthesize_wilkinson` + +src/rfauto/core/synthesis.py 公开符号 **43** 个(AST 机读): + +`Stackup`、`ForwardMedia`、`forward_media`、`forward_z0`、`inverse_width`、`nominal_width_mm`、`lossless_width_mm`、`SynthesisResult`、`synthesize_mline`、`synthesize_batch`、`ModelSynthesisResult`、`synthesize_wilkinson`、`synthesize_branchline`、`patch_fringing_delta_l`、`patch_rin_edge_balanis`、`patch_cavity_metrics`、`synthesize_patch`、`synthesize_mline_model`、`synthesize_cpw_model`、`synthesize_dipole_model`、`synthesize_wstep_model`、`synthesize_tjunc_model`、`synthesize_bend_model`、`synthesize_via_model`、`synthesize_atten_pi_model`、`synthesize_atten_t_model`、`synthesize_ratrace_model`、`synthesize_gysel_model`、`synthesize_stripline_model`、`synthesize_cps_model`、`synthesize_suspended_stripline_model`、`synthesize_msl_cpw_model`、`synthesize_siw_model`、`synthesize_msl_siw_taper_model`、`synthesize_sma_launcher_model`、`synthesize_bpf_model`、`hairpin_design_from_order`、`synthesize_hairpin_model`、`chebyshev_lpf_g_values`、`synthesize_multisection_quarter_wave`、`synthesize_nway_wilkinson`、`schiffman_delta_phase`、`synthesize_schiffman` + +消费面(service/adapters 引用扫描,机读): + +- service:`src/rfauto/service/anchor_family_service.py` +- service:`src/rfauto/service/diagram_stackup_service.py` +- service:`src/rfauto/service/em_bench_service.py` +- service:`src/rfauto/service/even_odd_service.py` +- service:`src/rfauto/service/kicad_em_service.py` +- service:`src/rfauto/service/level2_design.py` +- service:`src/rfauto/service/meep_sampling.py` +- service:`src/rfauto/service/package_chain_service.py` +- service:`src/rfauto/service/qucsator_service.py` +- service:`src/rfauto/service/teaching_service.py` +- service:`src/rfauto/service/unit_convert_service.py` +- adapters:`src/rfauto/adapters/comsol_adapter.py` +- adapters:`src/rfauto/adapters/edb_templates/schema.py` +- adapters:`src/rfauto/adapters/fake_adapter/adapter.py` +- adapters:`src/rfauto/adapters/fake_adapter/antenna_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/coupler_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/filter_family.py` +- adapters:`src/rfauto/adapters/fake_adapter/tl_family.py` +- adapters:`src/rfauto/adapters/layout_generator.py` +- adapters:`src/rfauto/adapters/meep_adapter.py` +- adapters:`src/rfauto/adapters/oe_templates/_nominal_width.py` +- adapters:`src/rfauto/adapters/oe_templates/closedform.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c3.py` +- adapters:`src/rfauto/adapters/oe_templates/render_c4.py` +- adapters:`src/rfauto/adapters/oe_templates/render_coupled_bpf.py` +- adapters:`src/rfauto/adapters/oe_templates/render_diplexer_ridged.py` +- adapters:`src/rfauto/adapters/oe_templates/render_hairpin.py` +- adapters:`src/rfauto/adapters/oe_templates/render_phase_qwt.py` +- adapters:`src/rfauto/adapters/oe_templates/render_sicl_nway.py` +- adapters:`src/rfauto/adapters/oe_templates/render_siw.py` +- adapters:`src/rfauto/adapters/oe_templates/render_ta_wave_c.py` +- adapters:`src/rfauto/adapters/qucsator_adapter.py` + +## 锚与测试入口 + +analytic-anchor(knowledge/anchors.yaml 机读命中): + +| anchor_id | quantity | +|---|---| +| `c3.k_of_g.openems-hfss-v1` | k_of_g | +| `mline.z0_ohm.closedform-v1` | mline_z0_ohm | +| `ratrace.r_ring_mm.closedform-v1` | ratrace_r_ring_mm | +| `ratrace.ring_z_ohm.closedform-v1` | ratrace_ring_z_ohm | +| `schiffman.delta_phase.closedform-v1` | schiffman_delta_phase_deg | + +判据书/规格指针(docstring 逐字引文钉): + +- `tests/unit/test_synthesis_patch_anchor.py`——引文:"tests/unit/test_synthesis_patch_anchor.py)。" + +测试面(tests/unit 引用扫描,机读;合计 **1642** 个 test 函数): + +| 测试文件 | test 函数数 | +|---|---| +| `tests/unit/test_a3c_coupled_interdigital.py` | 20 | +| `tests/unit/test_anchd_analytic_anchors.py` | 7 | +| `tests/unit/test_anchors_correction.py` | 30 | +| `tests/unit/test_aniso_separation.py` | 7 | +| `tests/unit/test_array_templates.py` | 25 | +| `tests/unit/test_atten_pi_template.py` | 10 | +| `tests/unit/test_atten_t_template.py` | 9 | +| `tests/unit/test_audit_fix_core_visibility.py` | 15 | +| `tests/unit/test_bend_template.py` | 7 | +| `tests/unit/test_cal_wizard.py` | 37 | +| `tests/unit/test_calculators.py` | 49 | +| `tests/unit/test_coupled_bpf_template.py` | 34 | +| `tests/unit/test_coupling_matrix.py` | 52 | +| `tests/unit/test_cps_template.py` | 20 | +| `tests/unit/test_cpw_template.py` | 11 | +| `tests/unit/test_diplexer_ridged_templates.py` | 28 | +| `tests/unit/test_dipole_template.py` | 7 | +| `tests/unit/test_edb_templates.py` | 25 | +| `tests/unit/test_edb_templates_ext.py` | 38 | +| `tests/unit/test_eep_templates.py` | 19 | +| `tests/unit/test_engine_benchmark_expand_golden.py` | 25 | +| `tests/unit/test_gysel_template.py` | 15 | +| `tests/unit/test_hairpin_alt_template.py` | 26 | +| `tests/unit/test_hairpin_kgap_correction.py` | 16 | +| `tests/unit/test_hairpin_template.py` | 37 | +| `tests/unit/test_impedance_drc.py` | 27 | +| `tests/unit/test_interdigital_template.py` | 31 | +| `tests/unit/test_level2_design.py` | 62 | +| `tests/unit/test_marchand_two_section.py` | 22 | +| `tests/unit/test_marchand_via_ab.py` | 18 | +| `tests/unit/test_materials_loader.py` | 15 | +| `tests/unit/test_meep_adapter.py` | 38 | +| `tests/unit/test_mf_synthesis.py` | 33 | +| `tests/unit/test_mline_template.py` | 7 | +| `tests/unit/test_msl_cpw_template.py` | 19 | +| `tests/unit/test_msl_siw_taper_template.py` | 15 | +| `tests/unit/test_mtrl_kit_kicad.py` | 16 | +| `tests/unit/test_oe_phase3_driver.py` | 42 | +| `tests/unit/test_package_chain.py` | 37 | +| `tests/unit/test_patch_feed_offset_unification.py` | 6 | +| `tests/unit/test_pk2_vertical_lit_and_wiring.py` | 10 | +| `tests/unit/test_port_renormalize.py` | 14 | +| `tests/unit/test_qucsator_adapter.py` | 35 | +| `tests/unit/test_qw10_qw11.py` | 14 | +| `tests/unit/test_ratrace_template.py` | 19 | +| `tests/unit/test_rf_matrix_branchline.py` | 53 | +| `tests/unit/test_ring_resonator_template.py` | 25 | +| `tests/unit/test_rp1_myj_sec4_05_prototype.py` | 6 | +| `tests/unit/test_rp1_pozar_patch_example.py` | 3 | +| `tests/unit/test_rules_verify.py` | 6 | +| `tests/unit/test_schiffman_qwt_templates.py` | 26 | +| `tests/unit/test_sensanc_analytic_anchors.py` | 11 | +| `tests/unit/test_shell_below_service_ratchet.py` | 3 | +| `tests/unit/test_sicl_nway_templates.py` | 26 | +| `tests/unit/test_siw_template.py` | 26 | +| `tests/unit/test_sma_launcher_template.py` | 22 | +| `tests/unit/test_stackup_diagram.py` | 39 | +| `tests/unit/test_stepped_coupled_line_specs.py` | 8 | +| `tests/unit/test_stripline_template.py` | 12 | +| `tests/unit/test_suspended_stripline_template.py` | 19 | +| `tests/unit/test_symbolic_fit.py` | 15 | +| `tests/unit/test_synthesis.py` | 14 | +| `tests/unit/test_synthesis_bpf_asym_tz.py` | 8 | +| `tests/unit/test_synthesis_bpf_polish_backsub.py` | 8 | +| `tests/unit/test_synthesis_multisection.py` | 31 | +| `tests/unit/test_synthesis_patch_anchor.py` | 16 | +| `tests/unit/test_tjunc_template.py` | 8 | +| `tests/unit/test_unit_convert_service.py` | 13 | +| `tests/unit/test_varactor.py` | 26 | +| `tests/unit/test_varactor_bpf_template.py` | 12 | +| `tests/unit/test_via_template.py` | 7 | +| `tests/unit/test_w1s3_lange_stepped.py` | 11 | +| `tests/unit/test_w3s11_ring.py` | 12 | +| `tests/unit/test_w3s15_analytic_anchors.py` | 7 | +| `tests/unit/test_w4_a_sm_core.py` | 21 | +| `tests/unit/test_w4_w4e_anchors.py` | 10 | +| `tests/unit/test_w4s15_anchor_batch.py` | 11 | +| `tests/unit/test_w6_d_so_leftovers.py` | 32 | +| `tests/unit/test_w6_f_anchors_cpw.py` | 7 | +| `tests/unit/test_width_single_source.py` | 11 | +| `tests/unit/test_wilkinson_synthesis_semantics.py` | 7 | +| `tests/unit/test_wstep_template.py` | 8 | +| `tests/unit/test_x5_analytic_anchors.py` | 13 | + +XC-P 精度档案收集器(防漂移对照面):`tests/unit/test_precision_profiles.py`;本卡保鲜门:`tests/unit/test_kernel_cards.py`。 + +## 关联 + +- [架构与方法论(锚体系/判据先行)](../architecture/methodology.md) +- [分层架构](../explanation/layered-architecture.md) +- [计算器注册表](../reference/calculators.md)——本内核的注册状态见元数据表 +- 同批内核卡:[macromodel](macromodel.md)、[rwg_mmt](rwg_mmt.md)、[pdn](pdn.md)、[pce](pce.md)、[cascade](cascade.md)、[mline](mline.md)、[branchline](branchline.md)、[ratrace](ratrace.md)、[patch](patch.md)、[hairpin](hairpin.md)、[cpw](cpw.md)、[slotline](slotline.md)、[coupled_microstrip](coupled_microstrip.md)、[finline](finline.md)、[wilkinson_unequal](wilkinson_unequal.md)、[atten_pi](atten_pi.md)、[atten_t](atten_t.md)、[qwt_multisection](qwt_multisection.md)、[nway_wilkinson](nway_wilkinson.md)、[schiffman](schiffman.md)、[bethe_hole_coupler](bethe_hole_coupler.md)、[gysel_core](gysel_core.md)、[coupled_line_bpf](coupled_line_bpf.md)、[lange](lange.md)、[stepped_impedance](stepped_impedance.md)、[ring_resonator](ring_resonator.md)、[mixer_conversion](mixer_conversion.md)、[ruthroff_balun](ruthroff_balun.md)、[gd_equalizer](gd_equalizer.md)、[measurement_drift](measurement_drift.md)、[agc_loop](agc_loop.md)、[cal_kit_verify](cal_kit_verify.md)、[six_port](six_port.md)、[iss_on_wafer](iss_on_wafer.md)、[source_power_cal](source_power_cal.md)、[combline](combline.md)、[cps](cps.md)、[interdigital](interdigital.md)、[siw](siw.md)、[slot](slot.md)、[stripline](stripline.md)、[suspended_stripline](suspended_stripline.md)、[dipole](dipole.md)、[helix](helix.md)、[link_limits](link_limits.md)、[fec_codes](fec_codes.md)、[directional_bridge](directional_bridge.md)、[rf_switch](rf_switch.md)、[kuroda_identities](kuroda_identities.md)、[pll_lock_time](pll_lock_time.md)、[multisection_coupler](multisection_coupler.md)、[itu_link](itu_link.md)、[link](link.md)、[dgs](dgs.md)、[if_digitizer](if_digitizer.md)、[wg_dielectric_window](wg_dielectric_window.md)、[waveguide_closed_form](waveguide_closed_form.md)、[waveguide_iris](waveguide_iris.md)、[hybrid_junction](hybrid_junction.md)、[radar_eq](radar_eq.md)、[modulation_ber](modulation_ber.md)、[coax_line](coax_line.md)、[analog_modulation](analog_modulation.md)、[si_ctle](si_ctle.md)、[propagation](propagation.md)、[hf_skywave](hf_skywave.md)、[fmcw_radar](fmcw_radar.md)、[sar_geometry](sar_geometry.md)、[gnss_geometry](gnss_geometry.md)、[radar_clutter](radar_clutter.md)、[microstrip_disc](microstrip_disc.md)、[open_wire_line](open_wire_line.md)、[wg_cavity_bpf](wg_cavity_bpf.md) diff --git a/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/references/pitfalls.md b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/references/pitfalls.md new file mode 100644 index 00000000..00f7e1c9 --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/references/pitfalls.md @@ -0,0 +1,26 @@ +# rfauto wilkinson · failure-mode playbook + +> Extracted verbatim from the capability card「失败模式坑账链」section (docs/capability_cards/wilkinson.md; deterministic +> regeneration). Pit numbers (#NNN) are rfauto DEVLOG ledger +> markers. Symptom → pitfall chain → disposition; open this file +> when a run shows one of the listed symptoms. + +- 失败模式坑账链(playbook 命中 17 条,坑号 #NNN 为 DEVLOG 出处标记): + + - `fdtd_truncation_artifact`(fdtd_truncation_artifact;坑:#262、#84、#266)——窄 FC 窗/NrTS 截断长脉冲 → |S11|>1 假象;max|S11|>1 先查截断再怀疑物理 + - `sparam_nonphysical_investigate`(sparam_nonphysical_investigate;坑:#262、#174)——无衰减证据时的保守候选:截断已排除才升级物理怀疑 + - `single_excitation_mask_semantics`(single_excitation_mask_semantics;坑:#314、#248)——单激励产物零填充/互易补齐元素不构成互易证据;全矩阵比对是假阳性指纹 + - `true_reciprocity_violation`(true_reciprocity_violation;坑:#314、#257)——独立已测对上的互易破坏才是真破坏 + - `hfss_cad_unite_failure`(hfss_cad_unite_failure;坑:#310、#285)——unite 返回 False/合并后对象数>1=金属网络不连通,馈电不导电 + - `hfss_sheet_compression_undecidable`(hfss_sheet_compression_undecidable;坑:#264、#122)——多轮网格/端口排查互差小且仍 UNDECIDABLE=建模路径可疑,非数据坏 + - `pyaedt_session_leak`(pyaedt_session_leak;坑:#265、#308)——退出未 release 占 HFSS 轨;杀前先看命令行 + - `pyaedt_geometry_selection_api`(pyaedt_geometry_selection_api;坑:#285、#308)——gRPC 通道损坏后 finally release 可能静默失败,先修对象引用 + - `excitation_zero_volume`(excitation_zero_volume;坑:#174)——全带 |S11|≈0dB 平推=死激励指纹 + - `grid_near_coincident_lines`(grid_near_coincident_lines;坑:#152、#349)——nm 级近重合线 → CFL 时间步塌缩多个量级,症状常在端口链下游 + - `fake_cost_degenerate`(fake_cost_degenerate;坑:#195、#118)——窄带谐振带内 max 是常数陷阱;谷深语义走显式指标名 + - `probe_window_low_confidence`(probe_window_low_confidence;坑:#283、#282)——探针盒 <2 格/中线不落线 → 端口链偏差混入噪声 + - `dissipation_power_mismatch`(dissipation_power_mismatch;坑:#218、#244)——功率守恒破坏先查建模量纲再查物理 + - `thermal_model_implausible`(thermal_model_implausible;坑:#233)——恒温陷阱=热源项未被消费的典型症状 + - `hfss_port_convention_gap`(hfss_port_convention_gap;坑:#285、#307、#282、#335)——两引擎对同一设计可方向相反地偏;单引擎归因不可外推 + - `judgment_gate_fail`(judgment_gate_fail;坑:#122、#345)——通用裁决失败候选——更具体族同击时以其为主 + - `run_execution_failed`(run_execution_failed;坑:#144、#295)——status=failed 的执行层失败;物理判读前先排除环境/路径问题 diff --git a/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/scripts/verify_output.py b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/scripts/verify_output.py new file mode 100644 index 00000000..b1b4b7bd --- /dev/null +++ b/external_plugins/rfauto/skills/rfauto-wilkinson-power-divider/scripts/verify_output.py @@ -0,0 +1,97 @@ +"""Deterministic output verifier for the rfauto wilkinson skill package. + +Structural checks only — zero physics claims (rfauto rule 7: numbers come +from the rfauto kernel or the card files in references/, never from this +script or from model memory): + + 1. every --json file parses as JSON and contains no non-finite floats + (NaN/Infinity anywhere in the document); + 2. each --expect KEY=VALUE: KEY exists in the JSON, is a finite number, + and abs(value - VALUE) <= --tol (default 1e-3). + +Pass KEY/VALUE pairs only from rfauto kernel output or from the card files +in references/. Exit codes: 0 = all checks pass; 1 = any check fails. +Report FAIL as FAIL (rfauto rule #122); never retry a FAIL into green. +""" +from __future__ import annotations + +import argparse +import json +import math +import sys + + +def _non_finite_paths(node, prefix="$"): + bad = [] + if isinstance(node, float) and not math.isfinite(node): + bad.append(prefix) + elif isinstance(node, dict): + for key, value in node.items(): + bad += _non_finite_paths(value, prefix + "." + str(key)) + elif isinstance(node, list): + for i, value in enumerate(node): + bad += _non_finite_paths(value, prefix + "[" + str(i) + "]") + return bad + + +def main(argv=None): + parser = argparse.ArgumentParser( + description="Structural verifier for saved rfauto JSON output.") + parser.add_argument("--json", action="append", required=True, + help="saved rfauto kernel JSON (repeatable)") + parser.add_argument("--expect", action="append", default=[], + help="KEY=VALUE numeric cross-check (repeatable)") + parser.add_argument("--tol", type=float, default=1e-3) + args = parser.parse_args(argv) + + failures = [] + for path in args.json: + try: + with open(path, encoding="utf-8") as handle: + raw = handle.read() + except OSError as exc: + failures.append(path + ": unreadable (" + str(exc) + ")") + continue + try: + data = json.loads(raw) + except ValueError as exc: + failures.append(path + ": not JSON (" + str(exc) + ")") + continue + for where in _non_finite_paths(data): + failures.append(path + ": non-finite float at " + where) + if not isinstance(data, dict): + failures.append(path + ": top-level JSON is not an object") + continue + for spec in args.expect: + key, sep, value = spec.partition("=") + if not sep: + failures.append( + path + ": bad --expect " + repr(spec) + " (want KEY=VALUE)") + continue + if key not in data: + failures.append(path + ": missing key " + repr(key)) + continue + try: + got = float(data[key]) + except (TypeError, ValueError): + failures.append(path + ": key " + repr(key) + " not numeric") + continue + if not math.isfinite(got): + failures.append(path + ": key " + repr(key) + " non-finite") + continue + want = float(value) + if abs(got - want) > args.tol: + failures.append( + path + ": " + key + "=" + repr(got) + " vs expected " + + repr(want) + " (tol " + repr(args.tol) + ")") + if failures: + for line in failures: + print("FAIL " + line) + return 1 + print("PASS " + str(len(args.json)) + " file(s), " + + str(len(args.expect)) + " expectation(s)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/external_plugins/rfauto/skills/veriloga-authoring/LICENSE.txt b/external_plugins/rfauto/skills/veriloga-authoring/LICENSE.txt new file mode 100644 index 00000000..e62463fa --- /dev/null +++ b/external_plugins/rfauto/skills/veriloga-authoring/LICENSE.txt @@ -0,0 +1,38 @@ +MIT License + +Copyright (c) 2026 rfauto contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- + +## FAQ + +**Q: Does rfauto's MIT license conflict with openEMS's GPL-3.0?** + +A: No. rfauto's main process never imports openEMS or CSXCAD Python bindings. These GPL-licensed +bindings are used only within child processes spawned by `simulation.py` (subprocess execution). +The rfauto repository itself contains no GPL code. Users compile bindings separately from the +openEMS source repository. + +**Q: Can I use rfauto commercially?** + +A: Yes, rfauto itself is MIT-licensed. However, you need valid licenses for any commercial EDA +software you use with it (Ansys AEDT/HFSS, Keysight ADS). rfauto does not provide or facilitate +any license circumvention. diff --git a/external_plugins/rfauto/skills/veriloga-authoring/SKILL.md b/external_plugins/rfauto/skills/veriloga-authoring/SKILL.md new file mode 100644 index 00000000..ff2e8f9d --- /dev/null +++ b/external_plugins/rfauto/skills/veriloga-authoring/SKILL.md @@ -0,0 +1,142 @@ +--- +name: veriloga-authoring +description: >- + 用户要编写、生成、修复或评审 rfauto 解析器能接受的 Verilog-A 行为模型(.va)时使用。覆盖 module 骨架、端口、electrical 网络、参数、analog 块、贡献语句 V()/I() <+ expr、事件注册,以及可接受的中缀表达式子集。配套只读内核为 src/rfauto/core/veriloga_parser.py,服务入口是 parse_veriloga_file。触发词:veriloga、Verilog-A、.va、behavioral model、analog block、contribution statement、<+、Verilog-A 行为模型、.va 贡献语句、模拟行为块、参数化。Verilog-D 门级网表(rfauto verilog 域)、SPICE 子电路和 ADS netlist 不适用本卡。本 skill 只讲语法和流程,不给物理参数值;每个数值都必须来自确定性内核(铁律 7),不能靠模型记忆。 +license: 完整条款见本目录 LICENSE.txt +compatibility: 纯文档加校验型 skill。解析自检可离线运行,需已安装 rfauto 包(python -c "from rfauto.service.veriloga_service import parse_veriloga_file"),不需要任何引擎(openEMS/HFSS/ADS),也不需要联网。 +metadata: + author: rfauto + version: '1' + kind: language-authoring + source_kernel: src/rfauto/core/veriloga_parser.py + provenance: hand-authored original content (AX-5, aurora_r seat R-04); grammar + subset distilled from kernel source reading; zero text from external + repositories (veriloga-skills has no LICENSE — structure ideas only) +allowed-tools: Read Write Bash(python:*) Bash(rfauto:*) +--- + +# rfauto · veriloga-authoring + +> Hand-curated skill (not machine-generated by `card_to_skill`). It is the +> **write half** of the Verilog-A pair: `src/rfauto/core/veriloga_parser.py` +> is the **read half**. Every grammar rule below was verified against the +> kernel source and is machine-pinned by +> `tests/unit/test_veriloga_authoring_skill.py`: every ```va block in this +> package parses with **zero warnings** and every contribution RHS normalizes +> to a prefix tree; ```va-rejected blocks are fatal-parse cases; ```va-warned +> blocks are fail-soft cases. Rule 7: this skill teaches grammar and workflow +> only — it contains no physical parameter values (all defaults in examples +> are structural placeholders). + +## When this skill applies + +| situation | use | +|---|---| +| user asks for a new .va behavioral module (port I-V relations, parameterized) | write the module skeleton per the golden rules below, then run the parse-fix loop in `references/workflow.md` | +| user pastes a .va file and asks why rfauto reports errors/warnings | look up the exact message in `references/common-rejections.md`, apply the fix, re-parse | +| user asks what Verilog-A subset rfauto supports | answer from `references/accepted-grammar.md` (the kernel's structural subset, with source evidence) | +| user asks to *simulate* a .va (transient/AC behavior) | out of scope — rfauto's Verilog-A face is structural parsing only; no .va solver exists in this repo | + +## The golden rules (each with kernel evidence) + +1. **One file, complete modules.** `module name (ports);` ... `endmodule`. + A missing `endmodule` does not abort the parse (fail-soft warning + `unterminated_module`), but a clean parse has zero warnings — always close + the module. Evidence: `_parse_module_body` EOF branch warns + `unterminated_module` instead of raising. +2. **Declare ports with a direction, always.** Both styles parse: ANSI header + `module m (input a, output b);` or 1995 header `module m (a, b);` plus body + lines `input a;` / `output b;`. Directions from body declarations backfill + header-only names. Evidence: `_parse_header_ports` + `_parse_direction_decl`. + A port never given a direction anywhere simply never appears in the ports + table (silent omission) — so write the direction. +3. **Declare every node `electrical`.** `electrical p, n;` (multi-name one + decl is fine). Types outside the known word list (electrical/wire/wand/ + wor/tri/reg) trigger warning `unknown_net_type`. Evidence: `KNOWN_NET_TYPES` + + `_parse_net_decl(unknown_type=True)`. +4. **Declare parameters in the module body, not the `#(...)` header.** + `parameter real r = 1.0 from [0:inf);` lands in the param table with a + structured range; `module m #(parameter real r = 1.0) (p, n);` is consumed + raw and the parameter is **silently absent** from the param table (zero + warnings — data loss). Evidence: `parse_module` discards + `header_params_raw`; `_parse_param_decl` records body params. +5. **Analog behavior goes in `analog begin ... end`** (or one statement + `analog V(p, n) <+ ...;`). Contribution statements are the payload: + `V(out) <+ expr;` / `I(m) <+ expr;` / `V(p, n) <+ expr;`. The parser + counts statements by category and normalizes each contribution RHS into a + prefix tree — an RHS that fails normalization keeps its raw text but loses + the tree (warning `expr_normalize_failed`), which breaks downstream + consumers. Evidence: `_classify_simple_stmt` + `expr_to_prefix`. +6. **Stay inside the operator closed set in contribution RHS:** + `|| && == > < >= <= + - * / % ** ?:`, unary `- !`, calls `f(a, b)`, + access `V(x)`/`I(x)` (same shape as calls), index `a[i]`, range index + `a[m:n]`. Bitwise `& | ^ ~ << >>` are **not** in the precedence table — + an RHS containing them fails normalization (fail-closed by design). + Evidence: `PRECEDENCE` dict + probe: `V(b) <+ V(a) & V(a);` → warning + `expr_normalize_failed`, tree None. +7. **No system tasks inside expressions.** `$realtime`, `$temperature` etc. + are lexed as `sys` tokens and rejected by the expression normalizer + (warning `expr_normalize_failed`, RHS tree None). Evidence: `expr_to_prefix` + raises on non-num/id/str/punct tokens. +8. **No `case`, no named blocks, no `generate`, no `analog function` bodies.** + `case` corrupts statement attribution (its labels merge into the next + contribution LHS and the module closure is miscounted); `begin : name` + leaks `: name` into the next statement's LHS; `analog function` bodies are + skipped with a warning. Use `if/else` chains and anonymous `begin/end`. + Evidence: probe of `case (m)` → `unterminated_module` warning + + `lhs: 'case(m) 0 : V(b)'`; named block probe → `lhs: ': blk V(b)'`; + `_parse_analog` function branch warns `analog_function_skipped`. +9. **Attributes are written as `(* text *)` directly before `module`** + (document-level) — they attach to that module verbatim. Evidence: + `_consume_attributes` pending slot. +10. **Events are registered, not interpreted.** `@(initial_step)` / + `@(cross(V(out) - v, +1))` — event name + raw args land in the events + table and the host statement is still classified. Evidence: `_parse_event`. + +## Minimal skeleton (parses clean: 0 warnings, tree non-None) + +```va +// behavioral one-port, placeholder default (not a design value) +module r_branch (p, n); + electrical p, n; + parameter real r = 1.0 from [0:inf); + analog begin + V(p, n) <+ r * I(p, n); + end +endmodule +``` + +## Write → parse → fix loop + +After writing or editing any .va text, run the parse self-check and iterate +until the clean-parse bar is met (see `references/workflow.md`): + +```python +from rfauto.service.veriloga_service import parse_veriloga_file +result = parse_veriloga_file("my_model.va") +assert result["ok"], result["errors"] +assert result["warnings"] == [], result["warnings"] +assert all(c["rhs_prefix_tree"] is not None + for m in result["modules"].values() + for c in m["analog"]["contributions"]) +``` + +FAIL is reported as FAIL (rfauto rule #122): never widen the skill's claims +to make a failing parse look green — fix the .va, or record that the form is +outside the accepted subset. + +## When to open the reference files + +| you need | open | +|---|---| +| the full accepted grammar (lexical, module, param, analog, expression) with kernel evidence per rule | `references/accepted-grammar.md` | +| an exact parse error or warning name, and its fix | `references/common-rejections.md` | +| the step-by-step write → parse → fix loop with a worked example | `references/workflow.md` | + +## Verify before you finish + +- Self-check: the python snippet above on every .va you produced (clean bar: + `ok=True`, zero warnings, all contribution trees non-None). +- Package contract: `tests/unit/test_veriloga_authoring_skill.py` re-parses + every ```va block in this package — keep examples and claims in sync when + editing these files. diff --git a/external_plugins/rfauto/skills/veriloga-authoring/references/accepted-grammar.md b/external_plugins/rfauto/skills/veriloga-authoring/references/accepted-grammar.md new file mode 100644 index 00000000..5696cd2a --- /dev/null +++ b/external_plugins/rfauto/skills/veriloga-authoring/references/accepted-grammar.md @@ -0,0 +1,243 @@ +# Accepted grammar: the structural subset rfauto's Verilog-A parser accepts + +> Source of truth: `src/rfauto/core/veriloga_parser.py` (read-only kernel, +> Q-X80). This document distills the subset from the kernel source; every +> rule carries an evidence pointer (function/constant name in that file). +> All ```va blocks in this package are machine-pinned by +> `tests/unit/test_veriloga_authoring_skill.py` (clean parse: zero warnings, +> all contribution RHS prefix trees non-None). +> +> Scope: the kernel parses **structure** and normalizes **expression shape**. +> It never evaluates, never interprets analog solver semantics, never expands +> `generate`, never enters `analog function` bodies or `discipline` bodies +> (both are name-registered and skipped). Numbers are carried as the literal +> strings from the source text, never computed. + +## 1. Lexical layer (`tokenize_veriloga`) + +| form | accepted | evidence / note | +|---|---|---| +| line comment | `// ...` to end of line | consumed, produces no token | +| block comment | `/* ... */` | unclosed → **fatal** `VerilogAParseError`("块注释未闭合",带行号) | +| string literal | `"..."` with `\` escape | unclosed → **fatal** | +| identifier | `[A-Za-z_][A-Za-z0-9_$]*` | `$` allowed inside names | +| escaped identifier | `\name` up to whitespace | lone `\` without a name → **fatal** | +| number | `50` `1_000` `1.5` `.5` `1e-3` `1.5E+2` | `_` digit separator accepted; recovered as int/float **only** for pure literals (`parse_number_literal`), otherwise kept as raw text | +| sized/bit literals | `8'b0`, `'h1F`, ... | **rejected**: `'` is not a recognized character (fatal "无法识别的字符") | +| compiler directive | `` `define X`` etc. | backtick + rest of line consumed as one `dir` token; never interpreted | +| system token | `$realtime` `$temperature` ... | lexed as `sys`; **rejected inside expressions** (see §6) | +| attribute | `(* ... *)` | two standalone tokens; content preserved verbatim into an `attributes` list | +| 2-char operators | `<+` `**` `<=` `>=` `==` `!=` `&&` `||` | maximal munch (longest match first) | +| other punctuation | `()[]{}:;,.=+-*/%<>?!@#&|^~` | single-char fallback | +| anything else | — | **fatal** "无法识别的字符" (zero-progress guard) | +| nesting | `()[]{}` depth ≤ 512 (`MAX_NEST_DEPTH`) | deeper → **fatal** (pathological-input guard) | + +## 2. Module structure (`parse_module`, `_parse_header_ports`, `_parse_direction_decl`) + +Two port styles are unified; a clean file picks one per module: + +```va +module ansi_style (input a, output b, inout electrical c); + electrical a, b, c; + analog begin + V(b) <+ V(a); + end +endmodule +``` + +```va +module classic_style (a, b); + input a; + output b; + electrical a, b; + analog V(b) <+ V(a); +endmodule +``` + +- Directions: the closed word list `input` / `output` / `inout` (`DIRECTIONS`). +- ANSI header may interleave direction words and net-type words + (`electrical`, `wire`, ...) before each port name; body declarations + (`input a;`) backfill header-listed names (`_PendingPort` merge). +- A name that appears in the header but never gets a direction anywhere does + **not** appear in the parsed `ports` table (by design: no half-guessed + ports) — always write the direction. +- `endmodule` missing → fail-soft warning `unterminated_module` (parse still + returns `ok=True` with the warning); a clean artifact has zero warnings. +- Multiple `module`s per file are kept in `module_order` (insertion order). + +## 3. Nets (`_parse_net_decl`, `KNOWN_NET_TYPES`) + +```va +module net_types (p, n, w); + electrical p, n; + wire w; + analog V(p) <+ V(n); +endmodule +``` + +- Known types: `electrical`, `wire`, `wand`, `wor`, `tri`, `reg`. + `electrical` is the analog node type — use it for analog ports/nodes. +- Unknown type identifiers: tolerated **with warning** `unknown_net_type` + when they look like `IDENT name[, name]* ;` (`_looks_like_net_decl`). +- Module-level `integer cnt;` / `real x;` therefore land as "nets" with the + type recorded verbatim plus a warning. Declare loop counters/variables + inside the analog block instead (they become ordinary statements there). +- Net ranges (`electrical [3:0] bus;`) are consumed but **not recorded** + (known limitation, documented in the kernel docstring) — avoid relying on + array nets in artifacts meant for structured consumption. + +## 4. Parameters (`_parse_param_decl`, `_parse_range`, `PARAM_TYPES`) + +```va +module param_forms (p, n); + electrical p, n; + parameter real r = 1.0 from [0:inf); + parameter integer n_mode = 0; + parameter string label = "unnamed"; + localparam real half = 0.5; + analog V(p, n) <+ r * I(p, n); +endmodule +``` + +- Types: `real` / `integer` / `string` (`PARAM_TYPES`; omitted type is + recorded as `None` — write the type explicitly). +- Default: any expression is kept as `default_raw`; a **pure numeric + literal** additionally recovers a numeric `default` (from the source text, + never computed). +- Range: optional `from ` with four bracket forms — `[a:b]`, + `[a:b)`, `(a:b]`, `(a:b)` — stored structurally (`low`, `high`, + `low_inclusive`, `high_inclusive`, `raw`); bounds stay raw text (`inf` + stays the string `"inf"`). Malformed ranges warn (`malformed_range` / + `unterminated_range`). +- Trailing clauses after the range (`exclude ...` families) are preserved in + `extra_raw`. +- `localparam` takes the same path as `parameter`. +- **Header parameters are silently dropped**: `module m #(parameter real r = + 1.0) (p, n);` — the `#(...)` group is captured and discarded + (`parse_module`), zero warnings, parameter absent from the table. Declare + parameters in the body. + +## 5. Analog block (`_parse_analog`, `_parse_analog_stmt`, `STMT_CATEGORIES`) + +Both entry forms parse: + +```va +module analog_forms (p, n); + electrical p, n; + analog begin + V(p, n) <+ V(p) - V(n); + end +endmodule +``` + +```va +module analog_single (p, n); + electrical p, n; + analog V(p, n) <+ V(p) - V(n); +endmodule +``` + +Statement classification (closed set `STMT_CATEGORIES`, all keys always +present in `stmt_counts`): + +| category | trigger | example | +|---|---|---| +| `contribution` | contains `<+` | `V(out) <+ gain * V(in);` | +| `if` / `else` / `for` / `while` | keyword | `if (sel > 0) ... else ...` | +| `event` | `@(...)` | `@(initial_step)` — name + raw args recorded, host statement still classified | +| `function_call` | `IDENT(...)` spanning the whole statement | `absform(V(in));` (statement-level call) | +| `assignment` | contains `=` (no `<+`) | `acc = acc + V(in);` | +| `block` | each `begin ... end` pair | nesting is counted, `MAX_BLOCK_DEPTH` 256 guard (deeper → **fatal**) | +| `other` | everything else | `integer i;` inside analog | + +Control structures: + +```va +module control_forms (in, out); + electrical in, out; + parameter real g = 1.0; + parameter integer mode = 0; + analog begin + @(initial_step) + acc = 0.0; + for (i = 0; i < 3; i = i + 1) + acc = acc + V(in); + if (mode > 0) + V(out) <+ g * V(in); + else + V(out) <+ V(in); + end +endmodule +``` + +- `for (...)` headers are captured whole (the `;` inside the header does not + split statements). +- `begin`/`end` pairing is counted; imbalance is fail-soft + (`stray_end` / `unterminated_block` warnings) — write balanced blocks. +- Variables (`integer i;`, `real acc;`) may be declared as statements inside + the analog block; they classify as `other` without warnings. There is no + dedicated declaration record — keep declarations minimal. + +## 6. Expressions (`expr_to_prefix`, `PRECEDENCE`) + +Contribution RHS (and only the RHS) is normalized to a **prefix tree**. +Shapes (all verified in the package contract test): + +| infix | prefix tree | +|---|---| +| `a + b * c` | `["+", "a", ["*", "b", "c"]]` | +| `V(out)` / `f(a, b)` | `["V", "out"]` / `["f", "a", "b"]` (access and call share the call shape) | +| `a[i]` / `p[m:n]` | `["[]", "a", "i"]` / `["[]", "p", "m", "n"]` | +| `c ? a : b` | `["?:", "c", "a", "b"]` (nested: right-assoc, inner goes under the else branch) | +| `-x`, `!x` | `["-", "x"]` / `["!", "x"]` (unary distinguished from binary by arity) | +| `(a + b) * c` | `["*", ["+", "a", "b"], "c"]` (parenthesized groups produce no node — grouping lives in the tree shape) | +| single operand | the operand string itself, e.g. `0.0` stays `"0.0"` | + +- **Numbers are never evaluated**: `1e-3`, `1_000`, `0.5` remain the literal + strings from the source. +- Precedence (loosest → tightest): `||` < `&&` < `==` < `> < >= <=` < `+ -` < + `* / %` < `**`; unary `- !` bind tightest; ternary `?:` is loosest of all. +- **Associativity: every binary operator is left-associative, including + `**`** (Verilog-A LRM differs from SystemVerilog here; the only + right-associative form is `?:`). `2 ** 3 ** 2` → `["**", ["**", "2", "3"], + "2"]`. +- Closed set enforcement: `& | ^ ~ << >>` (and any other operator outside the + table) raise `ExpressionNormError` — fail-closed, no guessing. In a + contribution RHS this becomes warning `expr_normalize_failed` with the raw + text preserved and tree `None`. `<<` lexes as two `<` tokens, so its error + surfaces as "表达式期待操作数". +- `$`-system tokens and `dir` tokens inside an expression are likewise + rejected (`expr_to_prefix` accepts only num/id/str/punct kinds). +- Structural failures in the normalizer: empty expression, dangling operator + (`a +` → "二元 '+' 操作数不足"), mismatched/unexpected brackets, comma + outside a call argument list, `:` without a matching `?` (outside an index + range). + +## 7. Tolerated but discouraged (fail-soft, or silently unhelpful) + +| form | what actually happens | why avoid | +|---|---|---| +| `analog function name ... endfunction` | name registered, body skipped, warning `analog_function_skipped` | body semantics are outside the subset; the model's behavior becomes invisible to the parse | +| `discipline ... enddiscipline` / `nature ... endnature` | name registered (`disciplines` list), body skipped | fine in principle, but body content is not parsed — prefer plain `electrical` in authored artifacts | +| `case (x) ... endcase` inside analog | **corrupts attribution**: labels merge into the next contribution LHS (probe: `lhs: 'case(m) 0 : V(b)'`) and block/module closure miscounts (`unterminated_module` warning) | use `if/else` chains | +| named blocks `begin : name` ... `end` | `: name` leaks into the next statement's LHS (probe: `lhs: ': blk V(b)'`, zero warnings) | use anonymous `begin/end` | +| `generate` / other module-level constructs | warning `skipped_module_stmt` / `skipped_top_level`, statement skipped | not part of the structural subset | +| module-level `integer`/`real` declarations | recorded as nets with warning `unknown_net_type` | declare inside analog instead | +| attributes inside analog statements | attribute tokens end up inside the captured statement text | place `(* ... *)` before `module` | +| `#(...)` header parameters | consumed and discarded, zero warnings (silent data loss) | declare parameters in the body | + +## 8. Clean-parse bar (the quality gate for authored .va) + +A .va artifact written against this skill is "clean" when +`parse_veriloga(text)` returns: + +1. zero `warnings`; +2. every entry of every module's `analog.contributions` has a non-None + `rhs_prefix_tree`; +3. every port appears in `ports` with a direction (nothing silently omitted); +4. every parameter appears in `params` with its `type` and (intended) + `range`. + +The write → parse → fix loop that enforces this bar is in +`workflow.md`; the machine pin is +`tests/unit/test_veriloga_authoring_skill.py`. diff --git a/external_plugins/rfauto/skills/veriloga-authoring/references/common-rejections.md b/external_plugins/rfauto/skills/veriloga-authoring/references/common-rejections.md new file mode 100644 index 00000000..f5934d39 --- /dev/null +++ b/external_plugins/rfauto/skills/veriloga-authoring/references/common-rejections.md @@ -0,0 +1,138 @@ +# Common rejections: what the parser refuses, and the fix + +> Source of truth: `src/rfauto/core/veriloga_parser.py`. Two failure +> families, and they must never be conflated: +> +> 1. **Fatal** (`VerilogAParseError`): lexical/deep-structural violations — +> the whole parse aborts. Through the service layer +> (`parse_veriloga_file`) these come back as an error envelope +> (`ok=False`, `errors` list). +> 2. **Fail-soft** (warnings): the parse completes (`ok=True`) but every +> deviation is recorded in `warnings` (each with `line`, `name`, `note`). +> A clean artifact has **zero** warnings; warnings are findings, not +> noise to be ignored (rfauto rule #122 spirit: report as-is, never +> launder). +> +> Contract blocks below: ```va-rejected must raise `VerilogAParseError`; +> ```va-warned must parse with at least one warning (or a `None` RHS tree). +> Both are pinned by `tests/unit/test_veriloga_authoring_skill.py`. + +## 1. Fatal rejections + +| message fragment | cause | fix | +|---|---|---| +| `无法识别的字符` | a character outside the lexer's set — typical culprit: sized/bit literals like `8'b0` (`'` is not lexable), stray `\` not starting an escaped identifier | write plain decimal/scientific numbers (`0`, `1.5`, `1e-3`); Verilog-A behavioral models have no use for bit vectors | +| `块注释未闭合` | `/*` without a matching `*/` | close the comment; prefer `//` line comments in authored artifacts | +| `字符串未闭合` | `"` without a closing `"` on the same scan (escapes `\` count) | close the string | +| `空文件(无任何内容)` | whitespace-only input | the file must contain at least one module | +| `孤立反斜杠` | `\` with no name after it | escaped identifiers need `\name ` (name then whitespace) | +| `括号嵌套深度超过上限` | `()[]{}` nesting beyond 512 | not a real-model shape; restructure | +| `模块 {name} 未闭合` — **not fatal**, see warnings | — | — | + +Examples (both raise `VerilogAParseError`): + +```va-rejected +// bit-vector literal: `'` is not a lexable character in this subset +module bad_bit_literal (a); + electrical a; + analog V(a) <+ 8'b0; +endmodule +``` + +```va-rejected +// block comment never closed — the whole file is refused +module bad_comment (a); + electrical a; + /* this comment has no end + analog V(a) <+ 0.0; +endmodule +``` + +## 2. Fail-soft warnings (parse completes; artifact is not clean) + +Warning names (closed set emitted by the kernel): + +| warning `name` | trigger | fix | +|---|---|---| +| `expr_normalize_failed` | contribution RHS uses an operator outside the precedence closed set (`& | ^ ~ << >>`, ternary misuse), a `$`-system token, or a malformed expression (dangling operator, mismatched brackets) | rewrite the RHS inside the accepted operator set (see `accepted-grammar.md` §6); keep bitwise/bit-fiddling logic out of analog contributions | +| `unterminated_module` | `endmodule` missing (or `case`/named-block corruption ate it) | close the module; remove `case`/named blocks | +| `stray_end` | extra `end` with no open `begin` | balance the blocks | +| `unterminated_block` | `begin` without `end`, or `discipline`/`analog function` block never closed | close the block | +| `truncated_analog` | analog block hits EOF | complete the analog block | +| `unknown_net_type` | net declared with a type outside `electrical/wire/wand/wor/tri/reg` (includes module-level `integer`/`real`) | use `electrical` for nodes; move variable declarations inside the analog block | +| `skipped_module_stmt` / `skipped_top_level` | construct outside the structural subset (`generate`, `specify`, stray tokens) | remove it or move it; it is not parsed | +| `skipped_header_token` | unexpected token in the module header port table (e.g. `[3:0]` ranges in ANSI headers) | keep the header to direction + optional type + name | +| `malformed_range` / `unterminated_range` | `from` constraint not a `[a:b]`-family interval or not closed | use one of `[a:b]` `[a:b)` `(a:b]` `(a:b)` | +| `malformed_event` | `@` without `(...)` or mismatched event brackets | write `@(name)` or `@(name(args))` | +| `analog_function_skipped` | `analog function` declaration | move the function's role into inline expressions (function bodies are not parsed) | +| `unterminated_attr` | `(* ... *)` never closed | close the attribute | + +Examples (all parse `ok=True` but carry warnings — none is clean): + +```va-warned +// '&' is not in the expression closed set -> RHS tree lost +module bad_bitwise (a, b); + electrical a, b; + analog V(b) <+ V(a) & V(a); +endmodule +``` + +```va-warned +// $-system tokens cannot appear inside a contribution RHS +module bad_systask (a, b); + electrical a, b; + analog V(b) <+ $realtime; +endmodule +``` + +```va-warned +// missing endmodule: parse completes, warning recorded, artifact not clean +module bad_unclosed (a); + electrical a; + analog V(a) <+ 0.0; +``` + +```va-warned +// module-level `integer` is read as an unknown net type +module bad_module_integer (a); + electrical a; + integer cnt; + analog V(a) <+ 0.0; +endmodule +``` + +```va-warned +// case corrupts statement attribution AND miscounts module closure +module bad_case (a, b); + electrical a, b; + parameter integer m = 0; + analog begin + case (m) + 0: V(b) <+ V(a); + default: V(b) <+ 0.0; + endcase + end +endmodule +``` + +## 3. Silent traps (zero warnings — check the output, not just ok) + +These do not warn, which makes them the dangerous half: + +- `#(...)` header parameters: consumed and discarded — the parameter never + reaches the `params` table. Fix: declare parameters in the module body. +- Header-listed port with no direction anywhere: silently absent from the + `ports` table. Fix: write the direction (header or body). +- Named blocks `begin : name`: the label leaks into the next statement's + contribution LHS text (`: blk V(b)`) with zero warnings. Fix: anonymous + `begin/end`. +- Net ranges (`electrical [3:0] bus;`): consumed but not recorded. Fix: + avoid array nets in artifacts meant for structured consumption. + +## 4. Escalation rule + +If a form you need is rejected or warned and no fix above restores a clean +parse, the form is **outside the accepted subset** — do not widen the skill's +claims and do not edit the kernel from this seat. Record the case (file + +warning/error text) and route it to the kernel owner. The kernel is +read-only ground truth for this skill (`veriloga_parser.py`, Q-X80). diff --git a/external_plugins/rfauto/skills/veriloga-authoring/references/workflow.md b/external_plugins/rfauto/skills/veriloga-authoring/references/workflow.md new file mode 100644 index 00000000..fb683da2 --- /dev/null +++ b/external_plugins/rfauto/skills/veriloga-authoring/references/workflow.md @@ -0,0 +1,139 @@ +# Workflow: write → parse → fix (the read/write loop with the kernel) + +> The kernel (`src/rfauto/core/veriloga_parser.py`) reads; this skill +> writes. The loop below is the only accepted way to finish a .va artifact +> under this skill: **an artifact that has not passed the parse self-check +> at the clean bar is not done** — regardless of how plausible the text +> looks. + +## 0. Invocation paths + +- Primary (always works, offline): the service entry — + `rfauto.service.veriloga_service.parse_veriloga_file(path)` returns the + standard JSON envelope: + - success: `{"ok": True, "path", "modules", "module_order", + "disciplines", "attributes", "warnings", "stats"}` — note `warnings` + rides along inside the ok envelope (fail-soft family); + - failure: error envelope (`ok=False`, `errors` list) for unreadable + files, fatal lexical errors, and files with no `module` declaration. +- Lower-level (core): `rfauto.core.veriloga_parser.parse_veriloga(text)` + returns the raw document dict (raises `VerilogAParseError` / + `ExpressionNormError` is absorbed into warnings per the kernel's + fail-soft rules). +- Consumers for review: `veriloga_module_summary(doc, name)`, + `veriloga_param_table(doc)`, `veriloga_contribution_pairs(doc)`. +- CLI note: a `rfauto veriloga parse/report` leaf exists as an orphan typer + domain pending main-app wiring — do not rely on the CLI leaf; use the + service path above. + +## 1. The loop + +1. **Write** the module per the golden rules (SKILL.md) and the grammar + subset (`accepted-grammar.md`). Avoid every row of the discouraged table. +2. **Self-check**: + +```python +from rfauto.service.veriloga_service import parse_veriloga_file + +result = parse_veriloga_file("my_model.va") +assert result["ok"], result["errors"] +assert result["warnings"] == [], result["warnings"] +assert all(c["rhs_prefix_tree"] is not None + for m in result["modules"].values() + for c in m["analog"]["contributions"]) +``` + +3. **Fix**: map each warning/error through `common-rejections.md` (message + fragment → cause → fix), edit the .va, and re-run step 2. One defect at + a time if the file is large; the warning's `line` field points at the + offending text. +4. **Review the structure, not just ok**: ports all have directions, + parameters all typed with intended ranges, contributions' LHS strings are + exactly the intended `V(...)`/`I(...)` access forms (silent traps in + `common-rejections.md` §3 produce zero warnings). +5. Stop only at the **clean bar**: `ok=True`, zero warnings, all + contribution trees non-None, ports/params complete as intended. + +## 2. Worked example + +Draft v1 — plausible-looking, two real defects planted (a bitwise `&` +mistaken for multiplication, and a missing `endmodule`): + +```va-warned +// v1 — NOT clean: bitwise '&' in RHS + missing endmodule +module gain_stage (in, out); + electrical in, out; + parameter real g = 1.0 from (0:inf); + parameter integer bypass = 0; + analog begin + if (bypass > 0) + V(out) <+ V(in); + else + V(out) <+ g & V(in); + end +``` + +Self-check reports (paraphrased from the envelope): + +- `warnings[0].name == "expr_normalize_failed"` — the `&` operator is not in + the precedence closed set, so the second contribution's RHS kept its raw + text but lost the tree (`rhs_prefix_tree is None`). +- `warnings[1].name == "unterminated_module"` — EOF before `endmodule`. + +Fixes: `g & V(in)` → `g * V(in)`; append `endmodule`. Re-check → v2: + +```va +// v2 — clean: ok=True, zero warnings, all RHS trees non-None +module gain_stage (in, out); + electrical in, out; + parameter real g = 1.0 from (0:inf); + parameter integer bypass = 0; + analog begin + if (bypass > 0) + V(out) <+ V(in); + else + V(out) <+ g * V(in); + end +endmodule +``` + +Readback worth eyeballing after the fix (all zero-warning here, and the LHS +strings prove no label leakage): + +- `module_order == ["gain_stage"]`; ports `[{"dir": "input", "name": "in"}, + {"dir": "output", "name": "out"}]`; +- `params[0]["range"]["raw"] == "(0:inf)"` (open-open interval preserved); +- contribution LHS `V(out)`; tree `["*", "g", ["V", "in"]]` — the parameter + reference stays a bare identifier (no evaluation anywhere; rule 7). + +## 3. Package contract (drift pin) + +`tests/unit/test_veriloga_authoring_skill.py` re-parses every ```va block in +this package every run: + +- ```va → clean bar (zero warnings, all trees non-None, at least one module); +- ```va-rejected → must raise `VerilogAParseError`; +- ```va-warned → must parse with at least one warning or a None tree. + +If you edit these documents, run: + +``` +python -m pytest tests/unit/test_veriloga_authoring_skill.py -q +``` + +A red here means the documents and the kernel disagree — fix the document +(or record that the kernel changed, for the kernel owner to arbitrate). The +kernel is never edited from the writing side. + +## 4. Honest boundaries + +- This skill covers **grammar and workflow only**. It contains no physical + values: every numeric literal in its examples is a structural placeholder, + and real parameter values must come from deterministic kernels or user + specifications (rfauto rule 7). +- rfauto's Verilog-A face is structural parsing; there is no .va simulator, + compiler, or netlister in the repo. Questions about simulation semantics + are out of scope. +- The accepted subset is the kernel's structural subset — not the full + Verilog-AMS LRM. When in doubt, the parser is the arbiter: write it, run + the self-check, and let the result (including a refusal) stand as-is. diff --git a/marketplace.json b/marketplace.json index 47b0a0be..31beffdb 100644 --- a/marketplace.json +++ b/marketplace.json @@ -1499,6 +1499,38 @@ "image-to-video", "mcp" ] + }, + { + "name": "rfauto", + "source": "./external_plugins/rfauto", + "displayName": "RFAuto", + "description": "把 RFAuto 射频/微波 EDA 框架接入 ZCode 会话:提供 208 个 MCP 工具(器件综合、仿真作业、质量门、结果判读),另附一个判读裁判 agent 和 7 张器件技能卡。所有物理数字都出自 RFAuto 确定性内核与求解器,不由模型生成。", + "description_i18n": { + "en": "Drive the RFAuto RF/microwave EDA framework from any ZCode session: 208 deterministic MCP tools covering device synthesis, simulation jobs, quality gates, and result verdicts, plus a judge agent and device skill cards. Every physical number comes from the RFAuto deterministic kernel and solvers, never from the model.", + "zh-CN": "把 RFAuto 射频/微波 EDA 框架接入 ZCode 会话:提供 208 个 MCP 工具(器件综合、仿真作业、质量门、结果判读),另附一个判读裁判 agent 和 7 张器件技能卡。所有物理数字都出自 RFAuto 确定性内核与求解器,不由模型生成。" + }, + "version": "0.1.0", + "author": { + "name": "geer1895", + "url": "https://github.com/geer1895" + }, + "category": "developer-tools", + "keywords": [ + "rf", + "microwave", + "eda", + "hfss", + "openems", + "simulation", + "mcp", + "s-parameters", + "touchstone", + "RFAuto" + ], + "homepage": "https://github.com/geer1895/rfauto", + "repository": "https://github.com/geer1895/rfauto", + "license": "GPL-3.0-only", + "icon": "https://cdn-zcode.z.ai/zcode/official-plugin/assets/rfauto/icon.png" } ] } \ No newline at end of file