Lesson 4 : Section 4 : Using the Optimizer

   

Section 4: Using the optimizer

We have made improvements in the overall performance by guessing some values. While engineering by intuition is a great starting place, one does not want to be guilty of engineering by guessing. We could experiment by trying a large number of guesses, perhaps even trying to estimate a gradient and create an optimal solution... but this is the soft of tedious exercise that computers excel at.

In Figure 4.8, we have added the optimizer block, and we have modified the variables (Figure 4.9). The optimizer will attempt to minimize the “error”, in this case minimize how much the calculation is outside of the minimum and maximum values, defined here as “-200” to “-20”.

The optimization block has two optimizers defined: random using 100 iterations, and simplex using 2 iterations. The random optimizer takes guesses at what the best answer might be, just much faster than a person could. A simplex is a non-linear gradient optimization whose details are beyond the scope of this lab... but one can think of it as a gradient search which always finds at least the local best solution. Combining a random search with a simplex search is fairly efficient, in that the random search reduces the odds that the optimizer will get caught in a local minimum.


Advanced concept:

The optimizer will generally work over the entire frequency of the run, so one may wish to change the simulation frequencies depending on whether an optimization run is desired, or a simulation run for plot. This will be explored by example later. Technically, one can limit the frequency of the optimization independent of the limits of the simulation by using the fact that “frequency” is an implicit variable. Specifically, the following optimization uses conditionals to set the calculation to “-20” if “frequency” is outside of the range of 500MHz to 1.5GHz; “-20” is within the acceptable range and so will not be counted against the circuit.  

Figure 4.5: Optimization parameters

Running an optimization requires multiple steps. After the circuit is designed in the schematic editor,the simulation is run and the results are plotted. Next, the optimization has to be set up (we'll show how to in this section). The optimizer is run using the same button as before, the 'M' button. After the optimizers finish running, the new circuit values are saved to a new file, but the old file with the old values is still open in TinyCAD. If the plotted results look good, update the values by pressing the 'U' button. This will load the new file (but will not erase the old file). If for whatever reason the new values have a problem, one can still load the old file at this point. However, the 'S' button will save the new file (with the new values) over the old file name- the old file will be gone.

Figure 4.6: The Mason Toolbar in TinyCAD
   

The Mason Toolbar in TinyCAD performs five functions.

        M: Runs Mason

        C: Opens the console

        P: Runs the Plotting program

        U: Updates the values in TinyCAD, opens the new file created by the optimizer

        S: Save the new values over the old values (overwrites the old values with the new)

Figure 4.7: Process for running the optimizer

Advanced concept:

The optimizer stores the new values in a file which uses the original file name and appends the extension “.msn.xml.opt.dsn”. The various extensions track the different file formats which need to be generated in order to convert from the TinyCAD file format to Mason's file format.


Circuit check list:

  • Start from the circuit in the previous section

  • Change the frequency limits to “500 MHz” to “1.5 GHz”

  • Add the “optimizer” block from the “mason” library

  • Modify the “optimizer” block to the values as shown in Figure 4.8

  • Change the variables as shown in Figure 4.9

  • Run Mason ('M' button)

  • After the simulation is done, update the values ('U') and save them ('S')

Figure 4.8: Circuit using the optimizer to improve the match over frequency

The optimizer is allowed to change the length of the individual transmission lines T2 and T3, but the overall length is fixed at 180°. The impedances are allowed to vary (Figure 4.9), Z1 is allowed to be between 50Ώ and 70.7Ώ, and Z2 is allowed to vary between 70.7Ώ and 100Ώ. Even when using the optimizer, we are still guessing somewhat on how we should set the limits.

Figure 4.9: Variable Tool Box (seen by clicking on the variable block)

Note that the optimization values for the variables does not show up on the schematic. This allows the schematic to look a bit neater, at the expense of not showing all of the details in one view. Even simulation tools have to make engineering trades.

Figure 4.10: Results after running the optimizer

Finally, we would like to turn off the optimizer (without deleting all the stuff we typed into it), and run the simulation at a wider band. If we run the simulation at a wider bandwidth with the optimizer turned on, we will be asking too much of the optimizer and will not get good results.

Circuit check list:

  • Start from the circuit in the previous section

  • Change the frequency limits to “500 MHz” to “2 GHz”

  • Change the name of the optimizer block from “_Opt1” to “_NoOpt1” (this turns off the optimizers)

  • Run Mason ('M' button)

Figure 4.11: Modified optimization block
Figure 4.12: Wider band plot of optimized circuit

Questions:

3.1: The ranges for Z1 and Z2 were somewhat arbitrarily chosen. Why might these be good values to start? Can we find a better circuit if you change these values?

3.2: How does the optimizer perform if the initial values of Z1 and Z2 are 1 and 1000, respectively, and the range is from 1 to 1000 for each?

Figure 4.13: Variable values for question 2

3.3: What happens if you optimize over a larger bandwidth, such as from “500 MHz” to “2 GHz”? Why might explain the results?

Main Point

The use of optimizers dramatically simplifies the design process for the engineer. The computer is able to solve for hundreds or even thousands of different cases in a few seconds. The optimizer has several limits that require careful consideration- the optimizer does not replace a solid understanding of design principles:

  1. The designer still needs to create a circuit which works reasonably well- the design should be good if not optimal

  2. The design limits on the variables need to be restricted to reasonable values- if the solution space is too large, then the optimizer will have trouble finding the best solution

  3. The optimization goals need to be kept to reasonable values- if the problem is too hard (e.g., if the bandwidth over which a good match is expected is too large) then the optimizers will find the closest approximation to a good solution, but probably isn't a good solution

Comments