#define SIZE_MAX 1000 #define STEP_TH_LEVEL 0.85 /*----------------------------- C o n s t a n t s --------------------------*/ const float Td= 0.002; // sample time [s] const float u[SIZE_MAX]= { // input data samples -0.0280,-0.0329,-0.0329,-0.0329,-0.0329,-0.0280,-0.0378,-0.0329, -0.0378,-0.0280,-0.0329,-0.0329,-0.0329,-0.0329,-0.0280,-0.0378, -0.0329,-0.0329,-0.0280,-0.0329,-0.0329,-0.0329,-0.0378,-0.0329, -0.0378,-0.0329,-0.0329,-0.0329,-0.0329,-0.0329,-0.0329,-0.0378, -0.0280,-0.0378,-0.0280,-0.0329,-0.0280,-0.0280,-0.0329,-0.0280, -0.0329,-0.0280,-0.0378,-0.0329,-0.0329,-0.0280,-0.0329, 0.9730, 0.9730,0.9778,0.9632,0.9730,0.9730,0.9730,0.9730,0.9681,0.9730, 0.9730,0.9730,0.9778,0.9681,0.9730,0.9778,0.9681,0.9730,0.9730, 0.9632,0.9730,0.9730,0.9681,0.9730,0.9778,0.9730,0.9730,0.9778, 0.9730,0.9681,0.9730,0.9730,0.9730,0.9681,0.9730,0.9778,0.9778, 0.9730,0.9730,0.9730,0.9778,0.9778,0.9681,0.9730,0.9778,0.9778, 0.9778,0.9730,0.9730,0.9778,0.9778,0.9778,0.9730,0.9730,0.9778, 0.9778,0.9778,0.9778,0.9730,0.9681,0.9778,0.9778,0.9778,0.9778, 0.9730,0.9681,0.9730,0.9778,0.9778,0.9778,0.9730,0.9730,0.9778, 0.9778,0.9778,0.9778,0.9681,0.9730,0.9778,0.9778,0.9778,0.9730, 0.9681,0.9730,0.9778,0.9778,0.9730,0.9681,0.9730,0.9778,0.9778, 0.9778,0.9681,0.9730,0.9778,0.9778,0.9730,0.9681,0.9730,0.9778, 0.9778,0.9730,0.9681,0.9730,0.9778,0.9730,0.9730,0.9681,0.9730, 0.9778,0.9730,0.9730,0.9730,0.9730,0.9778,0.9778,0.9681,0.9730, 0.9730,0.9778,0.9730,0.9681,0.9730,0.9730,0.9730,0.9730,0.9681, 0.9730,0.9778,0.9778,0.9730,0.9681,0.9778,0.9778,0.9778,0.9730, 0.9681,0.9730,0.9730,0.9778,0.9681,0.9730,0.9778,0.9778,0.9778, 0.9730,0.9730,0.9730,0.9778,0.9778,0.9730,0.9730,0.9778,0.9778, 0.9778,0.9681,0.9730,0.9730,0.9778,0.9778,0.9730,0.9730,0.9778, 0.9730,0.9778,0.9730,0.9534,0.9778,0.9730,0.9778,0.9730,0.9681, 0.9778,0.9778,0.9778,0.9730,0.9730,0.9778,0.9730,0.9778,0.9681, 0.9730,0.9778,0.9778,0.9730,0.9730,0.9632,0.9730,0.9778,0.9778, 0.9730,0.9681,0.9778,0.9778,0.9778,0.9730,0.9681,0.9730,0.9730, 0.9778,0.9730,0.9681,0.9778,0.9778,0.9778,0.9730,0.9681,0.9730, 0.9778,0.9778,0.9730,0.9632,0.9730,0.9730,0.9730,0.9730,0.9681, 0.9730,0.9730,0.9778,0.9730,0.9632,0.9730,0.9778,0.9778,0.9730, 0.9632,0.9730,0.9778,0.9778,0.9730,0.9681,0.9778,0.9730,0.9778, 0.9730,0.9681,0.9730,-0.0036,-0.0280,-0.0378,-0.0280,-0.0280, -0.0280,-0.0280,-0.0280,-0.0280,-0.0280,-0.0329,-0.0280,-0.0280, -0.0378,-0.0280,-0.0280,-0.0280,-0.0280,-0.0378,-0.0280,-0.0280, -0.0280,-0.0280,-0.0329,-0.0280,-0.0329,-0.0280,-0.0329,-0.0280, -0.0329,-0.0280,-0.0329,-0.0280,-0.0329,-0.0329,-0.0329,-0.0329, -0.0329,-0.0280,-0.0329,-0.0280,-0.0329,-0.0329,-0.0378,-0.0329, -0.0378,-0.0329,-0.0329,-0.0329,-0.0329,-0.0329,-0.0329,-0.0378, -0.0280,-0.0329,-0.0280,-0.0329,-0.0329,-0.0329,-0.0329,-0.0329, -0.0329,-0.0329,-0.0329,-0.0329,-0.0329,-0.0378,-0.0329,-0.0329, -0.0329,-0.0329,-0.0329,-0.0329,-0.0427,-0.0280,-0.0329,-0.0280, -0.0280,-0.0329,-0.0280,-0.0329,-0.0280,-0.0329,-0.0280,-0.0378, -0.0280,-0.0329,-0.0280,-0.0329,-0.0280,-0.0280,-0.0329,-0.0329, -0.0329,-0.0280,-0.0329,-0.0280,-0.0329,-0.0280,-0.0329,-0.0280, -0.0378,-0.0280,-0.0378,-0.0329,-0.0329,-0.0280,-0.0329,-0.0329, -0.0329,-0.0329,-0.0280,-0.0378,-0.0280,-0.0329,-0.0329,-0.0329, -0.0329,-0.0329,-0.0329,-0.0280,-0.0329,-0.0280,-0.0378,-0.0329, -0.0378,-0.0329,-0.0329,-0.0280,-0.0329,-0.0329,-0.0280,-0.0329, -0.0280,-0.0378,-0.0329,-0.0378,-0.0280,-0.0329,-0.0329,-0.0280, -0.0329,-0.0280,-0.0378,-0.0280,-0.0378,-0.0329,-0.0329,-0.0329, -0.0329,-0.0329,-0.0329,-0.0329,-0.0329,-0.0378,-0.0329,-0.0378, -0.0329,-0.0329,-0.0280,-0.0329,-0.0329,-0.0329,-0.0378,-0.0329, -0.0329,-0.0329,-0.0329,-0.0280,-0.0329,-0.0329,-0.0329,-0.0378, -0.0280,-0.0329,-0.0329,-0.0329,-0.0329,-0.0329,-0.0329,-0.0280, -0.0378,-0.0280,-0.0329,-0.0329,-0.0329,-0.0329,-0.0280,-0.0329, -0.0329,-0.0378,-0.0280,-0.0329,-0.0329,-0.0280,-0.0329,-0.0329, -0.0329,-0.0329,-0.0427,-0.0280,-0.0329,-0.0329,-0.0329,-0.0329, -0.0280,-0.0378,-0.0329,-0.0378,-0.0280,-0.0329,-0.0329,-0.0329, -0.0329,-0.0280,-0.0378,-0.0329,-0.0378,-0.0280,-0.0329,-0.0329, -0.0329,-0.0329,0.9730,0.9730,0.9681,0.9730,0.9632,0.9730,0.9730, 0.9730,0.9730,0.9632,0.9730,0.9730,0.9730,0.9730,0.9730,0.9730, 0.9730,0.9681,0.9730,0.9778,0.9681,0.9730,0.9730,0.9730,0.9730, 0.9778,0.9730,0.9681,0.9778,0.9778,0.9730,0.9681,0.9730,0.9778, 0.9778,0.9681,0.9778,0.9730,0.9730,0.9681,0.9730,0.9778,0.9778, 0.9778,0.9730,0.9730,0.9778,0.9730,0.9778,0.9730,0.9681,0.9730, 0.9730,0.9778,0.9778,0.9730,0.9730,0.9730,0.9778,0.9778,0.9778, 0.9681,0.9730,0.9778,0.9778,0.9778,0.9778,0.9730,0.9730,0.9778, 0.9778,0.9778,0.9778,0.9681,0.9730,0.9778,0.9778,0.9778,0.9730, 0.9681,0.9778,0.9730,0.9778,0.9730,0.9681,0.9730,0.9778,0.9778, 0.9730,0.9681,0.9730,0.9778,0.9778,0.9730,0.9681,0.9730,0.9778, 0.9778,0.9778,0.9681,0.9778,0.9778,0.9778,0.9778,0.9681,0.9778, 0.9778,0.9730,0.9778,0.9632,0.9778,0.9730,0.9778,0.9730,0.9632, 0.9778,0.9778,0.9778,0.9730,0.9730,0.9730,0.9778,0.9778,0.9681, 0.9730,0.9778,0.9730,0.9730,0.9681,0.9730,0.9778,0.9778,0.9730, 0.9681,0.9730,0.9730,0.9730,0.9730,0.9730,0.9730,0.9778,0.9778, 0.9730,0.9681,0.9730,0.9778,0.9778,0.9730,0.9730,0.9730,0.9778, 0.9730,0.9778,0.9730,0.9730,0.9778,0.9730,0.9778,0.9730,0.9778, 0.9778,0.9778,0.9730,0.9681,0.9778,0.9778,0.9778,0.9730,0.9681, 0.9778,0.9778,0.9778,0.9778,0.9681,0.9778,0.9778,0.9778,0.9730, 0.9681,0.9730,0.9730,0.9778,0.9730,0.9681,0.9730,0.9778,0.9778, 0.9730,0.9681,0.9730,0.9778,0.9730,0.9778,0.9681,0.9730,0.9778, 0.9778,0.9778,0.9681,0.9730,0.9730,0.9730,0.9778,0.9681,0.9778, 0.9730,0.9778,0.9730,0.9681,0.9730,0.9778,0.9778,0.9778,0.9681, 0.9730,0.9778,0.9778,0.9730,0.9681,0.9730,0.9730,0.9778,0.9730, 0.9681,0.9730,0.9778,0.9778,0.9778,0.9681,0.9730,0.9778,0.9730, 0.9730,0.9681,0.9730,0.9730,0.9730,0.9730,0.9681,-0.0280,-0.0280, -0.0329,-0.0280,-0.0280,-0.0329,-0.0280,-0.0280,-0.0378,-0.0280, -0.0329,-0.0280,-0.0280,-0.0329,-0.0280,-0.0280,-0.0329,-0.0280, -0.0329,-0.0329,-0.0329,-0.0280,-0.0280,-0.0378,-0.0280,-0.0378, -0.0280,-0.0329,-0.0280,-0.0378,-0.0329,-0.0280,-0.0280,-0.0329, -0.0329,-0.0329,-0.0280,-0.0280,-0.0329,-0.0329,-0.0280,-0.0378, -0.0329,-0.0427,-0.0280,-0.0329,-0.0329,-0.0329,-0.0329,-0.0280, -0.0378,-0.0329,-0.0329,-0.0280,-0.0280,-0.0329,-0.0329,-0.0329, -0.0280,-0.0378,-0.0329,-0.0329,-0.0329,-0.0329,-0.0378,-0.0280, -0.0329,-0.0329,-0.0329,-0.0329,-0.0329,-0.0378,-0.0329,-0.0329, -0.0329,-0.0280,-0.0280,-0.0280,-0.0329,-0.0280,-0.0329,-0.0280, -0.0378,-0.0329,-0.0329,-0.0280,-0.0329,-0.0329,-0.0329,-0.0280, -0.0280,-0.0329,-0.0280,-0.0280,-0.0280,-0.0329,-0.0329,-0.0329, -0.0280,-0.0378,-0.0280,-0.0378,-0.0329,-0.0329,-0.0329,-0.0329, -0.0329,-0.0329,-0.0329,-0.0329,-0.0378,-0.0280,-0.0378,-0.0280, -0.0329,-0.0280,-0.0329,-0.0329,-0.0329,-0.0329,-0.0280,-0.0329, -0.0280,-0.0427,-0.0280,-0.0329,-0.0329,-0.0329,-0.0280,-0.0280, -0.0329,-0.0280,-0.0329,-0.0329,-0.0378,-0.0280,-0.0329,-0.0280, -0.0280,-0.0329,-0.0329,-0.0378,-0.0280,-0.0378,-0.0280,-0.0427, -0.0280,-0.0280,-0.0329,-0.0280,-0.0280,-0.0280,-0.0329,-0.0280, -0.0378,-0.0280,-0.0329,-0.0280,-0.0329,-0.0329,-0.0329,-0.0329, -0.0329,-0.0427,-0.0280,-0.0329,-0.0329,-0.0280,-0.0329,-0.0329, -0.0329,-0.0329,-0.0378,-0.0329,-0.0329,-0.0280,-0.0329,-0.0280, -0.0329,-0.0329,-0.0329,-0.0378,-0.0329,-0.0329,-0.0329,-0.0329, -0.0329,-0.0329,-0.0329,-0.0329,-0.0378,-0.0280,-0.0329,-0.0329, -0.0329,-0.0329,-0.0280,-0.0378,-0.0329,-0.0378,-0.0280,-0.0329, -0.0329,-0.0329,-0.0329,-0.0280,-0.0378,-0.0329,-0.0378,-0.0280, -0.0329,-0.0329,-0.0280,-0.0329,-0.0280,-0.0378,-0.0329,-0.0378, -0.0280,-0.0329,-0.0329,-0.0280,0.9730,0.9730,0.9730,0.9730, 0.9730,0.9681,0.9730,0.9778,0.9681,0.9730,0.9730,0.9730,0.9730, 0.9681,0.9778,0.9730,0.9632,0.9778,0.9778,0.9632,0.9730,0.9730, 0.9681,0.9730,0.9730,0.9730,0.9730,0.9778,0.9730,0.9681,0.9730}; const float y[SIZE_MAX]= { // output data samples 0.0062,-0.003,0.0062,0.0062,0.0062,0.0062,0.0062,0.0110,0.0062, 0.0110,0.0013,0.0110,0.0110,0.0110,0.0110,0.0110,0.0159,0.0062, 0.0159,0.0013,0.0159,0.0159,0.0159,0.0159,0.0159,0.0208,0.0110, 0.0208,0.0159,0.0208,0.0208,0.0159,0.0208,0.0159,0.0208,0.0110, 0.0208,0.0208,0.0208,0.0208,0.0208,0.0208,0.0208,0.0208,0.0159, 0.0208,0.0159,0.0257,0.0208,0.0403,0.0452,0.0648,0.0794,0.0989, 0.1234,0.1429,0.1722,0.2064,0.2259,0.2650,0.2991,0.3333,0.3675, 0.4017,0.4359,0.4749,0.5091,0.5482,0.5823,0.6165,0.6507,0.6849, 0.7239,0.7484,0.7874,0.8216,0.8509,0.8753,0.9144,0.9388,0.9681, 0.9876,1.0218,1.0462,1.0657,1.0804,1.1048,1.1194,1.1390,1.1536, 1.1634,1.1829,1.1976,1.2073,1.2122,1.2171,1.2269,1.2317,1.2366, 1.2415,1.2415,1.2366,1.2415,1.2464,1.2415,1.2415,1.2317,1.2269, 1.2269,1.2220,1.2171,1.2122,1.2025,1.1927,1.1878,1.1829,1.1732, 1.1634,1.1536,1.1439,1.1390,1.1341,1.1194,1.1097,1.0950,1.0901, 1.0853,1.0755,1.0706,1.0560,1.0462,1.0462,1.0364,1.0267,1.0169, 1.0071,1.0071,1.0023,0.9974,0.9876,0.9778,0.9827,0.9778,0.9730, 0.9632,0.9534,0.9583,0.9583,0.9534,0.9485,0.9388,0.9485,0.9485, 0.9437,0.9388,0.9388,0.9437,0.9437,0.9388,0.9388,0.9388,0.9437, 0.9485,0.9437,0.9437,0.9534,0.9534,0.9534,0.9534,0.9485,0.9583, 0.9632,0.9632,0.9632,0.9583,0.9730,0.9730,0.9778,0.9730,0.9730, 0.9827,0.9827,0.9876,0.9827,0.9876,0.9925,0.9925,0.9974,0.9925, 0.9974,1.0023,1.0023,1.0023,1.0023,1.0023,1.0120,1.0120,1.0120, 1.0071,1.0120,1.0169,1.0169,1.0169,1.0120,1.0169,1.0169,1.0169, 1.0169,1.0169,1.0169,1.0218,1.0169,1.0169,1.0169,1.0169,1.0218, 1.0169,1.0218,1.0120,1.0169,1.0169,1.0169,1.0169,1.0120,1.0120, 1.0169,1.0120,1.0169,1.0071,1.0071,1.0120,1.0120,1.0120,1.0071, 1.0071,1.0120,1.0120,1.0071,1.0071,1.0023,1.0071,1.0071,1.0071, 1.0023,0.9974,1.0023,1.0071,1.0071,1.0023,0.9925,1.0023,1.0023, 1.0071,0.9974,0.9925,1.0023,0.9974,1.0023,0.9974,0.9925,1.0023, 1.0023,1.0023,0.9974,0.9925,1.0023,0.9974,1.0023,0.9974,0.9925, 1.0023,1.0023,1.0023,0.9974,0.9925,1.0023,1.0023,1.0023,0.9974, 0.9974,1.0023,1.0023,1.0023,0.9974,0.9974,1.0023,0.9974,0.9876, 0.9827,0.9730,0.9534,0.9388,0.9144,0.8851,0.8655,0.8411,0.8069, 0.7825,0.7484,0.7191,0.6849,0.6409,0.6116,0.5775,0.5433,0.5042, 0.4603,0.4359,0.3919,0.3626,0.3284,0.2894,0.2552,0.2259,0.1917, 0.1624,0.1331,0.0989,0.0745,0.0452,0.0208,-0.0036,-0.0231,-0.0524, -0.0720,-0.0915,-0.1061,-0.1208,-0.1403,-0.1550,-0.1696,-0.1745, -0.1940,-0.1940,-0.2038,-0.2087,-0.2136,-0.2184,-0.2233,-0.2282, -0.2233,-0.2282,-0.2233,-0.2233,-0.2184,-0.2087,-0.2184,-0.2038, -0.2038,-0.1940,-0.1891,-0.1843,-0.1745,-0.1745,-0.1550,-0.1501, -0.1452,-0.1354,-0.1257,-0.1159,-0.1110,-0.0964,-0.0915,-0.0768, -0.0720,-0.0573,-0.0524,-0.0378,-0.0329,-0.0280,-0.0183,-0.0183, -0.0036,-0.0036,0.0110,0.0159,0.0257,0.0257,0.0355,0.0403,0.0452, 0.0501,0.0501,0.0599,0.0599,0.0648,0.0648,0.0696,0.0696,0.0745, 0.0696,0.0794,0.0794,0.0794,0.0794,0.0794,0.0794,0.0794,0.0794, 0.0745,0.0745,0.0648,0.0794,0.0843,0.0696,0.0696,0.0696,0.0648, 0.0599,0.0599,0.0599,0.0550,0.0501,0.0550,0.0403,0.0501,0.0452, 0.0452,0.0403,0.0403,0.0355,0.0306,0.0306,0.0208,0.0257,0.0257, 0.0257,0.0208,0.0208,0.0208,0.0159,0.0159,0.0062,0.0159,0.0013, 0.0110,0.0062,0.0062,0.0062,0.0062,0.0062,0.0013,0.0013,-0.0036, 0.0013,0.0013,-0.0036,0.0013,0.0013,0.0013,-0.0036,0.0013,-0.0085, 0.0013,0.0013,0.0062,0.0013,0.0062,0.0013,0.0013,0.0062,0.0013, 0.0062,0.0062,0.0062,0.0062,0.0062,0.0062,0.0062,0.0110,0.0013, 0.0110,0.0110,0.0110,0.0110,0.0062,0.0110,0.0062,0.0159,0.0110, 0.0159,0.0159,0.0159,0.0159,0.0159,0.0159,0.0159,0.0208,0.0159, 0.0208,0.0159,0.0208,0.0208,0.0159,0.0208,0.0110,0.0208,0.0208, 0.0208,0.0208,0.0208,0.0208,0.0159,0.0208,0.0159,0.0208,0.0208, 0.0208,0.0208,0.0306,0.0257,0.0501,0.0599,0.0794,0.0989,0.1185, 0.1478,0.1722,0.2015,0.2357,0.2552,0.2991,0.3284,0.3577,0.4017, 0.4359,0.4700,0.5091,0.5433,0.5775,0.6116,0.6507,0.6800,0.7191, 0.7581,0.7874,0.8216,0.8558,0.8851,0.9095,0.9388,0.9681,0.9925, 1.0169,1.0413,1.0609,1.0804,1.0999,1.1194,1.1390,1.1536,1.1683, 1.1829,1.1878,1.2025,1.2122,1.2220,1.2269,1.2317,1.2269,1.2415, 1.2464,1.2415,1.2415,1.2366,1.2366,1.2366,1.2366,1.2317,1.2317, 1.2171,1.2122,1.2122,1.2073,1.1976,1.1878,1.1780,1.1732,1.1634, 1.1585,1.1487,1.1390,1.1194,1.1194,1.1146,1.0999,1.0950,1.0804, 1.0755,1.0706,1.0560,1.0511,1.0413,1.0267,1.0267,1.0218,1.0120, 1.0071,0.9925,0.9974,0.9876,0.9876,0.9778,0.9681,0.9730,0.9681, 0.9632,0.9583,0.9485,0.9534,0.9534,0.9534,0.9437,0.9388,0.9437, 0.9437,0.9437,0.9388,0.9388,0.9437,0.9437,0.9437,0.9437,0.9437, 0.9485,0.9485,0.9534,0.9485,0.9534,0.9583,0.9583,0.9583,0.9534, 0.9632,0.9681,0.9681,0.9730,0.9632,0.9778,0.9778,0.9778,0.9778, 0.9778,0.9876,0.9925,0.9925,0.9925,0.9925,0.9974,0.9974,1.0023, 1.0023,1.0023,1.0023,1.0071,1.0071,1.0071,1.0120,1.0120,1.0120, 1.0169,1.0120,1.0169,1.0169,1.0169,1.0169,1.0169,1.0169,1.0169, 1.0218,1.0169,1.0169,1.0169,1.0218,1.0218,1.0218,1.0169,1.0120, 1.0169,1.0218,1.0169,1.0120,1.0071,1.0169,1.0169,1.0169,1.0120, 1.0071,1.0120,1.0169,1.0120,1.0120,1.0071,1.0120,1.0120,1.0120, 1.0071,0.9974,1.0071,1.0120,1.0071,1.0071,1.0023,1.0023,1.0023, 1.0023,1.0071,0.9974,1.0023,1.0023,1.0023,1.0023,0.9974,1.0023, 1.0023,1.0023,1.0023,0.9925,0.9974,1.0023,1.0023,0.9974,0.9925, 1.0023,1.0023,0.9974,1.0023,0.9925,0.9974,1.0023,1.0023,1.0023, 0.9925,0.9974,1.0023,1.0023,0.9974,0.9925,1.0023,1.0023,0.9974, 1.0023,0.9925,1.0023,1.0023,1.0023,1.0023,0.9974,0.9925,0.9827, 0.9730,0.9583,0.9339,0.9144,0.8948,0.8655,0.8411,0.8118,0.7728, 0.7532,0.7142,0.6849,0.6507,0.6067,0.5775,0.5482,0.5091,0.4700, 0.4261,0.4017,0.3577,0.3284,0.2894,0.2601,0.2259,0.1917,0.1624, 0.1331,0.1038,0.0745,0.0452,0.0208,-0.0036,-0.0280,-0.0475,-0.0671, -0.0915,-0.1061,-0.1257,-0.1354,-0.1550,-0.1647,-0.1794,-0.1891, -0.1989,-0.2038,-0.2087,-0.2136,-0.2136,-0.2233,-0.2233,-0.2331, -0.2184,-0.2233,-0.2233,-0.2184,-0.2184,-0.2087,-0.2136,-0.2038, -0.1940,-0.1891,-0.1794,-0.1794,-0.1647,-0.1647,-0.1501,-0.1403, -0.1354,-0.1208,-0.1208,-0.1013,-0.0964,-0.0866,-0.0768,-0.0671, -0.0573,-0.0524,-0.0427,-0.0329,-0.0231,-0.0231,-0.0085,-0.0085, 0.0062,0.0013,0.0159,0.0208,0.0306,0.0355,0.0403,0.0452,0.0501, 0.0550,0.0599,0.0648,0.0648,0.0696,0.0648,0.0745,0.0648,0.0745, 0.0745,0.0794,0.0794,0.0794,0.0794,0.0794,0.0794,0.0745,0.0794, 0.0696,0.0745,0.0648,0.0745,0.0696,0.0696,0.0648,0.0648,0.0648, 0.0599,0.0599,0.0550,0.0550,0.0452,0.0501,0.0452,0.0452,0.0403, 0.0403,0.0403,0.0355,0.0355,0.0257,0.0306,0.0208,0.0257,0.0208, 0.0208,0.0208,0.0159,0.0208,0.0110,0.0110,0.0062,0.0110,0.0062, 0.0062,0.0062,0.0062,0.0062,0.0013,0.0062,-0.0036,0.0062,-0.0036, 0.0013,0.0013,0.0013,0.0013,-0.0036,0.0013,-0.0036,0.0013,0.0013, 0.0013,0.0013,0.0013,0.0062,0.0013,0.0062,-0.0036,0.0062,-0.0036, 0.0062,0.0062,0.0062,0.0062,0.0062,0.0062,0.0013,0.0110,0.0062, 0.0110,0.0110,0.0110,0.0159,0.0110,0.0159,0.0062,0.0159,0.0159, 0.0159,0.0159,0.0159,0.0159,0.0110,0.0208,0.0110,0.0208,0.0159, 0.0208,0.0208,0.0159,0.0208,0.0159,0.0208,0.0110,0.0208,0.0159, 0.0208,0.0208,0.0208,0.0208,0.0159,0.0208,0.0110,0.0208,0.0208, 0.0257,0.0257,0.0355,0.0403,0.0648,0.0794,0.0989,0.1234,0.1429, 0.1722,0.2015,0.2210,0.2650,0.2942,0.3284,0.3675,0.3968,0.4359, 0.4749,0.5042,0.5433,0.5823,0.6116,0.6458,0.6849,0.7191,0.7435, 0.7874,0.8216,0.8509,0.8802}; /* Parameter Structure */ typedef struct syss_t { float ymax, ymax2; // maximum values of output float ymin; // minimum between maximums float t0, t1, t2; // time indexes float uss, yss; // steady-state values float kp, D, w0; // calculated parameters }sysS_param_t; sysS_param_t pp={0,0,1,0,}; int main(void) { /* local variables */ int brise, bfall; // booleans int irise=0, ifall=0, imax=0, imin=0, i; // indexes int status; brise= 1; bfall= 0; /* (1) find intervall */ for(i=1; i STEP_TH_LEVEL) { // detect rising impulse brise= 0; bfall= 1; irise= i-1; // found rising index } }//end for /* (2) find global maximum */ fin1: for(i=irise+1; i pp.ymax) { // detect maximum w/ corresponding time pp.ymax= y[i]; pp.t1= i*Td; imax= i; } /* (3) find following minimum */ for(i=imax; i pp.ymax2) { pp.ymax2= y[i]; pp.t2= i*Td; } status= calc_PT2param(pp.ymax,pp.ymax2,pp.t1,pp.t2,pp.uss,pp.yss); if(!status) { printf("\n Parameters found.."); return(EXIT_SUCCESS); }