跳到主要內容

發表文章

[Linux] 利用sublime 3 文字編輯器,在Ubuntu 下的進行Node.JS的撰寫第一支HelloWorld程式

最近的文章

[Linux] 如何在Ubuntu 下安裝 sublime 2/3 文字編輯器

在本文中,介紹如何安裝 sublime 2/3 文字編輯器。 在Ubuntu commend 的介面中,我們可利用文字編輯器進行程式的撰寫,常見的純文字工具如下有vi、vim、nano,都是使用者的需求去做使用。當然也有圖形化介面的文字編輯器,如sublime、nodpad、geany等等 也可參考作者另外兩篇文章,如何利用不同的文字編輯器撰寫Node.JS的程式 利用sublime 3 文字編輯器,在Ubuntu 下的進行Node.JS的撰寫第一支HelloWorld程式 http://techmanalex.blogspot.tw/2015/08/linux-sublime-3-ubuntu-nodejshelloworld.html 利用nano 文字編輯器,在Ubuntu 下的進行Node.JS的撰寫第一支HelloWorld程式 http://techmanalex.blogspot.tw/2015/08/linux-nano-ubuntu-nodejshelloworld.html 純文字編輯器 vi vim nano  圖形化文字編輯器 sublime nodpad geany 首先安裝sublime  text 2 / 3,兩者並無法相容,也就是說只能安裝其中一種版本,此處推薦使用 sublime  text 3 安裝方法有兩種: 利用網路提供的ppa來進行安裝 - commend line推薦用此法 下載sublime  text 2 / 3官方網站的deb檔來進行安裝 - 圖形化介面推薦用此法   首先介紹第一種利用網路提供的ppa來進行安裝: 1.安裝 Sublime Text 2: sudo add-apt-repository ppa:webupd8team/sublime-text-2 sudo apt-get update sudo apt-get install sublime-text   2.安裝 Sublime Text 3: sudo add-apt-repository ppa:webupd8team/sublime-text-3 sudo apt-get update sudo apt-get install sublime-t

[Linux] 利用nano 文字編輯器,在Ubuntu 下的進行Node.JS的撰寫第一支HelloWorld程式

在本文中,介紹如何利用nano來進行nodeJS程式的撰寫 在Ubuntu commend 的介面中,我們可利用文字編輯器進行程式的撰寫,常見的純文字工具如下有vi、vim、nano,都是使用者的需求去做使用。當然也有圖形化介面的文字編輯器,如sublime、nodpad、geany等等 也可以參考作者另外一篇文章 如何在Ubuntu 下安裝 sublime 2/3 文字編輯器 http://techmanalex.blogspot.tw/2015/08/linux-ubuntu-sublime-23.html 利用sublime 3 文字編輯器,在Ubuntu 下的進行Node.JS的撰寫第一支HelloWorld程式 http://techmanalex.blogspot.tw/2015/08/linux-sublime-3-ubuntu-nodejshelloworld.html 純文字編輯器 vi vim nano  圖形化文字編輯器 sublime nodpad geany 首先安裝nano,通常 Ubuntu 都已經內建nano文字編輯器 sudo apt-get install nano 下列共有4個步驟 1.接著利用nano建立文件,直接輸入會在當下目錄產生文件 nano hello.js 2.在nano輸入下列程式碼,執行時利用下面目錄中的node去做執行,同時程式輸出Hello World!。 #!/usr/bin/env node console.log("Hello World!"); nano儲存檔案需要鍵入 ^O,確認文件儲存的名稱是hello.js後,按enter完成,並鍵入 ^X離開 儲存檔案 :  ^O = Ctrl + O  離開 : ^X = Ctrl + X 3.鍵入dir,可以看到當下目錄的所有文件名稱,可以看到nano產生的hello.js 4.利用Node執行hello.js,就可以看到輸出Hello World! node hello.js  

[Linux] Ubuntu 安裝Node.JS開發環境

基本操作 - Basic instruction 先利用apt-get去安裝git的程式,以便獲得後續更多的bin檔案進行安裝 apt-get: Binary package management $ which git $ sudo apt-get install -y git-core $ which git /usr/bin/git 伺服器用的JavaScript - Basic Server-Side JS (SSJS) 安裝用在server端的JavaScript,也就是本文使用的Node.JS $ sudo apt-get update # Install a special package $ sudo apt-get install -y python-software-properties python g++ make # Add a new repository for apt-get to search $ sudo add-apt-repository ppa:chris-lea/node.js # Update apt-get’s knowledge of which packages are where $ sudo apt-get update # Now install nodejs and npm # sudo apt-get install -y nodejs 1.sudo apt-get install -y python-software-properties python g++ make 先安裝python以及g++ 2.sudo add-apt-repository ppa:chris-lea/node.js 利用網路上所開放的資料庫伺服器(repository),更新apt中Node.JS的安裝包 3.sudo apt-get update 更新ubuntu中的安裝檔案列表  4.sudo apt-get install -y nodejs 安裝Node.JS 確認版本 - Check Node.JS Version npm為node.js用來管理模組(module)的管理員,是官方在維護的library Node的版本 $ np

[PID Controller] 如何利用Ziegler and Nichols (ZN method)調整PID參數

PID 控制器在控制領域是極為常用的控制器設計方法,主要原因在於結構簡單、操作方便、控制性能佳等優點,迄今仍被廣泛地使用於自動化、機器人與工業控制等領域。 PID 控制器是由P(Proportional)比例控制、I(Integral)積分控制、D(Derivative)微分控制所組合而成,其控制架構如下圖所示, Yset 和y為期望輸出值與實際系統輸出,系統的誤差經過比例項、積分項、微分項三部份的計算,可以給予相對應的輸出,使系統的誤差消除或在容許的誤差範圍內,同時系統輸出達到所期望表現。  (PID控制器方塊圖) (並聯型PID控制器) PID控制器方塊圖 由於PID 控制器的參數之間存在交互影響的現象,因此PID 控制器參數的設計與調整一直為PID控制器設計的議題。(Ziegler and Nichols,1942)兩位工程師發表了一套PID參數設計的調整方法,該設計方法為經由了許多次試驗與實驗而歸納出來的經驗公式。 Z–N參數調整法可以分為: 閉迴路調整法(Closed-loop tuning method) 開迴路調整法(Open-loop tuning method) 1.閉迴路調整法        閉迴路調整法是在閉迴路系統中給予Yset步階訊號輸入,再調整比例控制器的比例增益(Gain),直到系統輸出訊號產生臨界振盪,如下圖所示之系統響應。 將臨界振盪之週期 Tu及臨界增益Ku代入下表的Z–N 閉迴路調整法公式,可得到控制器的增益K、積分Ti 時間和微分時間Td 後,再代入上式的並聯型PID控制器得到PID參數。 臨界增益Ku為對系統不斷增加比例控制器的比例增益,直到出現臨界振盪Tu後,當下的比例增益 (閉迴路調整法之系統響應) (閉迴路調整法之參數表) 2.開迴路調整法          開迴路調整法之系統響應又稱反應程序法(Process Reaction Method),是在開迴路系統中給予Yset步階訊號輸入,並利用系統響應曲線計算對應參數值。 如下圖所示的系統響應輸入與輸出訊號,由系統響應曲線作反曲點之切線,可求得對應之系統落後時間T_delay 以及系統實際響應時間T_0,再將系統輸入量值u_m 與系統響應量值y_m 帶入下式求得臨界增益K_u , 再將

[Matlab] Tutorial : Matlab Real-time windows target with Advantech PCI-1716 card

This is tutorial about how to use matalb real-time windows target with Advantech PCI-1716 card. I use simulink AI block to read data from Advantech PCI-1716, and AI channel read a sine wave signal from a signal generator.      1.Install Advantech PCI board: real-time windows target -> analog input -> click block -> install new board -> Advantech PCI-1716 2.PCI-1602 read a sine wave from signal generator : Click AI block -> install new board or choose already board -> set channel and range -> run -> read a sine wave from scope

[Matlab] Simulink Real-time (xpc) & Real-time windows target introduction

Matlab provides two real-time library, and this table show feature, support hardware, and description. More detail can look another tutorial : Tutorial : Matlab Real-time windows target with Advantech PCI-1716 card . Simulink real-time (XPC target) Real-time windows target Feature Real-time performance approaching 1 kHz in normal execution mode  Real-time performance approaching 20 kHz in external execution mode (with Simulink Coder) Real-Time Windows Target includes a real-time engine that runs in Windows kernel mode In normal mode, Real-Time Windows Target synchronizes data between the real-time engine and Simulink. Real-time performance approaching 500 Hz in normal mode. Support hardware http://www.mathworks.com/products/simulink-real-time/supported/hardware-drivers.html . http://www.mathworks.com/hardware-support/real-time-windows-target.html