auto-examples icon indicating copy to clipboard operation
auto-examples copied to clipboard

Integrating the adjustment in the PID example?

Open freckletonj opened this issue 5 years ago • 1 comments

In the PID example, there's a line (https://github.com/mstksg/auto-examples/blob/master/src/Recursive.hs#L103):

control  <- sumFromD c0 -< adjustment

I get why one would delay a signal in the recursive setting, but I don't think a PID should integrate adjustment in the first place.

Shouldn't it just be:

...        
        let control = kp * err
                       + ki * cumulativeSum
                       + kd * fromMaybe 0 changes
        response <- blackbox   -< control
    id -< response

freckletonj avatar Jun 27 '20 00:06 freckletonj

Ah, I read the code before the readme. But I still don't get why sumFromD is the same as system . delay

currResponse <- system . delay c0 -< control

freckletonj avatar Jun 27 '20 00:06 freckletonj