2017年12月22日 星期五

Laser Tracker (ver. English)

Introduction
Laser Tracker is a kind of PCMM (Portable Coordinate Measuring Machine), for large size object measurement survey.

The applicable object could be like:
Airplane
or :
Submarine

or:
Windmill blades


So it is not hard to image how far this instrument can measure. Generally speaking, the maximum measuring distance of laser tracker is 50-80m.

The accuracy level of laser tracker is about 0.025mm at 5 meter long, 0.075-0.090mm at 80m. Take daily life object to make comparison, 0.075-0.090mm is about the diameter of a hair.

The appearance of this kind of  instrument is as following shown:

Faro Laser Tracker
Leica Laser Tracker
API Laser Tracker
The principle of this instrument is to put one retroreflector on the object to be measured.
Tracker will emit laser beam to the retroreflector, then the retorreflector will reflect the laser beam of laser tracker, tracker will calculate the distance by time deviation between sent and received beam(ADM mode: Absolute Distance Meter) and/or by wave path difference/interference between sent and received beam (IFM mode: InterFerence Meter ).
Then cooperate with azimuth and elevation encoder of tracker, the spherical coordinate of retroreflector will be defined. the spherical coordinate will be transferred to Cartesian coordinate system.
That is the principle of laser tracker.

Connect Mitsubishi Q series PLC with Ethernet by using C#

PLC setting

1. Open GX work 2 to set the protocol type and port of PLC.
2. Write the setting to PLC

PC setting

1.Open VS IDE
2.Select C#
3.refer Socket library
using System.Net.Sockets;
4.there are two types of protocol of PLC, TCP and UDP. Here we introduce both

5. TCP connection

5.1 Create TCP object
Socket mysocket = new Socket(SocketType.Stream, ProtocolType.Tcp);

5.2 Create IP object
byte[] address = { 192, 168, 3, 39 }
IPAddress addr = new IPAddress(address);

5.3 Connect to PLC
the first parameter is IPAddress object, the rear one is port number of PLC, it can be set in GX work2.
mysocket.Connect(addr, 1001);

5.4 Checking
create a bool object to check the connection is successful or not.
bool result = mysocket.Connected;

6. UDP connection

6.1 Create UDP object
Socket mysocket = new Socket(SocketType.Dgram, ProtocolType.Udp);

6.2 Create IP object
See section 5.2

6.3 Connect to PLC
the first parameter is IPAddress object, the rear one is port number of PLC, it can be set in GX work2.
mysocket.Connect(addr, 1025);

6.4 Checking
create a bool object to check the connection is successful or not.
bool result = mysocket.Connected;



2017年3月26日 星期日

雷射追蹤儀簡介( Laser Tracker)

雷射追蹤儀通常會用來量測一般CMM量測不了的大型物件,像是列車車廂、船體、離岸風電...等等。重工業越發達的國家越容易使用到該儀器,因此該儀器在台灣並不常見。
其精度表現視廠牌不同而定,一般來說,在5公尺左右約為25um,在80公尺處約為80um,除了上述應用外,雷射追蹤儀也可用於校驗機械手臂的定位精度。
雷射追蹤儀量測的原理是利用一個反射鏡和雷射頭,當雷射頭射出雷射光,經過反射鏡平行反射雷射光,再返回雷射頭,追蹤儀便從射出和接收的時間差計算距離(ADM模式),或是用雷射光波的干涉計算距離(IFM模式)。
由於量測的物體皆為大型工件,因此溫度的變化對尺寸會有顯著影響,因此量測出來的數據會有所縮放(scaling),或是將量測的數據做最佳轉換(best-fit transformation),以便和標準溫度時的尺寸做對照,至於縮放和最佳轉換的工差,會根據不同產業的規範有所不同,這方面就不多贅述。
簡介大致是這樣。

2017年2月4日 星期六

web scraping by selenium pyhon3

For new starter as me.
Assume everyone knows how to install selenium and how to write code with python 3 and the principle of HTML. Selenium is an automated browser package, and also a chemical element(introduced below)

Selenium is a chemical element with symbol Se and atomic number 34. It is a nonmetal with properties that are intermediate between the elements above and below in the periodic tablesulfur and tellurium. It rarely occurs in its elemental state or as pure ore compounds in the Earth's crust. Selenium (Greek σελήνη selene meaning "Moon") was discovered in 1817 by Jöns Jacob Berzelius, who noted the similarity of the new element to the previously discovered tellurium (named for the Earth).(refer from wiki)

And there is a website to introduce how to write selenium with python:
http://selenium-python.readthedocs.io/


1.Before start programming, those pre-setting procedures shall be down.
1.1.install selenium:
it can be done by pip or easy_install

1.2.download web driver
it depends on what browsers you use, in my case, I use chrome, so google chrome driver is what I need.
1.2.1 download web driver
you can select the corresponding type(for windows,mac or linux...etc) driver from this site:
https://sites.google.com/a/chromium.org/chromedriver/downloads

1.2.2 unzip the downloaded file to the selected folder, which you can freely set. 


2.The web scraping procedures are descript below:
2.0 import lib
..webdriver is web driver
..support.ui import Select is for drop down selection or other  item selectons
..Keys is for mouse/ keyboard action, like click ,right click ,string input...etc.

2.1 Set webdriver
it is needed to inform selenium where is the web driver. Path is needed.
Then input the right type browser command.

2.2.Get URL
the driver will connect to the website

2.3 Change text 
To key in the date I want:


First find the element of date item, so I check the source of the website:

The name of element is "datestart" , so let driver find element by its name,
And then clear the value of the element and refill with the value I want.
Then click the element.
Before

After

 2.4 Select the item of Contract:

Select the selection attribute item from website
and print all the options in selection
Then select the first item of all options. 
   
the items in selection
 Before
After, the Contract item is changed


2017年2月1日 星期三

how to call pip on windows

For new starter as me.
pip is PyPA recommended tool for installing Python packages. so if you want install some packages, you can use this.
1. initialize command line:



2. key in "cd" command and key in the needed directory/file location. In my case , I need to initialize pip, so I redirect to pip folder.
3. key in or paste the folder location
4. press Enter, then the system will redirect to the folder
5. you can call any file in this folder, in my case, I just call "pip"
6. press Enter, then the pip will run. the result as figure shown below.

7. Because I need to install beautifulsuop4 to do some web crawling application, so I key in "pip install beautifulsoup4"

8. press Enter, then the install process will run as figure shown below:
9. According to the figure , the process is successful.

Appendix:
Beautiful soup website:
https://www.crummy.com/software/BeautifulSoup/bs4/doc/










同軸度 Coaxiality

同軸度和同心度是兩個非常容易搞混的幾何公差. 同軸度的符號如下: 跟正位度的符號是一樣的! 有這種設定,主要是它的定義和正位度的使用方法很像,反而跟同心度沒這麼相似. 首先來個範例: 由於這個不是繪圖軟體做的,只是示意用,不合工程圖規範的部分還請包涵. 這個是...