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

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

?? pid.c

?? Source code for an Numeric Cmputer
?? 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.21 $* $Author: jmkasunich $* $Date: 2005/11/25 19:38:57 $********************************************************************//** 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    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    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    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 +/- paxerrorD    commandD = (command - previouscommand) / period    limit commandD to +/- maxcmdD    output = bias + error * Pgain + errorI * Igain +             errorD * Dgain + command * FF0 + commandD + FF1    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.1 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 */#ifdef MODULE/* module information */MODULE_AUTHOR("John Kasunich");MODULE_DESCRIPTION("PID Loop Component for EMC HAL");#ifdef MODULE_LICENSEMODULE_LICENSE("GPL");#endif /* MODULE_LICENSE */static int num_chan = 3;	/* number of channels - default = 3 */MODULE_PARM(num_chan, "i");MODULE_PARM_DESC(num_chan, "number of channels");static int debug = 0;		/* flag to export optional params */MODULE_PARM(debug, "i");MODULE_PARM_DESC(debug, "enables optional params");static long fp_period = 0;	/* float pt thread period, default = none */MODULE_PARM(fp_period, "l");MODULE_PARM_DESC(fp_period, "floating point thread period (nsecs)");#endif /* MODULE *//************************************************************************                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 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 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 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);    if (fp_period > 0) {	/* create a floating point thread */	retval = hal_create_thread("pid.threadFP", fp_period, 1);	if (retval < 0) {	    rtapi_print_msg(RTAPI_MSG_ERR,		"PID: ERROR: could not create FP thread\n");	    hal_exit(comp_id);	    return -1;	} else {	    rtapi_print_msg(RTAPI_MSG_INFO, "PID: created %d uS FP thread\n",		fp_period / 1000);	}    }    return 0;}void rtapi_app_exit(void){    hal_exit(comp_id);}/************************************************************************                   REALTIME PID LOOP CALCULATIONS                     *************************************************************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产久卡久卡久卡久卡视频精品| 日本少妇一区二区| 亚瑟在线精品视频| 国产成人免费视频一区| 欧美日韩一区二区三区免费看 | 色综合久久99| 欧美精品在线观看一区二区| 欧美成人vr18sexvr| 亚洲免费色视频| 麻豆精品视频在线观看视频| 色婷婷综合久久久久中文一区二区 | 久久久久高清精品| 亚洲综合激情网| 成人黄色国产精品网站大全在线免费观看| 欧美视频中文字幕| 国产日本欧洲亚洲| 久久99九九99精品| 日本高清视频一区二区| 国产视频不卡一区| 久久99精品久久只有精品| 色婷婷精品久久二区二区蜜臀av| 日韩欧美一级精品久久| 一区二区三区成人| 成人免费毛片嘿嘿连载视频| 日韩精品专区在线影院重磅| 亚洲超碰精品一区二区| 欧美亚日韩国产aⅴ精品中极品| 国产精品第一页第二页第三页| 激情图片小说一区| 欧美videos中文字幕| 日韩专区一卡二卡| 欧美久久久久免费| 亚洲麻豆国产自偷在线| 91丨porny丨蝌蚪视频| 中文字幕中文字幕一区| 成人av在线观| 亚洲欧美影音先锋| 97久久人人超碰| 日韩美女视频一区二区| av在线播放不卡| 国产精品久久福利| 99久久免费视频.com| 国产精品网站在线观看| 国产福利精品一区| 国产欧美日韩在线看| 成人av午夜影院| 中文字幕欧美三区| 91浏览器在线视频| 亚洲福中文字幕伊人影院| 欧美日韩电影在线播放| 日本一不卡视频| 制服丝袜亚洲色图| 麻豆免费看一区二区三区| 久久久影院官网| 99久久精品国产一区二区三区| 中文字幕日韩av资源站| 欧美性一区二区| 久久国产精品99久久久久久老狼| 欧美一卡2卡3卡4卡| 日韩av中文字幕一区二区三区| 69堂精品视频| 国产成人三级在线观看| 亚洲黄色小视频| 欧美肥妇bbw| 国产河南妇女毛片精品久久久| 国产丝袜在线精品| 欧美人xxxx| 国产一区中文字幕| 亚洲免费观看高清| 91精品欧美一区二区三区综合在| 日本亚洲一区二区| 精品国产乱码久久久久久浪潮| 国产成人自拍在线| 性欧美疯狂xxxxbbbb| 精品剧情在线观看| 欧美探花视频资源| 久久精品国产成人一区二区三区 | 欧美性受xxxx黑人xyx| 麻豆国产精品一区二区三区 | 久久久精品人体av艺术| 日本韩国一区二区三区视频| 日韩精品亚洲一区二区三区免费| 国产视频亚洲色图| 欧美一区二区黄| 91国偷自产一区二区使用方法| 免费成人在线网站| 亚洲国产精品精华液网站| 综合电影一区二区三区| 26uuu欧美| 6080国产精品一区二区| 色欧美片视频在线观看在线视频| 琪琪久久久久日韩精品| 欧美极品少妇xxxxⅹ高跟鞋 | 国产999精品久久久久久| 亚洲不卡av一区二区三区| 久久久91精品国产一区二区三区| 欧洲一区在线电影| 韩国精品在线观看| 天天亚洲美女在线视频| 国产精品萝li| 久久精品夜色噜噜亚洲aⅴ| 欧美一区二区精品在线| 国产98色在线|日韩| 国产一区二区不卡老阿姨| 丝袜美腿成人在线| 亚洲一区二区成人在线观看| 国产精品久久久久久妇女6080 | 国产精选一区二区三区| 欧美aⅴ一区二区三区视频| 一区二区国产视频| 亚洲人精品午夜| 亚洲欧洲精品成人久久奇米网| 一本色道久久综合亚洲91| 93久久精品日日躁夜夜躁欧美| 高清国产一区二区三区| 国产精品一区免费在线观看| 欧美aaaaaa午夜精品| 蜜桃av噜噜一区| 日韩电影在线观看网站| 亚洲午夜精品网| 三级影片在线观看欧美日韩一区二区| 亚洲欧美日韩电影| 一区二区免费在线| 亚洲美腿欧美偷拍| 一区二区视频在线看| 亚洲最大成人网4388xx| 亚洲风情在线资源站| 日本视频在线一区| 婷婷综合另类小说色区| 午夜精品123| 日韩高清一区二区| 久久丁香综合五月国产三级网站| 亚洲综合激情网| 男男gaygay亚洲| 极品少妇xxxx精品少妇偷拍| 国产在线播精品第三| 成人一二三区视频| 在线免费不卡视频| 337p亚洲精品色噜噜狠狠| wwwwxxxxx欧美| 中文字幕一区二区三区乱码在线| 中文字幕亚洲成人| 午夜私人影院久久久久| 亚洲最新在线观看| 天天综合色天天综合色h| 国产一区二区在线电影| 成人免费高清在线| 欧美午夜在线观看| 欧美日韩在线三级| 久久久久久久久久久久久久久99 | 91福利视频网站| 日韩欧美久久久| 国产亚洲精品aa| 一区二区三区日韩欧美| 日本aⅴ精品一区二区三区| 国产iv一区二区三区| 欧美日韩大陆一区二区| 精品久久久久香蕉网| 亚洲另类在线视频| 国产在线精品一区二区三区不卡 | 懂色av一区二区三区蜜臀| 日本福利一区二区| 日韩免费高清电影| 亚洲男人都懂的| 精品一区二区三区久久久| 欧美日韩中文字幕一区| 国产三级欧美三级| 亚洲自拍偷拍图区| 国产aⅴ综合色| 欧美乱熟臀69xxxxxx| 亚洲国产精品成人综合色在线婷婷| 亚洲最大的成人av| 国产成人在线影院| 欧美一卡2卡三卡4卡5免费| 亚洲色图欧美在线| 国产精品自在欧美一区| 欧美在线你懂的| 中文字幕乱码日本亚洲一区二区| 亚洲成a天堂v人片| 99精品久久只有精品| 6080国产精品一区二区| 亚洲精品你懂的| 国产成人av自拍| 日韩欧美国产午夜精品| 尤物在线观看一区| 成人av资源网站| 2020国产精品| 日韩av中文字幕一区二区三区| 91免费国产在线观看| 国产精品色在线| 国产精品一二三| 精品久久久久久久久久久院品网| 亚洲成人资源网| 在线一区二区三区四区五区| 国产精品理论在线观看| 国产成人精品一区二区三区四区| 欧美va天堂va视频va在线| 天天色图综合网| 欧美日韩亚洲不卡| 亚洲不卡在线观看|