Presentation is loading. Please wait.

Presentation is loading. Please wait.

陳慶瀚 機器智慧與自動化技術(MIAT)實驗室 國立中央大學資工系 2013年5月28日

Similar presentations


Presentation on theme: "陳慶瀚 機器智慧與自動化技術(MIAT)實驗室 國立中央大學資工系 2013年5月28日"— Presentation transcript:

1 陳慶瀚 機器智慧與自動化技術(MIAT)實驗室 國立中央大學資工系 2013年5月28日
A1-Discrete-Event System Modeling Grafcet離散事件系統建模 陳慶瀚 機器智慧與自動化技術(MIAT)實驗室 國立中央大學資工系 2013年5月28日

2 Discrete Event System(DES)
包含大量的輸入輸出變數和複雜的hybrid sequential和concurrent events的邏輯系統 一個良好的離散事件建模必須滿足: (1)能描述出離散事件系統的大量且連續的狀態。 (2)必須考慮同時發生情況,且能以簡單明瞭的方式表達。 (3)通常一個系統的狀態只會受到幾個輸入的影響,且只有一些輸出被改變,因此只描述因輸入的改變而產生的行為。 (4)可以清楚的瞭解輸入與輸出的行為

3 Grafcet Grafcet是由Petri nets 發展而來,用來描述連續行為與同時發生情況的一種圖形化模型。GRAFCET表示法,其最初規格是結合學界和工業界的法國團體所定義出來的,並在1987年成為國際標準。在80年代,GRAFCET多使用在事務性機器(OA產品)與製造系統,如自動化元件之控制器,將離散事件控制器設計在可程式控制器(PLC)上;在90年代後期,開始運用在資訊系統設計。GRAFCET可使用在工業製造系統的順序控制規格描述,能夠很簡潔明瞭的表示多輸入與多輸出的同步動作,簡化離散控制邏輯使其易於處理。

4 Grafcet的基本構件 步驟(Step) 轉移條件(Transition) 有向性的連結(Directed Connection)

5 Grafcet的基本構件

6 Firing rule for Grafcet

7 Concurrent/Branching Structure in Grafcet

8 Hierarchical Structure Sub-GRAFCET

9 State Transition

10 Concurrent States Transition

11 Branching States Transition

12 Branching States Transition

13 Algorithmic Level Discrete-Event Modeling
善用平行架構,加速硬體電路運算效能。 所有狀態的轉移必須清楚明確,不可產生永遠不會動作及永遠滯留的狀態。 避免對變數同時做判斷及運算動作,以減少電路運算結果錯誤。 整個流程結束後,必須回到初始狀態等待下ㄧ次的觸發。

14 Discrete-Event Modeling Example 1
整理系統的動作和條件變數 描述系統的動作流程

15 Discrete-Event Modeling Example 1

16 Discrete-Event Modeling Example 2

17 Discrete-Event Modeling Example 2

18 Example: 3-bit Gray Code Generator

19 GRAFCET of 3-bit Gray Code Generator

20 Exercise : Traffic Light Controller

21 FSM of Traffic Light Controller

22 GRAFCET of Traffic Light Controller

23 Exercise :計數器建模 有一個計數器規格如下: ─計數器初始值由0開始往上數,每次加1 ─計數器到達100後,開始往下數,每次減2
─計數器往下數達到50後,再度往上數,每次加1,如此構成循環 ─任意時刻reset訊號為1,計數器都將被重設為設0 請以GRAFCET建立此一離散事件模型

24 Exercise : Signal Generator
We want to design a circuit that, from a clock signal clk, gives origin to the signal output shown as: To model the discrete-event system of the signal generator using GRAFCET

25 Exercise:步進馬達的控制器建模 一個兩相的步進馬達的控制方式如下, 例如要令馬達順時針轉動,須持續送出1100, 0110,0011,1001, 1010,0101訊號;若要令馬達逆時針轉動,則須送出0101,1010,1001, 0011, 0110, 1100訊號。 時序 馬達輸入訊號 轉動方向 S3 S2 S1 S0 順時 針 逆時針 1 2 3 4 5 6

26 Exercise :步進馬達的控制器建模 控制器規格如下: Input : START(馬達啟動), DIR(馬達轉動方向)
Output : S3,S2,S1,S0(馬達輸入訊號) 請用GRAFCET設計控制器離散事件模型。

27 Hardware Synthesis Using VHDL

28 VHDL synthesis of Grafcet
Fundamental Block

29 VHDL synthesis of Grafcet
Convergence AND

30 VHDL synthesis of Grafcet
Divergence AND

31 VHDL synthesis of Grafcet
Convergence OR

32 VHDL synthesis of Grafcet
Divergence OR

33 Complete Synthesis of Grafcet Model

34 Synthesis of Grafcet Controller

35 VHDL code of Grafcet Controller

36 VHDL synthesis of Grafcet Controller

37 VHDL synthesis of Grafcet Controller
architecture miat of g0 is signal s0,s1,s2,s3,s4 : std_logic; begin process(clk,rst) if rst='0' then s0<='1'; s1<='0'; s2<='0'; s3<='0'; s4<='0'; elsif clk'event and clk='1' then if s0='1' and OK='1' then s0<='0'; s1<='1'; elsif s1='1' and L1='1' then s1<=‘0’; s2<=‘1’; s3<=‘1’; elsif s2='1' and s3='1' and L2='1' then s2<=‘0’; s3<=‘0’; s4<=‘1’; elsif s4='1' then s4<=‘0’; s0<=‘1’; end if; end process; V1<=s1; Start_M<=s2; V2<=s3; Stop_M<=s4; END miat; library ieee; use IEEE.STD_LOGIC_1164.all; entity g0 is port( clk : in std_logic; rst : in std_logic; OK : in std_logic; L1,L2 : in std_logic; V1,V2 : out std_logic; Start_M : out std_logic; Stop_M : out std_logic ); end g0;

38 Synthesized Circuit Block Diagram

39 Simulated Timing Diagram


Download ppt "陳慶瀚 機器智慧與自動化技術(MIAT)實驗室 國立中央大學資工系 2013年5月28日"

Similar presentations


Ads by Google