motorcontroldemo_035/Vinclude/V_rmp_ctrl.h
2019-07-29 08:17:46 +03:00

75 lines
2.4 KiB
C

/*!
Copyright 2017 ÀÎ "ÍÈÈÝÒ" è ÎÎÎ "ÍÏÔ ÂÅÊÒÎÐ"
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
\file V_rmp_ctrl.h
\brief Çàäàò÷èê èíòåíñèâíîñòè (ñì. TRMPCtrl)
\author ÎÎÎ "ÍÏÔ Âåêòîð". http://motorcontrol.ru
\version v 2.0 25/03/2016
\defgroup V_rmp_ctrl Çàäàò÷èê èíòåíñèâíîñòè (ñì. TRMPCtrl)
@{
*/
#ifndef V_RMP_CTRL_H
#define V_RMP_CTRL_H
#ifdef __cplusplus
extern "C" {
#endif
/*! \class TRMPCtrl
\brief Çàäàò÷èê èíòåíñèâíîñòè
Êëàññ \a TRMPCtrl, îñíîâàííûé íà ñòðóêòóðå SRMPCtrl, ïðåäñòàâëÿåò
ñîáîé çàäàò÷èê èíòåíñèâíîñòè - ìîäóëü, ëèíåéíî ñ çàäàííûì òåìïîì
èçìåíÿþùèé ñâîé âûõîä, ïîêà îí íå ñðàâíÿåòñÿ ñî âõîäîì. ×àùå âñåãî ñëóæèò
äëÿ ïëàâíîãî ðàçãîíà äâèãàòåëÿ ïðè èçìåíåíèè çàäàíèÿ ñêà÷êîì.*/
//! ñì. TRMPCtrl
struct SRMPCtrl{ long input;//!< Âõîä
long output;//!< Âûõîä
long Ts;//!< ×àñòîòà äèñêðåòèçàöèè
unsigned long T;//!< Òåìï ðàçãîíà (âðåìÿ â ñåêóíäàõ äî èçìåíåíèÿ âûõîäà îò íóëÿ äî åäèíèöû)
long step;//!<Ñëóæåáíàÿ ïåðåìåííàÿ
void (*calc)(struct SRMPCtrl*); //!< Ôóíêöèÿ ðàñ÷åòà, äîëæíà âûçûâàòüñÿ ñ çàäàííîé â Ts äèñêðåòíîñòüþ
void (*slow_calc)(struct SRMPCtrl*); //!< Ôóíêöèÿ ïåðåñ÷åòà êîýôôèöèåíòîâ
};
typedef struct SRMPCtrl TRMPCtrl;
//!Èíèöèàëèçàòîð ïî-óìîë÷àíèþ
#define V_RMP_CTRL_DEFAULTS {0, \
0, \
_IQ(0.0001), \
_IQ(20), \
0,\
V_RMP_CTRL_calc,\
V_RMP_CTRL_slow_calc,\
}
//! \memberof TRMPCtrl
void V_RMP_CTRL_calc(TRMPCtrl*);
//! \memberof TRMPCtrl
void V_RMP_CTRL_slow_calc(TRMPCtrl*);
#ifdef __cplusplus
}
#endif
#endif
/*@}*/