<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>STI Blog &#187; Uncategorized</title>
	<atom:link href="http://shaw-technologies.com/archives/category/uncategorized/feed" rel="self" type="application/rss+xml" />
	<link>http://shaw-technologies.com</link>
	<description>Interesting developments towards practical uses of artificial intelligence</description>
	<lastBuildDate>Tue, 07 Apr 2009 05:13:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Direct Digital Synthesis</title>
		<link>http://shaw-technologies.com/archives/98</link>
		<comments>http://shaw-technologies.com/archives/98#comments</comments>
		<pubDate>Tue, 07 Apr 2009 04:49:33 +0000</pubDate>
		<dc:creator>John Shaw</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://shaw-technologies.com/archives/98</guid>
		<description><![CDATA[The New Way To Generate Sine Waves
In the good old days before everything started going digital, sine wave generators were in the domain of analog circuitry. One built them using Hartley, Colpitts, Pierce, and other such oscillator circuit designs. They depended on variable capacitors or varactor diodes for tuning, and required good construction and shielding [...]]]></description>
			<content:encoded><![CDATA[<p><font face="sans-serif"><b><big>The New Way To Generate Sine Waves</big></b></p>
<p></font><font face="sans-serif">In the good old days before everything started going digital, sine wave generators were in the domain of analog circuitry. One built them using Hartley, Colpitts, Pierce, and other such oscillator circuit designs. They depended on variable capacitors or varactor diodes for tuning, and required good construction and shielding practices to achieve acceptable frequency stability. But all good things come to an end. The era of digital signal processing has arrived, and along with it all sorts of new digital and mixed signal devices.</p>
<p>The Direct Digital Synthesizer (DDS) is simple in concept: one stores a table of sine curve values (one cycles worth of values) which are consecutively read from the table and converted to a corresponding voltage. When the end of the table is reached, the process is repeated. Over time, the voltage output generates a continuous sine wave. Changing the rate at which the samples are read and converted changes the frequency of the sine wave. What could be easier?</p>
<p>Unfortunately, a variety of demons await the unsuspecting designer. To see why, we must define the process a little more carefully. Each voltage output is called a &#8217;sample&#8217;. The number of samples per second is known as the sampling rate. Suppose there are N entries in the table for one cycle of the sine wave. The output frequency of the sine wave, f, will then be the sampling rate, Fs, divided by N. </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       f = Fs/N</p>
<p>The voltage output of the DDS is generated by a digital to analog converter. After a sample is output, the voltage remains constant until the next sample is output. The resulting sine wave has a stair-step quality to its shape. The smoothness of the sine wave depends upon the number of entries in the table, and the number of bits of precision of each entry (or the number of bits the digital to analog converter can handle). </p>
<p>The stair-step nature of the sine wave means it is not a pure, single, frequency sine wave. We might guess that the non-sinusoidal nature indicates there will be harmonics present (integer multiple frequencies of the desired frequency), however, this turns out not to be the case. The frequency spectrum is a bit more complicated. Suppose the sampling rate is 10 MHz, and our sine wave is 1 MHz. This means our table has 10 samples for each cycle. Analysis of the frequency content of our stair-step sine wave shows our desired 1 MHz signal, but it also includes a number of other frequencies almost as prominent as the one we want, namely: 9 MHz, 11 MHz, 19 MHz, 21 MHz, 29 MHz, etc. The pattern here is pretty obvious: every 10 MHz frequency segment includes 2 output frequencies, one that is 1 MHz up from the bottom end, and one that is one MHz down from the top end. To produce a &#8220;pure&#8221; sine wave, a good quality filter must be used to eliminate all but the desired frequency. Typically, this is a low pass filter, often containing 4 poles or more. A clever designer, however, can use a band pass filter tuned to any one of the the output frequencies. Note that this limits the useful output range of the DDS. For example, with a sample frequency again of 10 MHz, but a desired output of 4 MHz, the actual outputs will be at 4, 6, 14, 16, etc. To obtain a pure 4 MHz, the 6 MHz must be removed. This requires a very good filter.</p>
<p>Rather than increasing the sample rate to increase the output frequency, the DDS devices provide a means to select every other sample from the table (count by 2s), or every third sample, etc. This runs through the table faster converting fewer table values per cycle. If the table only includes 10 samples, this is not too useful, but if it holds 10,000,000 samples for a cycle, this is very useful. At each sample time, the user specified increment, n, is added to an internal &#8216;phase counter&#8217; to keep track of where to look in the sample table. Modern devices use compressed tables along with clever mathematical techniques that produce effective table sizes of billions of samples for one cycle of a sine wave. The output frequency is now given by:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f = n x Fs / N</p>
<p>Other sources of difficulty lie in wait for those seeking ultra pure sine waves. Inaccuracies in the analog to digital converter produce unwanted frequencies called &#8217;spurs&#8217;, as does the conversion process when the phase counter is truncated to the number of bits used by the analog to digital converter. These spurs, usually of pretty low level, produce &#8216;phase jitter&#8217; in the resulting sine wave, which may cause difficulties in some applications. Techniques exist to mitigate some of these effects, but designers of high performance systems must be aware of them and the limitations they may impose.</p>
<p>Modern DDS devices use high frequency clock rates. For example, the Analog Devices AD9851 operates with a sample rate of 180 MHz, and can generate sine waves up to 90 MHz, but in practice 60 MHz is a useful upper limit (the first extra output is then at 120 MHz and can be removed by a low pass filter). Other devices are available with much lower, or much higher sample rates.</p>
<p>These devices are rapidly moving from the sphere of the esoteric to the common place of the electronics hobbyist. I recently obtained a DDS kit based on the AD9851 as pictured below. As can be seen, the parts are mostly surface mount and require appropriate tools and a steady hand to solder them to the board. The IC on the left hand side of the left hand picture is the AD9851. This board will function as a general purpose r.f. signal generator, a frequency source for a direct conversion ham receiver, and a vfo for a ham transmitter. Since its accuracy and stability are determined directly by the oscillator module, it will operate with very little temperature drift and with high immunity to mechanical instability.<br /></font><br /><img src="http://www.shaw-technologies.com/images/PICT0020.jpg"/><img src="http://www.shaw-technologies.com/images/PICT0023.JPG"/><font face="sans-serif"><br />DDS devices are clever and ingenious devices. Because of their many superior capabilities, and smooth integration into digital systems, their popularity is sure to increase. For more information, I recommend the following sources:</p>
<p>http://www.analog.com/en/rfif-components/direct-digital-synthesis-dds/ad9851/products/product.html<br />http://www.amqrp.org/kits/dds60/index.html</p>
<p></font></p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=f42ef6e4-c4dc-8015-bdf5-a5fb1ac76038" /></div>
]]></content:encoded>
			<wfw:commentRss>http://shaw-technologies.com/archives/98/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mixed Integer Programming (MIP)</title>
		<link>http://shaw-technologies.com/archives/96</link>
		<comments>http://shaw-technologies.com/archives/96#comments</comments>
		<pubDate>Tue, 07 Apr 2009 02:32:24 +0000</pubDate>
		<dc:creator>John Shaw</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://shaw-technologies.com/archives/96</guid>
		<description><![CDATA[Integer variables and Linear Programming equals Mixed Integer Programming
Linear Programming has long been an important optimization tool, especially in the business arena. Decisions regarding optimum inventory quantities, shipping and transportation choices, manufacturing scheduling, and numerous other processes can often benefit from the application of Linear Programming (LP).
In its simplest form, linear programming is a technique [...]]]></description>
			<content:encoded><![CDATA[<p><font face="sans-serif"><b><big>Integer variables and Linear Programming equals Mixed Integer Programming</big></b></p>
<p></font><font face="sans-serif">Linear Programming has long been an important optimization tool, especially in the business arena. Decisions regarding optimum inventory quantities, shipping and transportation choices, manufacturing scheduling, and numerous other processes can often benefit from the application of Linear Programming (LP).</p>
<p>In its simplest form, linear programming is a technique for solving a set of mathematical inequalities subject to a particular optimization goal. Consider the following optimization problem: a company sells two products, A and B, and wants to make as much profit each week as possible. The company is just getting started and has space constraints for inventory, and budget constraints for both inventory purchase and labor.</p>
<p>If a and b represent the quantity of products A and B they can produce each week, the following constraints must be met:</p>
<p>inventory space:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  2a + b &lt;= 2000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; since units of A take twice as much room as those of B,<br />inventory cost: &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a + b &lt;= 1400&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; since the unit materials cost the same amount,<br />labor cost: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b     &lt;= 1000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; since units of A require no labor,</p>
<p>and the profit is given by P = 3a + 2b, that is, units of A are more profitable. </p>
<p>This problem is directly solvable by standard &#8217;simplex&#8217; LP solvers. The solution to this problem is a = 600, b = 800, P = 3400, and the labor is idle 20% of the time, so a 4 day work week might be appropriate. Although a and b worked out to be integers in this problem, that is not always the case. But the answers, if decimal numbers, would still be close enough to be useful.</p>
<p>But now suppose that the inventory of A can only be purchased in lots of 250. What is the best solution?</p>
<p>The new constraint is a = 250c, where c must be an integer (the number of lots).</p>
<p>The LP solver does not allow integer constraints. Running it with this constraint would produce the same solution, with c = 2.4 (so that a = 250c = 600 as before.</p>
<p>This problem can still be solved, but it now requires use of a Mixed Integer Programming (MIP) solver. A MIP solver allows us to constrain the variable c to be an integer.</p>
<p>The new solution will be a = 500, b = 900, c = 2, P = 3300, with the labor idle only 10% of the time. These differences in the solution could be very important to the business.</p>
<p>In practice, these types of problems typically have many more variables and many more constraints, perhaps numbering in the hundreds or thousands.</p>
<p>As a final note, MIP solvers often take much longer to solve a problem than an LP solver, since the MIP solver runs iteratively, and each iteration calculates an LP solution. The art of MIP usage is knowing how to reduce the number of required iterations.</p>
<p>A good advanced text on MIP solver theory is &#8220;Production Planning by Mixed Integer Programming&#8221; by Pochet and Wolsey, published by Springer. Many high school algebra texts cover introductory graphical methods for the solution of simple LP problems.</p>
<p></font></p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=013a37ce-9e51-8eea-9948-65fc9afe9686" /></div>
]]></content:encoded>
			<wfw:commentRss>http://shaw-technologies.com/archives/96/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

