Page 1 of 2

Amazing ball model

Posted: Fri Jul 15, 2011 9:50 am
by hoainamnguyen
Hello,

Recently,I bought the ball and plate system for studying advanced control methods. For this, I need the system parameters? Could anyone please tell me, where can I find the system parameters?

Thanks in advance,
Nam Nguyen

Re: Amazing ball model

Posted: Fri Jul 15, 2011 9:54 am
by paolo.gai
Ciao,

The control model we used is public and published as a demo in the
ScicosPack v10.

On my machine, it is under

C:\Evidence\scicoslab-4.4.1\contrib\scicos_ee\examples\scicos_flex\Amazing_Ball\pid_ctrl_udp_codegen.cos

I hope this helps...

Ciao,

Paolo

Re: Amazing ball model

Posted: Fri Jul 15, 2011 10:51 am
by erikadds
Ciao Nam,
in the development of advanced control is necessary to spend much time studying the model of the system. The model can be derived in two ways. Is there an approach of analysis that is based on the cardinal equations of motion, or a different approach that is based on experimental identification algorithms (the same goes for both linear and nonlinear systems). The mathematical analytical model (linear or nonlinear) of a ball-and-plate system (like the AmazingBall) is available in some online articles. In Scicos pack there is a very simple control system based on PID. It does not require an accurate knowledge of the system model (a linear analytical model is sufficient) and can be set up quickly with a calibration procedure. I hope this helps. Greetings.

Re: Amazing ball model

Posted: Thu Sep 22, 2011 3:49 pm
by hoainamnguyen
Hi,

I would like to generate a C-code from Scicos and I follow the tutorial: "Installing scicoslab and generating code from a Scicos diagram" on the wiki website. But I can not find a folder "\dspic" in the directory "C:\Program Files\scicoslab-4.4.1\contrib".

Can anyone please tell me what I have to do to compile a control application?

My Scicoslab version is 4.4.1 and ScicosLab Pack version is 10.0.

Thank you very much.
Nam Nguyen.

Re: Amazing ball model

Posted: Thu Sep 22, 2011 4:06 pm
by paolo.gai
Hi Nam!

Scicos pack 10 changed the directory locations, to prepare for newer versions.

On my machine the directory is

C:\Evidence\scicoslab-4.4.1\contrib\scicos_ee\examples\scicos_flex\Amazing_Ball

I suggest you to look at the model in pid_ctrl_udp_codegen.cos and to use the diagram PCside_AmazingBall_UDP_Monitor.cos on the PC in simulation to get the value from the ethernet cable...

Ciao,

Paolo

Re: Amazing ball model

Posted: Thu Sep 22, 2011 4:11 pm
by paolo.gai
I have just updated the tutorial with the correct directory... Thanks for pointing this out.

PJ

Re: Amazing ball model

Posted: Fri Sep 23, 2011 1:42 pm
by hoainamnguyen
Thank you for your prompt response.

Re: Amazing ball model

Posted: Fri Sep 23, 2011 1:55 pm
by hoainamnguyen
Hi,

I have another problem. I ran the led_sin.cos example and tried to compile the Scicos diagram. But I cannot find the pic30.elf or event pic30.cof inside the Debug directory.

Here is a picture of a console, while the Scicos tried to generate a code.

Best,
Nam Nguyen

Re: Amazing ball model

Posted: Wed Sep 28, 2011 2:20 pm
by paolo.gai
It could be due to the version of the compiler. Microchip uses to change the file locations at every version of the compiler :-(

In other words,

- the script is looking for a file which seems does not exist

- please check that the compiler directory is correctly specified (in your screenshot there are two errors, one is about the lib directory, another one about the missing file .h)

- check if you specified the "xxxxxx/bin" directory when you specified the C compiler installation directory. the "bin" should not be a part of the installation directory

- On my PC I used compiler version 3.25 and it worked fine. I did not use version 3.30

Let me know if these hints resolved your problem...

Ciao,

Paolo

Re: Amazing ball model

Posted: Thu Sep 29, 2011 4:43 pm
by hoainamnguyen
Thank you for your answer.

After changing the directory from "C:\Program Files\Microchip\mplabc30" to "C:\Program Files\Microchip\mplabc30\v3.30", it works.

I hope, I'm not so annoying.

Ciao,
Nam Nguyen

Re: Amazing ball model

Posted: Thu Sep 29, 2011 4:56 pm
by paolo.gai
No problem at all... I'm happy you fixed the problem!

PJ

Re: Amazing ball model

Posted: Tue Oct 11, 2011 4:58 pm
by hoainamnguyen
I have just bought the ICD3 programmer and tried with the "pid_ctrl_codegen_udp_tuning_square_circle.cos" example. It worked perfectly and thank you very much for a very nice work on the "ball and plate" experiment.

Now I try to apply some other controller. And I have a few questions:

1) What is the input range for the "Amazing PWM outputs" block? It seems to me that we have non-symmetric constraints on the inputs of the "Amazing PWM outputs" block?

2) Do we have any sensor to measure the angles of the two motors?

Thank you in advance,
Nam NGUYEN

Re: Amazing ball model

Posted: Wed Oct 12, 2011 10:43 am
by hoainamnguyen
Hi,

I have also one question. How can I save the position of the ball in the ".txt" file for the other purposes.

Ciao,
Nam Nguyen

Re: Amazing ball model

Posted: Wed Oct 12, 2011 3:44 pm
by erikadds
Thank you for using our tools!

1) What is the input range for the "Amazing PWM outputs" block? It Seems to me that we have non-symmetric constraints on the inputs of the "Amazing PWM outputs" block?

The formula used in the code is: angle_degrees* 10 + 1500 in the range [0, PR2 register]
The inputs of the block are in degrees.
I advise you to stay below 45 degrees, to stay away from the singularities.
To insert a saturation use the block "Saturation" in the MCHP16-Nonlinear palette.

2) Do we have to measure the sensor Any angles of the two motors?

No. The assumption is: input = shaft angle

3) How can I save the position of the ball in the. "Txt" file for the other purposes.

Use the block "write to output file" contained in the Sinks palette.

Regards,
Dario

Re: Amazing ball model

Posted: Fri Oct 14, 2011 9:10 am
by hoainamnguyen
Hi,

I'm sorry, may be this question is stupid, but I'm a newbie in Scicos. I want to apply some control law for the ball and plate system. The control law involves a "if-else-then"statement.

For example:

if H1*x <= K1, then u = u1;
else if H2*x <= K2 then u = u2;
else u = u3;
end if

Could you please tell me how can I do this?

Thank you very much,
Nam Nguyen