23 April 2012
Behavioural modelling helps develop systems which span the digital/analogue divide
How behavioural modelling is helping to develop systems which span the digital/analogue divide
Despite the trend towards digital electronics, the world remains stubbornly analogue. No matter what you are designing, chances are that you'll need interfaces at the very least. And the larger the system being developed, the more complex the relationship between the digital and analogue worlds becomes.
Brian MacCleery, National Instruments' principal product manager for clean energy technology, said: "It's a challenge bringing the two worlds together. Take the smart grid as an example; there are smart sensors and smart switches for distribution. While these aspects are being replaced with digital versions, complexity increases and designers still have to bring analogue signals into the digital domain."
The solution, in MacCleery's opinion, is to get the data into the digital world as quickly as possible. "The quicker we can digitise, the quicker we can do things with digital algorithms and get better decision making."
And yet designers still have to deal with the two worlds. "There are complex interactions," MacCleery continued, "especially when there's a closed loop system. With analogue, there's resonance and harmonics; all kinds of things that can affect the digital system."
While it is possible to simulate such effects, MacCleery believes there remain 'big gaps' in what's available. "We are trying to solve some of these problems," he noted, "and one of the biggest is fixed time step simulation."
Normally, MacCleery explained, you have to pick a time interval. "That causes problems, because the required time step changes constantly depending upon what's happening in the system."
He gave the example of a motor controller in an electric vehicle. "Here, you have an electromechanical component – the motor – in an analogue world and have to deal with the switching behaviour of the electronics chopping. When that motor is running at full speed, it's relatively static, so you can simulate the system with a large time step. But as soon as the driver applies the brakes, the bridge voltage reverses and adds to the back emf, with nearly double the dc voltage causing a large inrush current. To capture that inrush behaviour, the simulation must slow down to a very small time step."
MacCleery gave another example; that of switched mode power supplies. "In a switched mode system, there's a lot of non linearity and oscillation caused by the interaction between digital controls and the analogue circuit. The simulation tool must vary that time step constantly to capture that behaviour correctly."
His contention is that traditional tools with a fixed time step cannot guarantee accurate results. "To get accurate results, you need to look at the coupled relationship between digital software and the analogue world. Because National Instruments has technology on both sides of the tool chain, we think we can address this in a better way."
The proposed solution brings together NI's Multisim and LabVIEW tools. "Either side can say 'something's happening' here, let's slow things down and capture the behaviour correctly. If the user says 'here's the accuracy I want', the tools will take care of the rest," he continued.
So what role does Multisim play in this? With Multisim, engineers can improve their designs by not only using standard SPICE models, but also through customisable analyses and test applications developed in LabVIEW. Between the two environments, engineers can create closed loop simulations of analogue and digital systems and write LabVIEW FPGA control logic alongside analogue circuitry.
The benefit lies in Multisim's ability to perform SPICE simulation and prototyping; essentially, representing the analogue world. "It's ideal for, say, modelling power electronics and the smart grid," MacCleery offered. "You can select from libraries of basic power components or use physics based SPICE models. In this way, you can go to high fidelity if you need to. Beyond that, you can tune the PID characteristics and see the behaviour of the actual fpga code, including the start up behaviour of the analogue/digital system, which is often problematic."
In the schematic for a single phase H bridge inverter (fig 1), each square node represents a continuous time signal interface between the circuit simulation environment and the graphical fpga programming tool. A solver mechanism creates a continuous time interface between the control and simulation environments, which negotiate a mutually agreed time step automatically to satisfy required relative and absolute error tolerances.
The problem which NI is trying to solve is to make the simulation results identical to the behaviour of a system in the 'real world'. "You have to know what's going on outside of the digital domain," MacCleery pointed out.
And, with the growth in popularity of embedded systems, this part of the equation now needs to be taken into account. "One of the biggest problems with system level tools," he contended, "is that, in the past, they have not allowed users to include the actual embedded system programming code." He accepted that other tools allow models to be created and code to be generated from those models. "But that's a one way path," he suggested. "As soon as you go from system level tools to generate code, you have gone from a higher level of abstraction to a lower one – Verilog or C, for example – and you can't go back."
With the Multisim/LabVIEW combination, a change of code in LabVIEW FPGA will be updated in the simulation world because the same virtual instrument sits in both worlds. "You can move backwards and forwards between simulation and physical hardware and get higher accuracy than in the past because the embedded system modelling tool is based on accurate analogue simulation," he said.
The NI solution is, strangely enough, to bring the analogue world into the digital domain using fpgas. "Because NI can offer the hardware and software elements," MacCleery said, "we can ensure the behaviour of, for example, fpga code in simulation is identical to that when it's running at MHz speeds on the embedded system. That's a game changer in terms of system level design."
His view is that traditional real time simulation on a processor involves too much latency. "Capturing the dynamic interaction between the analogue and digital worlds can take up to 10 times longer than you would like, even with a fast processor. Putting simulation models on an fpga means you can simulate the analogue world in the digital domain more quickly and more accurately."
Teaching analogue skills
The combination of Multisim and LabVIEW is seen by National Instruments as having great potential when it comes to teaching analogue skills; important, given the decline in the number of analogue designers.
Adam Foster, academic software product manager, said: "Students are, in general, good at programming. Analogue engineers are good at building circuits. The problem is they don't talk."
He believes the use of Multisim and LabVIEW will help to overcome this gap, allowing students to design at the system level and to learn before they actually build something.
"Because students can run Multisim on their pcs, they can experiment with it outside of the lab. Once they've built their models and proved them, they can deploy the design to hardware."
Multisim is targeted at the educational world and its interactivity is proving useful. "Students want everything to be software and digital electronics," Foster continued. "They don't know what happens when you put too much voltage through a capacitor. This is a way to bring experimentation back to students, to let them play with circuits and see what happens. Animation will show, for example, that they have burned out a capacitor.
"Eventually, they will need to do this in industry, so they need the exposure. The combination of Multisim and LabVIEW allows experimentation, but without damage to hardware," he concluded.