All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Embedded Systems and Microcontrollers

Notices

Embedded Systems and Microcontrollers Discussion forum for projects and working with embedded systems and microcontrollers (FPGAs, PICs, AVRs). Get help with hardware issues and embedded programming.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 03-10-2010, 04:39 AM
Obanion Obanion is offline
Junior Member
 
Join Date: Nov 2009
Posts: 16
Default Using the results from a difference equation in digital control

Hi guys,

I'm working on a control system for a DC-DC converter, and I'm stuck on a certain aspect.

I have the transfer function in difference equation format for my DC-DC convert, but I'm unsure how to program it. I'm using an FPGA with Verilog, but in terms of conceptualization, I believe it applied to any programming language.

For instance, let's say my difference equation is:

D(n) = 5.45*I(n) - 123.4*I(n-1) + 1.3*D(n-1) - 0.5*D(n-2)

Where D(n) is the duty cycle at instant n and I(n) is the current at instant n.

I guess my question is how do I know what values to use for this input? My maximum current is going to be 1 A. I'm using an 11 bit ADC, so that translates to 11111111111 (for 1 A) in binary. Do I need to scale this value for the difference equation, and if so by what amount?

My duty cycle routine accepts a number from 0-2048, where 1024 would be 50%, 2048 would be 100% and so on. This is easily modifiable.

For the duty cycle, is it the same process? In reality, the duty cycle can be from 1-0, and never above. Let's say I assume that my max current value is scaled to 1, and my duty cycle is scaled to 1 also. Feeding my equation, I just may get a number greater than 1. I don't know what the output of the difference equation's duty cycle actually means.

This is where I'm very unsure what to make of it and I apologize if I'm not making any sense. I'm not sure if this concept is one that has been already addressed in textbooks or such. I'd appreciate any information on this subject. Please let me know if I'm not being clear and I'll try my best to explain it more clearly.


Thanks,

Obanion
Reply With Quote
  #2  
Old 03-10-2010, 02:52 PM
rjenkins rjenkins is offline
Senior Member
 
Join Date: Nov 2005
Location: Sheffield, England
Posts: 1,008
Default

It all depends what language you are writing in, how fast the processor is & how fast an update you need.

Personally, I'd probably scale the values to Amps/1000 and use a 16 bit integer variable for the math.

That gives you enough overhead for the multiplications without oveflowing.

It balances accuracy with speed - you may need to avoid floating point maths if you are using something like a PIC as it may be too slow for real-time control at high frequencies.
__________________
Robert Jenkins.
Reply With Quote
Reply   Post New Thread

Bookmarks

Tags
, , , ,

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help for a dawn/dusk LED circuit malaybiswas The Projects Forum 24 03-04-2009 04:19 PM


All times are GMT. The time now is 10:23 PM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License. Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.