Control and filtering algorithms on a MSP430 - Page 1
Forum section: electronics / general

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 07, 2011, 10:33:58 pm
content: In my senior design project (exercise bicycle with a grid tie inverter), I have a MSP430G2452 reading the voltage and current from a permanent magnet alternator (with built in rectifier) and using an external DAC (TLC7524) to control the peak current setting of a UC3843 PWM controller. (All of that is on the 12V side.) I'm planning to do high level control like MPPT and energy measurement in the MSP430.Any suggestions for implementing algorithms on a low power microcontroller like the MSP430? I'm particularly looking for noise filters and PID-type control that do not use much memory or CPU.

author: scrat
author_rank: Frequent Contributor
timestamp: March 07, 2011, 11:15:21 pm
content: I can't help that much...Are you measuring phase values, or is the current/voltage measurement made only after the rectifier? Why did you use an external PWM controller? Is there a position/speed sensor?Searching for IQmath (which is the standard way for implementing fractional numbers calculation on C2000 DSPs) for MSP430, I found this:http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/59088.aspx.Here is the one I consider the simplest implementation of an anti-windup PI controller (although it has some problems in the case of very strong noise):

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 08, 2011, 08:23:39 pm
content: The measurements are after the rectifier. The external PWM is because it's a current mode flyback converter. The MSP430 cannot sample the current fast enough for reliable current limiting. And because I'm just starting MSP430 programming, I wanted the hardware to be well protected from software bugs. The maximum current limit is set in hardware and is well below the ratings of the components. The output voltage limiter is also hardware based.

author: scrat
author_rank: Frequent Contributor
timestamp: March 08, 2011, 09:43:14 pm
content: Besides what are your design choices, this is what I see into industrial drives and photovoltaic inverters.Hardware current limiting is usually done simply as a protection, with a couple of comparators acting on the switch drivers and input to the microcontroller, while current control is done in digital, like the other loops.The control update is done at 10-20kHz, which might be too much for an MSP430 (is it really so?), but are easy to achieve with a C2000 or similar. This gives a large freedom in the design and tuning of filters, controllers and so on. 5kHz can be sufficient for a motor control if there is enough inertia and the electrical frequency is not too high.The real question I wanted to ask you was if the rectifier is a thyristor bridge or a MOS/IGBT one. In the second case, synchronous control would be an option.Excuse me for the unsolicited info, but this is my research field, and I'm glad to speak about it

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 09, 2011, 08:02:05 pm
content: The rectifier is just a simple diode bridge built into the alternator. Just like a car alternator except the rotor is a permanent magnet.The ADC built into the MSP430 can do up to 200ksps, so sampling two channels (voltage and current) cuts it down to 100kHz max. The PWM is running at about 50kHz, so it would not be possible to implement the entire loop in the MSP430. Instead, the MSP430 uses a DAC to set the peak current level of the 3843. Having that update at 1kHz would be enough and measuring the voltage and current at 1kHz would also be enough.The inverter would have a separate control circuit. It would be completely separate from the DC/DC converter I'm working on right now since I'm looking to make the system highly flexible for different applications.

author: scrat
author_rank: Frequent Contributor
timestamp: March 10, 2011, 12:28:43 am
content: I see... The grid tie inverter is a big job, especially if regulations have to be met. There are a number of safety and control issues there.

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 10, 2011, 06:19:57 pm
content: Quote from: scrat on March 10, 2011, 12:28:43 amIt's going to work like a fixed speed synchronous motor drive. The basic idea is to supply a positive current to the grid during the positive half cycle and a negative current during the negative half cycle. Easy in theory but I'm sure there's going to be difficulties in practice. As for safety, it's always going to be a big issue in working with direct mains powered circuits. I could have the mains going to a 60Hz transformer so the electronics are all low voltage but that's no fun! (I will use an isolation transformer and current limiting for testing.)

author: FreeThinker
author_rank: Frequent Contributor
timestamp: March 10, 2011, 08:46:15 pm
content: Quote from: scrat on March 10, 2011, 12:28:43 amDilbert may well help there, sure he knows lots about tie inverters(sorry couldn't resist)

author: scrat
author_rank: Frequent Contributor
timestamp: March 13, 2011, 08:06:10 pm
content: The most difficult to solve safety issue in my opinion is not about working on the inverter itself, but for other people working on the grid.In fact, in the case the grid is voluntarily disconnected, you could be still generating power. This is a potentially harmful situation: just think of an electrician (from the electric energy company, for example) that has disconnected power for doing some work on the wires. If you don't stop injecting power into the grid, you will fry the electrician. Sensing the grid presence is not so simple, since you are generating a voltage similar to it (since you have a current control with a sinusoidal reference).

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 13, 2011, 09:51:25 pm
content: That will be handled by the same circuit that shuts down the inverter if it's unplugged while it's still operating. Since it's a current source, the voltage would rise if it's supplying an open circuit, quickly tripping the overvoltage cutout. There will also be an undervoltage cutout and a frequency check circuit. So for the inverter to continue working with no grid connection, the load must exactly match the power supplied (so the voltage stays in range) and the load must somehow be providing a very accurate 60Hz reference, very unlikely.

author: scrat
author_rank: Frequent Contributor
timestamp: March 14, 2011, 12:01:57 pm
content: There will be a probability that the load connected to the unpowered grid will absorb the reference current at a voltage near to the grid's nominal one (you must accept at least the grid voltage tolerance, 10% here in Italy).The reference will be provided by the inverter itself. Usually the current's harmonic content is limited by regulations, which leads to the use of a PLL for extracting the first harmonic's phase. Once at steady-state, there is the possibility that you will stay locked to the same voltage you're generating, at least for a certain time. One simple solution is to add (numerically) a periodical small frequency/phase shift as a disturb (into the PLL), and to see if a frequency drift follows. If there are many similar devices connected to the same grid (I was thinking of a gym with many bikes) I think it will be a mess.I hope not to discourage you, just to warn against some problems. I'm not directly involved into grid tie inverters, but my tutor does, so I know a little about these issues.

author: NiHaoMike
author_rank: Super Contributor
timestamp: March 14, 2011, 02:04:55 pm
content: It would source current in proportion to the output voltage, effectively behaving as a negative resistor. No PLL needed. From my research, the tolerance of the grid frequency is less than +-0.5Hz. It would be unlikely for a load to maintain that on its own.

author: scrat
author_rank: Frequent Contributor
timestamp: March 14, 2011, 09:44:47 pm
content: Monitoring frequency, that kind of control could be good, it seems to be inherently unstable when the grid is down, since noise will make the frequency drift away.Maybe it has some drawbacks on harmonic content and voltage-current phase, so they use more complex algorithms.