I have two variables defined in ADEXL.
I want to sweep variable A, with Four values, 1,2,3,4.
Then I want to make variable B sweep dependent on A.
For instance, when A is 1, then B sweeps from 1 to 3. When A is 2, B sweeps from 3 to 5. When A is 3, then B sweeps to 6 to 9.
How can I achieve this? is there a way to use some logic expression in the variable definition?
Your sweep of B doesn't seem to follow a particular pattern. It could have been specified as follows:
C: 1,2,3B: (A-1)*3+CA: 1:1:4 # assuming you wanted to sweep A from 1 to 4 as well
and then B would have swept from 1 to 3 when A was 1, from 4 to 6 when A was 2, from 7 to 9 when A was 3 and so on. However, as you specified it above, the B value 3 is in the sweep when A is 1 or 2, and there are four sweep points in sweep B for A=3 which is different from the 3 points for the other values of A.
So you could do it with (only going up to A=3 because you didn't say what happened with A=4):
A: 1,1,1,2,2,2,3,3,3,3B: 1,2,3,3,4,5,6,7,8,9
Then select both variables in the global variables list and do Right Mouse->Group as Parametric Set (the menu is something like that - I can't remember the exact wording as I'm not on my work computer). This will then sweep both variables so they track together and do 10 sweep points rather than 10*10 (100) if they hadn't been grouped as a parametric set.
Thank you very much Andrew!
I gave the A and B sweep as a simple example without much thinking of it. didn't expect that you find a pattern out of the sweep
the real case is much more complicated than that. the situation is that my circuit has different mode of operation, say mode 1,2,3,4... the number can be large
depending on my mode of operation, the variables that I want to sweep can have different ranges.
when in mode 1, A needs to be swept like this, A: 14:0.5:15.5.
when in mode 2, A : 12:0.3:17
etc. there is no patterns for a simple equation to cover these.
Actually what I want to do is to use inclusion list. to have different inclusion lists defined for variable A. and then select one of it, depending on mode.
It'll be perfect if I can do the following:
A: (mode ==1) && inclusion_list_1, (mode == 2 ) && inclusion_list_2, etc.
I tried this and it did not work. don't know if ADEXL supports such expressions in the variable definition field.
Another case is that Variable A has total 10 values, 1 to 10. depending on the mode, I need to pick (randomly) a few numbers out of the 10 to sweep. I want to do something like the following
define A: 1*(mode ==1), 2*(mode == 1 || mode ==3), 3 * (mode ==1 || mode ==2), etc.
The problem is I will have 0 when mode is not true. So it always give me 10 sweeps, including those 0s, and 0 can cause simulator fails. I tried to exclude those 0s using an exclusion list at the end, but it does not work. combining inclusion and exclusion lists works fine when they both have only numbers. once some logical operation with another variable is involved, then it seems that exclusion_list can not recognize the variable correctly, like those 0s.
When number of modes are not that many, I can define them as individual corners and put different variable sweep in the corner. that will work but I will end up with defining many corners. Would be great if any of the two things above can work. can they ?
Well, you can't define the variables as you've defined them - I think that's unlikely that we'd support that complexity of setup in the future either because it would get horribly complicated pretty quickly.
However, if you use ADE Assembler (rather than ADE XL), there's a feature called "Run Plans" which allow you to define a sequence of runs to perform, and importantly there's the capability to specify a "preRun" script which runs before the runs start. So for example:
The simplePreRun.il script I've used is this:
printf("MODE IS %L\n" mode)
This checks the value of "mode" and adjusts the sweeps accordingly. There are different numbers of sweeps in each mode, for example. This isn't attempting to handle the situation where mode was swept, but hopefully you get the idea. It's a simple piece of SKILL code that uses the simple Maestro mae functions to get and set variables (you can set either global variables, or test variables - I kept it simple here and only adjusted global variables).
Thank you Andrew!
it works fine without sweeping on "mode". If I put a sweep on mode in the Variable field, then it seems that the script won't be able to set the sweep correctly for the whole simulation.
Still, it is good to learn something new
You could of course write the code to cope with a sweep value of mode (e.g. mode=1:1:7 if there are 7 modes), work out the range, and combine all the sweep points together. Something like that - although it would be a bit complicated. So it's not impossible.
Unfortunately there's no public SKILL function (not sure there's even a private one) to expand the ADE XL sweep points for you, but potentially you could have your code expand a subset of sweep specifications (it's not hard to parse a MATLAB-style sweep definition such as the start:step:stop form).