cnpcshangbo / simscapeFOPD

Simscape drone altitude control with fractional order proportional derivate controller
Other
12 stars 5 forks source link

How to convert Fractional DD to discrete? #10

Open cnpcshangbo opened 6 years ago

cnpcshangbo commented 6 years ago

Finally, we found the reason. I used Fractional DD block in the simulator, however, it is a continuous block, I need to change it to discrete block. Here is what we did: image image I added a new Edit to enter sampling period(Ts). image Then I added a c2d command to change the transfer function to discrete.

cnpcshangbo commented 6 years ago

image So we can input the sampling period.

cnpcshangbo commented 6 years ago

We still need to change the transfer function to discrete transfer function. image

cnpcshangbo commented 6 years ago

Two rate transitions need to be added. image

cnpcshangbo commented 6 years ago

Then we got some error.

Simulation 1 Clear 01:11 PM Elapsed: 27 sec Model Reference Elapsed: 0.12 sec An error occurred while running the simulation and the simulation was terminated Caused by: ['Quadrotor_Controller/Actuation/Solver Configuration']: Error evaluating equations at time 6.9925000000000006. Stopping simulation. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances) ['Quadrotor_Controller/External Force/6-DOF Joint']: 'Quadrotor_Controller/External Force/6-DOF Joint' has a degenerate mass distribution on its follower side. Component:Simulink | Category:Block error

cnpcshangbo commented 6 years ago

Then I reduced the sampling period to 0.05 sec. It has the oscillation like this: image

cnpcshangbo commented 6 years ago

Then I tried to reduce the loop gain by half. image image

cnpcshangbo commented 6 years ago

Then I tried to multiply 0.05 instead of 0.5 for the FOPD controller gain. image

cnpcshangbo commented 6 years ago

image It still has similar behavior. Then I need to try getting the sampling period larger.

cnpcshangbo commented 6 years ago

image The behavior is similar. I guess I also need to discrete the integer order part? I'll try to see what will happen when I comment out the Fractional DD.