|
2 | 2 | import time |
3 | 3 |
|
4 | 4 | import numpy as np |
5 | | -from pyaml.instrument import ConfigModel as InstrumentConfigModel |
6 | | -from pyaml.instrument import Instrument |
7 | 5 | from tango.pyaml.attribute import Attribute |
8 | 6 | from tango.pyaml.attribute import ConfigModel as AttributeConfig |
9 | 7 | from tango.pyaml.attribute_read_only import ( |
|
19 | 17 | TangoControlSystem, |
20 | 18 | ) |
21 | 19 |
|
| 20 | +from pyaml.accelerator import Accelerator |
| 21 | +from pyaml.accelerator import ConfigModel as AcceleratorConfigModel |
22 | 22 | from pyaml.arrays.magnet import ConfigModel as MagnetArrayConfigModel |
23 | 23 | from pyaml.arrays.magnet import Magnet |
24 | 24 | from pyaml.configuration import set_root_folder |
|
50 | 50 |
|
51 | 51 | tangocs = ControlSystemConfig(name="live", tango_host="ebs-simu-3:10000") |
52 | 52 | control = TangoControlSystem(tangocs) |
53 | | -control.init_cs() |
54 | 53 |
|
55 | 54 | qfCurve = CSVCurve(CSVCureveConfig(file="config/sr/magnet_models/QF1_strength.csv")) |
56 | 55 | qdCurve = CSVCurve(CSVCureveConfig(file="config/sr/magnet_models/QD2_strength.csv")) |
|
104 | 103 |
|
105 | 104 | quads = Magnet(MagnetArrayConfigModel(name="quadsForTune", elements=names)) |
106 | 105 |
|
107 | | -sr = Instrument( |
108 | | - InstrumentConfigModel( |
109 | | - name="sr", |
| 106 | +sr = Accelerator( |
| 107 | + AcceleratorConfigModel( |
| 108 | + machine="sr", |
| 109 | + facility="ESRF", |
110 | 110 | energy=6e9, |
111 | 111 | controls=[control], |
112 | 112 | simulators=[simulator], |
|
137 | 137 | correctionmat = np.linalg.pinv(tunemat.T) |
138 | 138 |
|
139 | 139 | # Correct tune on live |
140 | | -qxAtt = AttributeReadOnly( |
141 | | - AttributeReadOnlyConfig(attribute="sys/ringsimulator/ebs/Tune_h", unit="") |
142 | | -) |
143 | | -qyAtt = AttributeReadOnly( |
144 | | - AttributeReadOnlyConfig(attribute="sys/ringsimulator/ebs/Tune_v", unit="") |
| 140 | + |
| 141 | +# Here ,as an example, instead of using the betatron tune monitor object, |
| 142 | +# we directly connect to th CS |
| 143 | +qxAtt, qyAtt = control.attach( |
| 144 | + [ |
| 145 | + AttributeReadOnly( |
| 146 | + AttributeReadOnlyConfig(attribute="sys/ringsimulator/ebs/Tune_h", unit="") |
| 147 | + ), |
| 148 | + AttributeReadOnly( |
| 149 | + AttributeReadOnlyConfig(attribute="sys/ringsimulator/ebs/Tune_v", unit="") |
| 150 | + ), |
| 151 | + ] |
145 | 152 | ) |
146 | 153 |
|
147 | 154 | print(f"Tune={qxAtt.readback()}, {qyAtt.readback()}") |
|
0 commit comments