TAGGED: hfss, optimetrics, scripting
-
-
June 23, 2021 at 12:44 amAndyJPSubscriber
I am making multiport sequential optimizations in a script where per-port matching are interleaved with inter-port matchings, untill the perfect solution is found.
The problem is that every optimization setup I execute in my script has solutions stored for 20-30 iterations of search. So the amount of S-parameters data stored grows like a snowball. And it impacts performance actually, making plotting the data difficult the same time.
Is there an approach of deleting the intermediary data after an optimization setup was completed, but only for that last setup execution(keeping previous good results), excluding the final(good) result?
Like, getting the id's of every optimetrics iteration in the last run, and finding which one was the last solution to exclude from the list? Are there id's or sequential numbers at all?
(I use VBS in 2021R1)
July 20, 2021 at 12:17 pmPraneethForum Moderator
Please go through the "HFSS scripting guide" for the available commands that are supported.
Best regardsJuly 21, 2021 at 12:10 amAndyJPSubscriberwell, my eyes may be weak, but I did not find a way.
If you are talking about deletefullvariation, it searches for particular parameters. But in the optimization I do not know those from the script. I need some variation iterator, or index, or a timestamp... I don't know, for determining which variations to delete between previous and the last data registered as good.
July 21, 2021 at 4:17 amAndyJPSubscribertechnically, if deletefullvariation had an option to delete all variations with incomplete parameter list matching, EXCLUDING the last one, like in the GUI, that would solve my problem. But it deletes either a single specific variation, or "all" the data collected.
July 26, 2021 at 12:16 amAndyJPSubscriberup, seriously. this overload with useless iterations data slows up my parametric searches.
July 27, 2021 at 2:25 amAndyJPSubscriberNo, really, there is no explanation in the manual, how to delete some specific variations basing on any kind of selection.
ListVariations and similar commands are also not explained. Any attempt to use them results in "no such property or method", or "the command requires " ", or "cannot use ( in the sub".... nonsense. Error messages unintelligible, not letting figure the command use via trial. And the command use is totally obscure.
July 27, 2021 at 2:30 amAndyJPSubscriberSo, lets narrow down the question:
Input: After many iterations, the design oDesign solutions contain a number of variations with main parameters of interest "$Hi" and "$M"
Required: Delete all the variations with "$Hi"="500" and "$M"="1750".
How should the VBS code look?
August 25, 2021 at 3:34 amAndyJPSubscriberit is still actual because the manual does not give any hint.
August 25, 2021 at 3:36 amAndyJPSubscriberEvery separate results profile text file contains a detailed timestamp, like
$begin 'ProfileGroup'
MajorVer=2021
MinorVer=1
Name='Initialization'
StartInfo='Time:08/25/2021 12:44:43'
...
Why is it not possible using it as a feature for managing results conditionally from HFSS/Maxwell?
Or is it possible?
August 25, 2021 at 5:58 amAndyJPSubscriberI found newer "Electronics Desktop Scripting Guide", which contains some new methods, not listed in "HFSS scripting guide" you had mentioned.
Particularly oModule.ListMatchingVariations
After hitting the wall countless times, by trial I found the non-mentioned prerequisite that oModule should be set to oDesign.GetModule("Solutions") !!!! No other module has that method inherited!
But then again, it does not allow excluding specific variations (last good variation) from the list because:
Methods
oModule.ListMatchingVariations("Setup1 : LastAdaptive",("Var"), ("value"))
and
oDesign.GetNominalVariation()
return different set (and order ?) of variables in string format, making them non-comparable.
Methods
oDesign.GetVariationVariableValue(list(i), "Var")
and
oDesign.GetVariableValue("Var")
return Var values in different format, with units applied, and without units; making them non-comparable again!
Why the **** is there no simple unit-aware comparison method?
Why the data stamp is not returned for variations?
Is there another undocumented set of functions/methods I should know?
August 26, 2021 at 3:22 amAndyJPSubscriberseems like calling ListMatchingVariations results in standard string() function overloaded by something else.
In VBS, there is a way of defining repeating symbols in a string by s_var=string( int(count), "s"). But after calling ListMatchingVariations, this line throws an error of wrong type. It was never throwing an error before for me, until I implemented data cleaning by the list.
August 26, 2021 at 5:08 amAndyJPSubscriberI guess, the above was again unexpected change of types by VBS...
August 26, 2021 at 5:33 amAndyJPSubscriberFor those who want to remove unwanted iterations:
This method may still delete the last iteration by mistake since values are converted to unitless Si base values, and there may be inequality in floating point format.... but in most cases it works:
if oDesign.GetVariableValue("STOP_CALC")<>"0" then Wscript.Quit 'used to stop the script since stopping optimetrics does not forward the stop signal to the interpreter, like sweep does. Wscript.Quit is a VB command not working in VBS, but it still does the thing.
current=oDesign.GetNominalVariation() 'gets current variables set
set oModule = oDesign.GetModule("Solutions") 'only Solutions (not Results and not Optimetrics) module has methods for working with results collection.
list = oModule.ListMatchingVariations("Setup1 : LastAdaptive",(Param1_name,Param2_name), (CStr(Param1_val)&Param1_unit,CStr(Param2_val)&Param2_unit)) 'get a list of variations with properties uniquely matching the last optimization set.
oDesktop.AddMessage oProject.GetName(), oDesign.GetName(), 0, "================ Deleting optimization temp data ... ===============" 'just a way of logging a custom message
for i=0 to Ubound(list)
if (oDesign.GetVariationVariableValue(list(i), "var1")<> oDesign.GetVariationVariableValue(current, "var1")) _ 'when optimizing 4 parameters, in the end the optimizer rewrites the design values with the best result. So prevent deleting it by comparing with current values.
OR (oDesign.GetVariationVariableValue(list(i), "var2")<> oDesign.GetVariationVariableValue(current, "var2")) _
OR (oDesign.GetVariationVariableValue(list(i), "var3")<> oDesign.GetVariationVariableValue(current, "var3")) _
OR (oDesign.GetVariationVariableValue(list(i), "var4")<> oDesign.GetVariationVariableValue(current, "var4")) then
oDesign.DeleteFullVariation list(i), true
end if
next
Set oModule = oDesign.GetModule("AnalysisSetup") 'set the handling object back to useful module.
This method is veeery slow since A) VBS is restricted on various array methods and managing functions, and arrays declared in different way are not the same. Particularly, there is no simple way of declaring a (VC++ vector() style) dynamic array and allowing to clear it in the loop. It is either not truly dynamic, or Erase does not work. So you have to sweep the collection two times for resizing arrays explicitly; it works not so good in interpreter level "basic" languages .
So it is not easy makign a guaranteed list of variations to delete at once; deleting one by one is safer.
If you have other suggestions, or know how to make a safer guaranteed comparison, or prepare the delete list with excluded results at once, please share.
Viewing 12 reply threads- The topic ‘Scripting: Is there a way to delete intermediary iteration results after optimization?’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- HFSS Incident Plane Wave excitement mode
- Question for Maxwell
- Simulation of capacitor combining eddy currents with displacement currents
- How to calculate eddy and hysteresis losses of the core?
- Ansys Maxwell 3D – eddy current
- How to determine initial position in motion setup
- dq graph non-conformity
- How to customize pulse waveform and injection site in microstrip array
- 180 Degree Phase Shift When Measuring S21
- Simplorer+Maxwell Cosimulation results and Maxwell results mismatch
Top Contributors-
1216
-
543
-
523
-
225
-
209
Top Rated Tags© 2024 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-