RT Control Systems Implementation The controller algorithm is executed once in every sampling period h. The sampling period is a compromise between Nyquist-Shannon Law fs>2B),the computation time delay rwith it's possible jitter and the limits of the hardware. -一般,周期抖动水1% When in a system we have 0<z<h we're facing a delay,as for when zzh we have a loss
RT Control Systems Implementation • The controller algorithm is executed once in every sampling period h. – The sampling period is a compromise between Nyquist-Shannon Law ( fs>2B), the computation time delay τ with it’s possible jitter and the limits of the hardware. – 一般,周期抖动<1% • When in a system we have 0<τ<h we’re facing a delay, as for when τ≥h we have a loss
单任务与多任务 monolithic approach implementation with a single periodic task. simple,but tends to lead to a larger feedback-delay. In order to diminish this delay a predictive controller ( may be implemented. multiple task approach - dividing the process in more than one real-time task. The main task calculates the new control signal. - Followed by Task 2 where the new state variable are calculated. set timer to interrupt periodically with period T; 名 at each timer interrupt do 2 y(KT)=G(x(kT)) do analog-to-digital conversion to get y; x((k+1)T)=F(z(kT).u(KT)) compute control output u; m output u and do digital-to-analog conversion; od
单任务与多任务 • monolithic approach – implementation with a single periodic task. – simple,but tends to lead to a larger feedback-delay. • In order to diminish this delay a predictive controller(?) may be implemented. • multiple task approach – dividing the process in more than one real-time task. – The main task calculates the new control signal. – Followed by Task 2 where the new state variable are calculated
Single task or Two USTC Task 1(with maximum priority) Deadline NScheduler Task 2 Sampling time T Set Event Variable() Scheduler Set Event Variable(1) Task I Deadline Task I (wait function) (wait function) set highest priority; 3s2 y=read ADC(Ch#1); r=signal_generator(Parameters); ys=signal conditioning scaling(y): Task 2 r=signal generator(Parameters); u=Kr*r-Kx*x; e=[(w-ys)e(2:length(e)]; write DAC(Ch#x,u); Set Event Variable(2) u=u+q'*e; eset_Event_Variable(2); (wait function) write DAC(Ch#1,u); Shared Memory y=read_ADC(Ch#x); u,r,x,y,Ab,Bb,Kr,Kx ys=signal_conditioning scaling(y); ete. x=Ab *x+Bb*[u'y']'; 山1 h u2 y(kT)G(x(kT)) 业 优先级、通信、同步? x((k+1)T)F(z(kT),u(kT)) m n
Single task or Two 优先级、通信、同步?
Event-action model (paradigm) ·发生与预定状态相关的事件,则执行预定动作 -FSM based:“状态”由状态变量的特定值标识 ReaF-Time Analysis: 事件:在特定时刻瞬间发生,标志系统的行为 - 外部事件:外部动作产生的事件 一内部事件:系统内产生或激活的事件 一开始事件和终止事件:标识动作开始和结束的事件 primitive events,composite events event -Mode:事件的集合 Real-Time 。 动作:系统对事件的反应。 System action 一简单动作:原子操作 一复杂动作:一个动作序列 anEvent [guardCondition/anAction A B ·三种:顺序、选择、并行 一可按所需使用的资源划分动作 ·条件(condition):定义允许的动作 一条件通过允许或禁止某些操作来影响系统的行为。 一动作执行或发生外部事件可以引起条件变化,条件变化又可引起事件发生
Event-action model(paradigm) • 发生与预定状态相关的事件,则执行预定动作 – FSM based: “状态”由状态变量的特定值标识 • 事件:在特定时刻瞬间发生,标志系统的行为 – 外部事件:外部动作产生的事件 – 内部事件:系统内产生或激活的事件 – 开始事件和终止事件:标识动作开始和结束的事件 – primitive events,composite events – Mode:事件的集合 • 动作:系统对事件的反应。 – 简单动作:原子操作 – 复杂动作:一个动作序列 • 三种:顺序、选择、并行 – 可按所需使用的资源划分动作 • 条件(condition):定义允许的动作 – 条件通过允许或禁止某些操作来影响系统的行为。 – 动作执行或发生外部事件可以引起条件变化,条件变化又可引起事件发生
外部事件的到达模式 周期性事件 ·非周期性事件的时间特性: 不规则的 事件之间存在某个已知的,但长短可变的时间间隔 序列 突发的 事件的出现序列中,任意两次之间的间隔可能相当 近,但是突发情况下事件的数目也不会超过某个己 知范围。 有界的 已知最小两次到达间隔(称为界限)的事件序列。 平均速度 事件队列中单个事件的到达事件是不可预测的,但 有界的 是它们在某个平均值上下波动。 无界的 到达间隔可以用统计原理进行预测的事件序列。它 们是一个从某个概率密度函数中提取出来的可重复 或者不可重复过程
外部事件的到达模式 • 周期性事件 • 非周期性事件的时间特性: 不规则的 事件之间存在某个已知的,但长短可变的时间间隔 序列; 突发的 事件的出现序列中,任意两次之间的间隔可能相当 15 近,但是突发情况下事件的数目也不会超过某个已 知范围。 有界的 已知最小两次到达间隔(称为界限)的事件序列。 平均速度 有界的 事件队列中单个事件的到达事件是不可预测的,但 是它们在某个平均值上下波动。 无界的 到达间隔可以用统计原理进行预测的事件序列。它 们是一个从某个概率密度函数中提取出来的可重复 或者不可重复过程