config_pi_piezo.md 4.68 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
## Configuring a PI piezo controller

This chapter explains how to configure a piezo controller from
Physical Instrument company.

This configuration should be common to the following models:

* PI E-753 - 754
* PI E-517 - 518
* PI E-712

12
13
14
15
### Supported features

Encoder | Shutter | Trajectories
------- | ------- | ------------
16
YES	    | NO      | YES (E-712)
17
18

### YAML configuration file example
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
```yaml
controller:
  class: PI_E753
  tcp:
     url: e754id42:50000
  encoders:
    - name: e754m0_enc
      steps_per_unit: 1
      tolerance: 0.1
  axes:
      - acceleration: 1.0
        backlash: 0
        high_limit: null
        low_limit: null
        name: e754m0
        offset: 0
        encoder: $e754m0_enc
        steps_per_unit: 1
        tolerance: 0.1
        velocity: 11
        tango_server: e754m0
```
41

42
43
!!! note
If `port` is not specified in `url`, e753 uses by default port `50000`.
44

45
!!! warning
46
47
48
49
50
51
52
53
54
55
56
57
    The PI controller only accepts a single tcp connection

If a controller needs to be accessible in multiple sessions simultaneously
the tcp connection needs to be proxied as follows:

```yaml
controller:
  class: PI_E753
  tcp-proxy:
    tcp:
       url: e754id42:50000
```
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179


## Recorder

For 712 753.

Real-time data recorder is able to record several input and output signals
(e.g. current position, sensor input, output voltage) from different data
sources (e.g. controller axes or input and output channels).

POSSIBLE DATA RECORDER TYPE:

* `TARGET_POSITION_OF_AXIS`
* `CURRENT_POSITION_OF_AXIS`
* `POSITION_ERROR_OF_AXIS`
* `CONTROL_VOLTAGE_OF_OUTPUT_CHAN`
* `DDL_OUTPUT_OF_AXIS`
* `OPEN_LOOP_CONTROL_OF_AXIS`
* `CONTROL_OUTPUT_OF_AXIS`
* `VOLTAGE_OF_OUTPUT_CHAN`
* `SENSOR_NORMALIZED_OF_INPUT_CHAN`
* `SENSOR_FILTERED_OF_INPUT_CHAN`
* `SENSOR_ELECLINEAR_OF_INPUT_CHAN`
* `SENSOR_MECHLINEAR_OF_INPUT_CHAN`
* `SLOWED_TARGET_OF_AXIS`

The gathered data is stored (temporarily) in "data recorder tables".

* `set_recorder_data_type(*motor_data_type)`: Configure the data recorder

    `motor_data_type` should be a list of tuple with motor and datatype
     i.e: motor_data_type=[px, px.CURRENT_POSITION_OF_AXIS,
                           py, py.CURRENT_POSITION_OF_AXIS]

Example:
```python

mot.controller.set_recorder_data_type(motor, motor.VOLTAGE_OF_OUTPUT_CHAN)

mot.controller.start_recording(mot.controller.WAVEFORM, recorder_rate)
```

## Wave motion generator

For 753.

A "wave generator" allows to produce "waveforms" ie.user-specified patterns.

This feature is especially important in dynamic applications which require
periodic, synchronous motion of the axes. The waveforms to be output are stored
in "wave tables" in the controllers volatile memory—one waveform per wave
table. Waveforms can be created based on predefined "curve" shapes. This can be
sine, ramp or single scan line curves. Additionally you can freely define curve
shapes.

During the wave generator output, data is recorded in "record tables" on the
controller.

Example:
```python
mot.run_wave(wavetype, offset, amplitude, nb_cycles, wavelen)
```

* `wavetype`: str: `"LIN"` or `"SIN"`
* `offset`: float: motor displacement offset
* `amplitude`: float: motor displacement amplitude
* `nb_cycles`: int: the number of times the motion is repeated
* `wavelen`: float: time in second that should last the motion


## Trajectories

For E712.

## Switch

For E712.


## Examples

ID11 example for stress-rig motor combining wave generator and recorder.

```python
def stress_run_display(wavetype, offset, amplitude, nb_cycles, wavelen, recorder_rate=None):
    if STRESS_RIG_MOTOR is None:
        raise RuntimeError("First call init")

    mot = STRESS_RIG_MOTOR
    # Starts the recorder when the trajectory starts
    mot.controller.start_recording(mot.controller.WAVEFORM, recorder_rate=recorder_rate)

    def refresh_display(data):
        current_index = len(data) if data is not None else 0
        ldata = mot.controller.get_data(from_event_id=current_index)
        if ldata is None or len(ldata) == 0:
            return data
        if data is not None:
            data = numpy.append(data,ldata)
        else:
            data = ldata

        x,y,y2 = (data[name] for name in data.dtype.names)
        #p.plot(data=y,x=x)
        p.plot(data={'target':y,'current':y2},x=x)
        return data

    # Get flint
    f = flint()
    #Create the plot
    p = f.get_plot(plot_class="plot1d", name="stress", unique_name="pi_stress")
    data=None
    with mot.run_wave(wavetype, offset, amplitude, nb_cycles, wavelen):
        while not mot.state.READY:
            current_index = len(data) if data is not None else 0
            data = refresh_display(data)
            if current_index == len(data):
                gevent.sleep(1)

    #last display
    refresh_display(data)
```