collect_data.py 987 Bytes
Newer Older
Chetan Sharma's avatar
Chetan Sharma committed
1
"""
Chetan Sharma's avatar
Chetan Sharma committed
2
A tiny utility script that just collects sweep data.
Chetan Sharma's avatar
Chetan Sharma committed
3
4
5
6
7
8
9
10
11
12
"""
import numpy as np
import time

from objects import EndMill, Conditions, MachineChar
from cut import Cut
from ml import LinearModel
from optimize import Optimizer

import logging
Chetan Sharma's avatar
Chetan Sharma committed
13

Chetan Sharma's avatar
Chetan Sharma committed
14
15
logging.basicConfig(level="INFO")

Chetan Sharma's avatar
Chetan Sharma committed
16
17
18
19
20
MACHINE_PORT = "/dev/ttyS25"
SPINDLE_PORT = "/dev/ttyS33"
TFD_PORT = "/dev/ttyS36"

endmill = EndMill(3, 3.175e-3, 3.175e-3, 12e-3, 5e-3)
Chetan Sharma's avatar
Chetan Sharma committed
21
22

fixed_conditions = Conditions(
Chetan Sharma's avatar
Chetan Sharma committed
23
24
25
26
27
28
29
30
31
32
33
34
35
    D=1e-3, W=1e-3, f_r=0.001, w=300, endmill=endmill)

cut = Cut(
    MACHINE_PORT,
    SPINDLE_PORT,
    TFD_PORT,
    endmill,
    60e-3,
    50.8e-3,
    5e-3,
    300,
    initial_z=0.5e-3,
    save_as="sweep-alu-1_4-v2",
Chetan Sharma's avatar
Chetan Sharma committed
36
37
)

Chetan Sharma's avatar
Chetan Sharma committed
38
39
f_r_range = np.linspace(2e-3, 0.01, 6)
W_range = np.linspace(1e-3, 3.175e-3 * 1.8, 6)
Chetan Sharma's avatar
Chetan Sharma committed
40

Chetan Sharma's avatar
Chetan Sharma committed
41
cut.face_layer(D=0.3e-3)
Chetan Sharma's avatar
Chetan Sharma committed
42

Chetan Sharma's avatar
Chetan Sharma committed
43
cut.begin_layer(D=1e-3)
Chetan Sharma's avatar
Chetan Sharma committed
44

Chetan Sharma's avatar
Chetan Sharma committed
45
for f_r in f_r_range:
Chetan Sharma's avatar
Chetan Sharma committed
46
    for W in W_range:
Chetan Sharma's avatar
Chetan Sharma committed
47
48
49
50
        conditions = Conditions(1e-3, W, f_r, 200, endmill)
        cut.cut(conditions, save=True, auto_layer=True)

cut.close()