Simulation of Chaos
Hello, and welcome to my first blog on simulation of chaos. I was asked if the first blog/project could involve something on the Internet of Things (IOT) and hence we will be investigating issues of Cloud security using chaos sources to produce random numbers.
We will explore projects involving chaos and I will be using the latest Cadence PSpice V 17.2 which has many new exciting features, all of which extend the simulation horizons greatly over previous versions. For example, we can run a simulation which interfaces with an Arduino in real-time, which is very exciting. The method for exporting data from PSpice to Matlab will also be examined because the previous method of exporting variables was a bit tedious. I think this new version will quieten those people who used to say to me “ah, but it's only simulation and not the real world”. I will write about these new features in future blogs. In my 30 + years of teaching engineering topics, I observed students found projects were the best platform for real learning and from feedback from many students, it would seem that they agree! It would be nice if I get feedback from readers on this blog over the next few months. I will introduce maths as we progress but please don't let any equations frighten you away from simulating. You may skip things initially and get right to simulating and return and try and tie in the maths with the design at a later stage. As you may have noticed my blog is written in an informal style and hopefully this will encourage you to interact with me and not frighten you off before we get started. I hope over the next few blogs to introduce the fascinating area of chaos theory and show how it can be successfully applied in engineering projects. The very mention of chaos theory is enough to frighten off some people but bear with me on the first few blogs and very quickly you will get up to speed. I will start by examining some very basic chaos circuits using analog behavioral models (ABM) and show these can be incorporated in a full system. To start off I would like you to download a paper which I recently gave at the ISSC conference: http://programme.exordo.com/issc2016/delegates/presentation/21/. This will give you an idea the direction I intend to take in my blogs. Consider the paper as a map which we wish to explore using PSpice. Initially just scan over the paper and see roughly what it is about but then leave it aside for a while and we will start simulating chaos. However, we will refer to parts of the paper as we progress and I will try and keep the maths to a minimum but there is satisfaction from building and simulating circuits but starting from the basic system equations.
The technique I’ve used for writing about PSpice is one I've used for many years and have found it to be successful. I have written several books on PSpice and if you go to the following site you will see the titles and read the abstract: http://www.morganclaypool.com/page/coll_one. Alas, these books cannot be downloaded for free but can be purchased (The books are available in many universities and public libraries - see the Morgan Claypool site for universities that have my books). In these books, I explain how to design and simulate engineering circuits, but chaos was not covered in any of these books. My next book will be all about simulating chaos, so these blogs are, in a sense, a preview of my future book! The approach I use for chaos simulation is the same that I’ve used on many seminars/courses, and in many countries, and most students seemed to like it. With that in mind, I quote the saying “if it ain’t broke don’t fix it”, and so I will continue writing in this way. All simulation circuits will be made available as a download, as well as any theory we use, and so should speed up your learning process. Of course, you can skip the theory and just simulate the circuit, but as I explained to my students, it's much more satisfying when you see that the implementation of a schematic is supported by the theory.
The project
The paper I asked you to download is about creating a random number generator for personalizing Cloud security locally and which outputs the famous one-time pad (OTP) binary random numbers. Random number generators have many applications but here we use a chaotic oscillator as the primary random source for producing OTPs. There are several files to be downloaded and set up and is a bit tedious but only needs to be done once. I would like you to download the two zipped files - noise_chaos-2016-11-14T19-30.zip and lorenzabm-2016-11-14T13-46.zip which you unzip each one to a location of your choice. Run the first simulation file called noise_chaos.opj which is about comparing noise and chaos. which you can read about in another PDf file to be downloaded called Chaos_Introduction.pdf. This schematic is about noise and chaos contains two generators, one which uses the new random number generator part called RND, and a VPWL_file generator part which calls a text file containing Lorenz chaos oscillator output. This was produced from the second schematic to a file called lorenz.txt (you can download this too).
This file needs to be located in your own directory but in my schematic, the directory I used was called C:\PhDResearch\pspice\signalsources (You may call it any name you like). Both schematics are almost complete but the generators use my custom built part called ANALOGDELAY which is in my library of parts called mylib .lib that also need to be downloaded and added to the library of parts. You need to go to the Simulation settings and add this library. This introduces an analog delay which we will use quite a bit in future blogs. It enables us to delay a signal by an amount, which is 10 us in this example.
The other parameter for the RND part is contained in another file, options.inc, which is added in the Simulation settings (see the figure below called options.png). I have located this file in my directory called C:\blog\options.inc.
Simulating the first schematic
Have a look at the Introduction to chaos which describes what this file is about and shows the attractor of noise plotted against delayed noise. The attractor is created in Probe after simulating the circuit by replacing the TIME variable with the delayed variable. What the attractor shows is that there is no correlation between present and past values. Only noise (and chaos to some extent), has this attribute. Why are we interested in this? Well, we eventually want to produce a random bit stream and if a bit stream is to be random there should be no correlation between past and present values. Later on, we will export the random bit stream into Matlab and do some interesting tests on it such as autocorrelation, entropy, PSD, etc. Let's start then with the first circuit. If you succeed with this we can progress to the next more interesting file on generating chaos.