From: Gurzixo on 15 Jul 2010 08:59 Dear All, For a personnal project (a small line-follower robot for my son), I am developing a speed regulation for a DC motor using a microcontroller and PWM. There is a quadrature encoder on the motor output. I have generated a file containing command/result values, and have succesfully done the identification of the plant using "ident", and an arx411 model. I have entered this model in "sisotool", and succesfully designed (using automatic pid optimisation) a compensator: C=8.962 * (1+0.013w)(1+0.38w) / w, with w=(z-1)/Ts. I have exported this compensator to workspace, so when I double click on the "C" object, Matlab says: Zero/pole/gain from input "Input" to output "Output": 16.9566 (z+2.991) (z-0.8676) ---------------------------- (z-1) Sampling time: 0.05 My problem is now to synthetise the code of this compensator in C language, in order to put it in the robot. My idea was to enter "C" into fdatool (as I think, perhaps naively, that this compensator is in fact a transfert function, and so a filter), in order that fdatool generates automatically the code. Unfortunately, I found no way to import the "C" object in fdatool, which seems only to accept "dfilt" objects, and not "LTI" - "zpk" objects I tryed various options for the last 3 days, using Matlab help and Google extensively, but I am stuck :-( I am still a naive Matlab user, and the last time I used Z transforms was at school, 30 years ago :-) I am an experienced C developer for embedded systems. Am I using correctly the toolboxes? Is it the right way to solve my problem and synthetize this compensator? Any help or pointers would be greatly appreciated!! Michel
From: Arkadiy Turevskiy on 29 Jul 2010 16:17 The recommended workflow is to use Simulink and Real-Time Workshop. Add LTI System block from Control System Toolbox to your model, enter C as block parameter and then generate code with Real-Time Workshop. Arkadiy "Gurzixo" <none(a)none.com> wrote in message <4c3f06ac$0$634$426a74cc(a)news.free.fr>... > Dear All, > > For a personnal project (a small line-follower robot for my son), I am > developing a speed regulation for a DC motor using a microcontroller and > PWM. > There is a quadrature encoder on the motor output. > I have generated a file containing command/result values, and have > succesfully done the identification of the plant using "ident", and an > arx411 model. > I have entered this model in "sisotool", and succesfully designed (using > automatic pid optimisation) a compensator: > C=8.962 * (1+0.013w)(1+0.38w) / w, with w=(z-1)/Ts. > I have exported this compensator to workspace, so when I double click on the > "C" object, Matlab says: > > Zero/pole/gain from input "Input" to output "Output": > 16.9566 (z+2.991) (z-0.8676) > ---------------------------- > (z-1) > Sampling time: 0.05 > > My problem is now to synthetise the code of this compensator in C language, > in order to put it in the robot. > My idea was to enter "C" into fdatool (as I think, perhaps naively, that > this compensator is in fact a transfert function, and so a filter), in order > that fdatool generates automatically the code. > Unfortunately, I found no way to import the "C" object in fdatool, which > seems only to accept "dfilt" objects, and not "LTI" - "zpk" objects > I tryed various options for the last 3 days, using Matlab help and Google > extensively, but I am stuck :-( > > I am still a naive Matlab user, and the last time I used Z transforms was at > school, 30 years ago :-) > I am an experienced C developer for embedded systems. > > Am I using correctly the toolboxes? > Is it the right way to solve my problem and synthetize this compensator? > > Any help or pointers would be greatly appreciated!! > > Michel > > >
|
Pages: 1 Prev: Condition number...how large is too large? Next: meditor.exe |