SNL-WaterPower / siweed

Sandia Interactive Wave Energy Education Display (SIWEED)
4 stars 2 forks source link

Why use a Due for the WEC? #61

Closed ryancoe closed 3 years ago

ryancoe commented 3 years ago

From Steve's email:

@DeepFriedDerp @nickross4444 - Is this all still relevant with our current set up?

nickross4444 commented 3 years ago

@ryancoe @DeepFriedDerp The faster processor seems to be useful, as I'll explain further down. We aren't using the quadrature decoding functionality right now, but we are having a little trouble with the SPI to the external encoder buffer, so we might end up using. That being said, Gerrit and I have some confidence in being able to figure out the SPI.

I did some testing on the interrupt timing on the Due and mega. Both of these were done with all functions active(except maybe the jonswap), so I believe them to be accurate to what we will see with hardware runtime. Each arduino has 2 interrupts, the control loop and the serial loop. I kept the serial loop at it's standard 32hz and pushed the control loop down until it stopped working:

Arduino Due:

Arduino Mega:

I was pretty surprised with the speed of the interrupts, I thought the Due would be much faster than the Mega. I think the most important factor here is the interrupt variation. The mega's variations were less than 1% but still much worse than the Due. I think for that and the significantly faster execution time it's still worth using the Due for the WEC controller. I also still think that the mega is fine for the Wavemaker, since interrupt tightness is less important for that control algorithm.

@gbacelli Could you look at these numbers and let us know if they seem acceptable? If not, we can talk about switching to the Zephr ROS, or to a teensy, which should operate up to a Ghz and might be easier to convert our code to.

nickross4444 commented 3 years ago

Will close this issue once we have tested the control loop on the hardware.