亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲欧洲美洲综合色网| 亚洲自拍偷拍av| 91黄色小视频| 精品一区二区三区视频在线观看 | 精品一区二区三区免费视频| 国产精品剧情在线亚洲| 欧美一区二区网站| 色综合视频一区二区三区高清| 美国精品在线观看| 一区二区在线免费观看| 久久亚洲综合色一区二区三区| 欧美美女黄视频| 99久久综合狠狠综合久久| 麻豆国产精品视频| 亚洲国产精品久久一线不卡| 国产精品久久久久婷婷二区次| 日韩免费在线观看| 欧美三级蜜桃2在线观看| 成人18视频在线播放| 美女诱惑一区二区| 天天免费综合色| 一区二区三区色| 日韩一区日韩二区| 国产欧美一区二区在线| 精品国产乱码久久久久久蜜臀 | 美女性感视频久久| 五月婷婷综合网| 一个色在线综合| 亚洲另类春色国产| 综合av第一页| 国产精品夫妻自拍| 国产精品美女久久久久aⅴ| 日韩视频123| 日韩欧美高清dvd碟片| 欧美乱妇15p| 欧美日韩精品电影| 91精品在线观看入口| 欧美日韩精品免费| 欧美精品久久99久久在免费线| 欧美日韩dvd在线观看| 欧美主播一区二区三区美女| 欧美这里有精品| 欧美三级韩国三级日本三斤| 欧美日韩亚洲综合在线| 欧美日韩一区 二区 三区 久久精品| 欧美视频一区二区在线观看| 欧美三区在线观看| 欧美精品亚洲二区| 337p亚洲精品色噜噜| 91精品国产手机| 精品福利在线导航| 欧美国产精品中文字幕| 国产精品毛片大码女人| 亚洲视频 欧洲视频| 亚洲男帅同性gay1069| 一区二区在线看| 亚洲一区av在线| 蜜臀av性久久久久蜜臀av麻豆| 极品美女销魂一区二区三区免费| 国产精品影视网| 色偷偷久久一区二区三区| 欧美日韩精品欧美日韩精品| 精品国产一区久久| 国产精品麻豆欧美日韩ww| 尤物在线观看一区| 麻豆精品视频在线| 粉嫩av一区二区三区| 91九色最新地址| 日韩女优av电影在线观看| 欧美激情综合网| 一区二区三区成人| 精品一区二区久久| 91亚洲精品乱码久久久久久蜜桃| 欧美日韩高清在线播放| 精品久久久久一区| 18欧美亚洲精品| 日韩av一级片| 成人av综合在线| 7777精品伊人久久久大香线蕉最新版| 精品成人佐山爱一区二区| 国产精品福利一区二区三区| 图片区小说区区亚洲影院| 国产精品中文字幕一区二区三区| 色香蕉久久蜜桃| 久久综合给合久久狠狠狠97色69| 亚洲欧美韩国综合色| 蜜臀久久久久久久| 99麻豆久久久国产精品免费优播| 欧美日韩午夜在线视频| 国产日韩精品一区二区浪潮av| 一区二区三区欧美激情| 国内成人免费视频| 色婷婷国产精品综合在线观看| 欧美电影免费观看高清完整版| 综合久久一区二区三区| 久久精品国产精品亚洲综合| 91网页版在线| 精品福利视频一区二区三区| 亚洲成人高清在线| 成人一区二区三区在线观看| 欧美一区二区免费视频| 一区二区三区欧美日韩| 成人网在线播放| 久久中文字幕电影| 污片在线观看一区二区| 色天天综合色天天久久| 国产校园另类小说区| 日韩av网站在线观看| 91社区在线播放| 久久嫩草精品久久久精品一| 性做久久久久久免费观看 | 日韩一二三区视频| 一区二区欧美精品| 成年人网站91| 国产精品网站在线播放| 久草热8精品视频在线观看| 欧美日韩成人在线一区| 亚洲午夜精品在线| 91麻豆成人久久精品二区三区| 国产无一区二区| 国产寡妇亲子伦一区二区| 欧美成人综合网站| 日韩高清在线不卡| 在线91免费看| 天天做天天摸天天爽国产一区| 在线影院国内精品| 综合久久一区二区三区| av一区二区不卡| 亚洲欧洲av在线| 99久久精品99国产精品| 国产精品久久久久久妇女6080| 国产成人午夜片在线观看高清观看| 日韩精品一区二区三区在线播放| 麻豆视频观看网址久久| 精品乱人伦小说| 国产在线一区二区| 久久九九久久九九| 国产成人在线看| 国产女人18毛片水真多成人如厕| 国产一区美女在线| 国产亚洲欧美日韩俺去了| 国产成人综合亚洲91猫咪| 国产精品污www在线观看| 成人av影视在线观看| 亚洲欧洲韩国日本视频| 日本精品裸体写真集在线观看| 亚洲美女少妇撒尿| 欧美艳星brazzers| 日韩高清中文字幕一区| 337p粉嫩大胆噜噜噜噜噜91av | 国产精品美女www爽爽爽| thepron国产精品| 亚洲免费观看高清| 欧美性感一区二区三区| 日韩中文字幕91| 欧美成人三级在线| 国产成人啪午夜精品网站男同| 国产精品久久久久久亚洲毛片| 99国产欧美久久久精品| 亚洲一区二区3| 精品国产免费人成在线观看| 成人精品免费看| 亚洲一区免费在线观看| 欧美一区二区三区四区在线观看| 狠狠色丁香婷综合久久| 国产精品国产馆在线真实露脸| 欧美自拍偷拍午夜视频| 麻豆成人综合网| 亚洲私人黄色宅男| 欧美精品久久天天躁| 国产成人在线免费观看| 亚洲一区二区三区四区在线观看| 日韩欧美国产综合一区| www.欧美.com| 免费人成精品欧美精品| 国产精品美女www爽爽爽| 欧美人妇做爰xxxⅹ性高电影| 久久99精品久久久久久久久久久久 | 亚洲日本乱码在线观看| 欧美精选在线播放| www.欧美.com| 美女视频黄久久| 亚洲精品一卡二卡| 精品国产露脸精彩对白| 日本久久一区二区三区| 国产精品一区免费视频| 天天av天天翘天天综合网色鬼国产| 久久嫩草精品久久久精品一| 欧洲色大大久久| 国产a级毛片一区| 蜜臀99久久精品久久久久久软件| 亚洲视频一二区| 久久久精品一品道一区| 欧美人与z0zoxxxx视频| 色综合色狠狠天天综合色| 韩国v欧美v亚洲v日本v| 婷婷综合五月天| 亚洲乱码国产乱码精品精98午夜| 国产亚洲精品福利| 日韩午夜小视频|