Ann, error to pd, output pd to plant and also sets weights in ann