亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pid.c

?? CNC 的開放碼,EMC2 V2.2.8版
?? C
?? 第 1 頁 / 共 2 頁
字號:
/********************************************************************* Description:  pid.c*               This file, 'pid.c', is a HAL component that provides *               Proportional/Integeral/Derivative control loops.** Author: John Kasunich* License: GPL Version 2*    * Copyright (c) 2003 All rights reserved.** Last change: # $Revision: 1.31 $* $Author: swpadnos $* $Date: 2007/09/23 02:49:20 $********************************************************************//** This file, 'pid.c', is a HAL component that provides Proportional/    Integeral/Derivative control loops.  It is a realtime component.    It supports a maximum of 16 PID loops, as set by the insmod parameter    'num_chan'.    In this documentation, it is assumed that we are discussing position    loops.  However this component can be used to implement other loops    such as speed loops, torch height control, and others.    Each loop has a number of pins and parameters, whose names begin    with 'pid.x.', where 'x' is the channel number.  Channel numbers    start at zero.    The three most important pins are 'command', 'feedback', and    'output'.  For a position loop, 'command' and 'feedback' are    in position units.  For a linear axis, this could be inches,    mm, metres, or whatever is relavent.  Likewise, for a angular    axis, it could be degrees, radians, etc.  The units of the    'output' pin represent the change needed to make the feedback    match the command.  As such, for a position loop 'Output' is    a velocity, in inches/sec, mm/sec, degrees/sec, etc.    Each loop has several other pins as well.  'error' is equal to    'command' minus 'feedback'.  'enable' is a bit that enables    the loop.  If 'enable' is false, all integrators are reset,    and the output is forced to zero.  If 'enable' is true, the    loop operates normally.    The PID gains, limits, and other 'tunable' features of the    loop are implemented as parameters.  These are as follows:    Pgain	Proportional gain    Igain	Integral gain    Dgain	Derivative gain    bias	Constant offset on output    FF0		Zeroth order Feedforward gain    FF1		First order Feedforward gain    FF2		Second order Feedforward gain    deadband	Amount of error that will be ignored    maxerror	Limit on error    maxerrorI	Limit on error integrator    maxerrorD	Limit on error differentiator    maxcmdD	Limit on command differentiator    maxcmdDD	Limit on command 2nd derivative    maxoutput	Limit on output value    All of the limits (max____) are implemented such that if the    parameter value is zero, there is no limit.    A number of internal values which may be usefull for testing    and tuning are also available as parameters.  To avoid cluttering    the parameter list, these are only exported if "debug=1" is    specified on the insmod command line.    errorI	Integral of error    errorD	Derivative of error    commandD	Derivative of the command    commandDD	2nd derivative of the command    The PID loop calculations are as follows (see the code for    all the nitty gritty details):    error = command - feedback    if ( abs(error) < deadband ) then error = 0    limit error to +/- maxerror    errorI += error * period    limit errorI to +/- maxerrorI    errorD = (error - previouserror) / period    limit errorD to +/- maxerrorD    commandD = (command - previouscommand) / period    limit commandD to +/- maxcmdD    commandDD = (commandD - previouscommandD) / period    limit commandDD to +/- maxcmdDD    output = bias + error * Pgain + errorI * Igain +             errorD * Dgain + command * FF0 + commandD * FF1 +             commandDD * FF2    limit output to +/- maxoutput    This component exports one function called 'pid.x.do-pid-calcs'    for each PID loop.  This allows loops to be included in different    threads and execute at different rates.*//** Copyright (C) 2003 John Kasunich                       <jmkasunich AT users DOT sourceforge DOT net>*//** This program is free software; you can redistribute it and/or    modify it under the terms of version 2 of the GNU General    Public License as published by the Free Software Foundation.    This library is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public    License along with this library; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111 USA    THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR    ANY HARM OR LOSS RESULTING FROM ITS USE.  IT IS _EXTREMELY_ UNWISE    TO RELY ON SOFTWARE ALONE FOR SAFETY.  Any machinery capable of    harming persons must have provisions for completely removing power    from all motors, etc, before persons enter any danger area.  All    machinery must be designed to comply with local and national safety    codes, and the authors of this software can not, and do not, take    any responsibility for such compliance.    This code was written as part of the EMC HAL project.  For more    information, go to www.linuxcnc.org.*/#ifndef RTAPI#error This is a realtime component only!#endif#include "rtapi.h"		/* RTAPI realtime OS API */#include "rtapi_app.h"		/* RTAPI realtime module decls */#include "hal.h"		/* HAL public API decls *//* module information */MODULE_AUTHOR("John Kasunich");MODULE_DESCRIPTION("PID Loop Component for EMC HAL");MODULE_LICENSE("GPL");static int num_chan = 3;	/* number of channels - default = 3 */RTAPI_MP_INT(num_chan, "number of channels");static int debug = 0;		/* flag to export optional params */RTAPI_MP_INT(debug, "enables optional params");/************************************************************************                STRUCTURES AND GLOBAL VARIABLES                       *************************************************************************//** This structure contains the runtime data for a single PID loop.    The data is arranged to optimize speed - they are placed in the    order in which they will be accessed, so that when one item is    accessed, the next item(s) will be pulled into the cache.  In    addition, items that are written are grouped together, so only    a few cache lines will need to be written back to main memory.*/typedef struct {    hal_bit_t *enable;		/* pin: enable input */    hal_float_t *command;	/* pin: commanded value */    hal_float_t *feedback;	/* pin: feedback value */    hal_float_t *error;		/* pin: command - feedback */    hal_float_t deadband;	/* param: deadband */    hal_float_t maxerror;	/* param: limit for error */    hal_float_t maxerror_i;	/* param: limit for integrated error */    hal_float_t maxerror_d;	/* param: limit for differentiated error */    hal_float_t maxcmd_d;	/* param: limit for differentiated cmd */    hal_float_t maxcmd_dd;	/* param: limit for 2nd derivative of cmd */    hal_float_t error_i;	/* opt. param: integrated error */    float prev_error;		/* previous error for differentiator */    hal_float_t error_d;	/* opt. param: differentiated error */    float prev_cmd;		/* previous command for differentiator */    float limit_state;		/* +1 or -1 if in limit, else 0.0 */    hal_float_t cmd_d;		/* opt. param: differentiated command */    hal_float_t cmd_dd;		/* opt. param: 2nd derivative of command */    hal_float_t bias;		/* param: steady state offset */    hal_float_t pgain;		/* param: proportional gain */    hal_float_t igain;		/* param: integral gain */    hal_float_t dgain;		/* param: derivative gain */    hal_float_t ff0gain;	/* param: feedforward proportional */    hal_float_t ff1gain;	/* param: feedforward derivative */    hal_float_t ff2gain;	/* param: feedforward 2nd derivative */    hal_float_t maxoutput;	/* param: limit for PID output */    hal_float_t *output;	/* pin: the output value */} hal_pid_t;/* pointer to array of pid_t structs in shared memory, 1 per loop */static hal_pid_t *pid_array;/* other globals */static int comp_id;		/* component ID *//************************************************************************                  LOCAL FUNCTION DECLARATIONS                         *************************************************************************/static int export_pid(int num, hal_pid_t * addr);static void calc_pid(void *arg, long period);/************************************************************************                       INIT AND EXIT CODE                             *************************************************************************/#define MAX_CHAN 16int rtapi_app_main(void){    int n, retval;    /* test for number of channels */    if ((num_chan <= 0) || (num_chan > MAX_CHAN)) {	rtapi_print_msg(RTAPI_MSG_ERR,	    "PID: ERROR: invalid num_chan: %d\n", num_chan);	return -1;    }    /* have good config info, connect to the HAL */    comp_id = hal_init("pid");    if (comp_id < 0) {	rtapi_print_msg(RTAPI_MSG_ERR, "PID: ERROR: hal_init() failed\n");	return -1;    }    /* allocate shared memory for pid loop data */    pid_array = hal_malloc(num_chan * sizeof(hal_pid_t));    if (pid_array == 0) {	rtapi_print_msg(RTAPI_MSG_ERR, "PID: ERROR: hal_malloc() failed\n");	hal_exit(comp_id);	return -1;    }    /* export variables and function for each PID loop */    for (n = 0; n < num_chan; n++) {	/* export everything for this loop */	retval = export_pid(n, &(pid_array[n]));	if (retval != 0) {	    rtapi_print_msg(RTAPI_MSG_ERR,		"PID: ERROR: loop %d var export failed\n", n);	    hal_exit(comp_id);	    return -1;	}    }    rtapi_print_msg(RTAPI_MSG_INFO, "PID: installed %d PID loops\n",	num_chan);    hal_ready(comp_id);    return 0;}void rtapi_app_exit(void){    hal_exit(comp_id);}/************************************************************************                   REALTIME PID LOOP CALCULATIONS                     *************************************************************************/static void calc_pid(void *arg, long period){    hal_pid_t *pid;    float tmp1, tmp2;    int enable;    float periodfp, periodrecip;    /* point to the data for this PID loop */    pid = arg;    /* precalculate some timing constants */    periodfp = period * 0.000000001;    periodrecip = 1.0 / periodfp;    /* get the enable bit */    enable = *(pid->enable);    /* calculate the error */    tmp1 = *(pid->command) - *(pid->feedback);    /* store error to error pin */    *(pid->error) = tmp1;    /* apply error limits */    if (pid->maxerror != 0.0) {	if (tmp1 > pid->maxerror) {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品嫩草影院久久| 免费久久精品视频| 久久精品国产成人一区二区三区| 国产一区二区美女| 欧美色图12p| 国产精品剧情在线亚洲| 免费观看一级欧美片| 91麻豆6部合集magnet| 久久久久久综合| 日韩成人精品在线| 日本韩国欧美三级| 国产精品久久夜| 国产麻豆9l精品三级站| 日韩亚洲欧美高清| 日韩国产欧美一区二区三区| 91日韩一区二区三区| 中文字幕成人av| 国产一区二区中文字幕| 精品久久久久久久人人人人传媒| 亚洲成人精品在线观看| 色综合视频一区二区三区高清| 国产日韩欧美精品综合| 极品少妇一区二区三区精品视频| 欧美精品少妇一区二区三区 | 成人黄色片在线观看| www欧美成人18+| 久久国产视频网| 日韩欧美一二三区| 国内精品国产三级国产a久久| 欧美一区二区三区视频| 麻豆国产精品官网| 日韩免费观看高清完整版| 日韩精品三区四区| 日韩欧美国产麻豆| 精品一区二区国语对白| 久久这里只有精品6| 国产精品69毛片高清亚洲| 国产三级精品三级| 99久久国产综合色|国产精品| 中国av一区二区三区| 成人sese在线| 亚洲三级视频在线观看| 欧美在线你懂得| 视频在线观看91| 日韩欧美高清在线| 国产精品一级黄| 国产精品久久免费看| 一本大道久久a久久精二百| 一区二区三区中文字幕在线观看| 欧美这里有精品| 人人狠狠综合久久亚洲| 久久综合久久综合久久综合| 国产a级毛片一区| 亚洲精品ww久久久久久p站| 欧美少妇bbb| 国产精品中文字幕欧美| 中文字幕佐山爱一区二区免费| 91啦中文在线观看| 蜜臀av性久久久久蜜臀aⅴ流畅| 久久久精品蜜桃| 色婷婷综合久久久中文一区二区| 亚洲v日本v欧美v久久精品| 精品日韩一区二区| 91视频免费播放| 青草av.久久免费一区| 国产精品美女视频| 欧美日韩国产免费| 成人一级视频在线观看| 亚洲va韩国va欧美va| 国产午夜精品一区二区三区嫩草| av午夜一区麻豆| 捆绑紧缚一区二区三区视频| 欧美激情在线一区二区三区| 欧美电影在线免费观看| aaa国产一区| 国产尤物一区二区| 亚洲成a天堂v人片| 欧美高清在线一区二区| 日韩无一区二区| 色天天综合久久久久综合片| 韩国毛片一区二区三区| 亚洲国产精品久久久久婷婷884 | 一区二区三区**美女毛片| 日韩欧美精品在线| 色综合激情五月| 国产大陆亚洲精品国产| 婷婷久久综合九色综合伊人色| 国产精品狼人久久影院观看方式| 欧美成人女星排名| 欧美日韩国产高清一区二区| 94-欧美-setu| 成人影视亚洲图片在线| 国产精品乡下勾搭老头1| 免费成人在线视频观看| 亚洲一区二区精品久久av| 中文字幕在线不卡一区| 国产亚洲成年网址在线观看| 日韩女优av电影在线观看| 欧美肥妇bbw| 欧美猛男男办公室激情| 色女孩综合影院| 91香蕉视频mp4| 99久久久精品免费观看国产蜜| 韩国成人在线视频| 久久99久久99| 久久99热狠狠色一区二区| 日韩精品电影在线观看| 五月婷婷综合网| 日韩精品三区四区| 爽好多水快深点欧美视频| 亚洲v中文字幕| 日韩av中文字幕一区二区| 五月天婷婷综合| 日韩专区一卡二卡| 首页国产欧美久久| 免费观看在线综合| 精品一区二区三区视频| 精品一区二区在线视频| 九九九久久久精品| 国产自产视频一区二区三区| 国产精品一品二品| 成人综合在线观看| 99久久久无码国产精品| 在线一区二区三区四区五区| 在线观看免费亚洲| 91精品午夜视频| 欧美精品一区二区三区在线 | 欧美一级一区二区| 欧美成人免费网站| 国产精品久线观看视频| 亚洲人成网站色在线观看| 亚洲综合久久av| 日韩高清一级片| 国产精品亚洲а∨天堂免在线| 成人少妇影院yyyy| 欧美专区日韩专区| 欧美精品一区男女天堂| 中文字幕一区二区5566日韩| 亚洲一区中文日韩| 精品在线播放午夜| 97se亚洲国产综合在线| 777色狠狠一区二区三区| 久久久久亚洲综合| 亚洲综合自拍偷拍| 久国产精品韩国三级视频| 99在线视频精品| 欧美日韩一卡二卡三卡| 久久久午夜电影| 亚洲自拍都市欧美小说| 韩国理伦片一区二区三区在线播放| av电影在线观看不卡| 日韩欧美一级在线播放| 国产精品麻豆欧美日韩ww| 日韩综合一区二区| 99精品偷自拍| 精品美女一区二区三区| 亚洲品质自拍视频| 精品一区二区三区在线观看国产| 91在线国产福利| 欧美大片日本大片免费观看| 亚洲色图丝袜美腿| 国产一区二区三区免费播放| 欧美日韩一级大片网址| 中文字幕在线视频一区| 美女mm1313爽爽久久久蜜臀| 91丨九色porny丨蝌蚪| 精品成a人在线观看| 亚洲成人自拍网| 97成人超碰视| 国产人成亚洲第一网站在线播放 | 91精品国产色综合久久| 亚洲视频香蕉人妖| 国产美女久久久久| 欧美一区二区三区免费观看视频 | 精品一区二区三区在线播放视频| 在线观看日韩一区| 国产精品美女www爽爽爽| 日韩影院精彩在线| 在线观看免费一区| 亚洲欧美国产毛片在线| 国产成人精品aa毛片| 欧美电影精品一区二区| 亚洲妇熟xx妇色黄| av成人免费在线| 欧美国产在线观看| 国产凹凸在线观看一区二区| 精品国产乱码久久久久久久| 午夜视频久久久久久| 欧洲精品在线观看| 亚洲网友自拍偷拍| 欧美三片在线视频观看| 亚洲一区二区三区美女| 欧美在线短视频| 一区二区三区四区五区视频在线观看 | 国产精品高潮呻吟久久| 风间由美性色一区二区三区| 国产日韩v精品一区二区| 国产激情偷乱视频一区二区三区| 欧美成人激情免费网| 久久国产人妖系列|