MATLAB Middle Layer Specification T. Limberg J. Wilgen 2012-02-20 1 The MATLAB middle layer calls are of the form: [results, error, component_names, component_positions, component_status] = do_something (id, set_points, further_specs) In: ‘id’ identifies target components and is a cell array which contains one of the following: Nothing {} Component names targets all components Explicit: {‘Q1’ ‘Q2’} or {‘9ACC1’} Generic {‘Quads’ ‘Bends’} or {‘DBC2’} as a BPM group One by one [m] {‘1.5’ ‘2.4’ ‘7.8’} Range [m] {‘1.5-10’} Positions ‘set_points is empty or an array of length N_comp, N_comp = number of components specified in id and application dependent width. ‘further_specs’ is a cell array with further specifications; its content depends on the application. Out: ‘results’ depends entirely on the application. ‘error’ is a string (empty if everything is fine) ‘component_names’ and ‘component_positions’ are cell arrays of length N_comp with obvious meaning. ‘component_status’ is an array of length N_comp and application dependent width. 2 General remarks: The all components case, generic names (e.g., ‘Quad’) and position ranges will be resolved with the help of the Optics Server. List of Calls: read_magnets set_magnets read_BPMs set_orbit read_toroids read_BLMs get_beam_profile get_longitudinal_profile read_rf set_rf set_energy Description of Calls: [fields_and_currents, status, names, positions, error] = read_magnets (id, further_specs) Generic names: ‘Quad’,’Bend’,’Sext’ further_specs: Name ‘ignore_if_off Type Logical default 1 Comment Does not return switched off magnets ‘status’ is an N_comp *4 array with [green/yellow/red ; on/off ; cycled/not cycled ; in tolerance/not in tolerance] 3 ‘fields_and_currents’ is an N_comp *2 array containing magnet fields and currents Remarks: A power supply which is off will be ignored if ‘ignore_if_off’ is specified in further specifications. [fields_and_currents, status, names, positions, error] = set_magnets (id, fields_and_currents, further_specs) Generic names: ‘Quad’, ’Bend’, ’Sext’ ‘fields_and_currents’ is an N_comp *2 array containing magnet fields and currents further_specs: Name do_not_switch_on Type Logical 0 default switch_off Logical 0 Comment If the target supply is off, an error is returned ‘status’ is a N_comp x 4 array with [green/yellow/red ; on/off ; cycled/not cycled ; in tolerance/not in tolerance] Remarks: A power supply which is off will be switched on and the requested set-value is dialled in. Can be suppressed by ‘do_not_switch_on’ in further specifications. ‘switch_off’ in further specifications switches off the magnets specified by ‘id’. Groups of magnets will be ramped. [orbit, status, names, positions, error] = read_BPMs (id, further_specs) Generic names: ‘DBC2’, ‘UND’ etc. further_specs: 4 Name number of samples bunch number average samples average bunches x_err Type Integer Integer Logical Logical Logical 10 1 1 1 0 y_err Logical 0 Example: default Comment Integer or vector (1:20) Statistical error horizontally Statistical error vertically { ‘number of samples’ 60 ’bunch number’ 1:30 ‘average samples’, 1 ‘average bunches’ 0 ‘x_err’ 1 ‘y_err’ 1} would take 60 orbit measurements of the first 30 bunches in the train and average over samples and bunches, so that ‘orbit’ would be an N_comp long and 4 (x,y,err_x,err_y) wide array. ‘status’ is an N_comp*tbd array. [orbit, status, names, positions, error] = Set_orbit (id, soll_orbit, further_specs) Generic names: ‘DBC2’, ‘UND’ etc. further_specs: Name number of samples bunch number Type Integer Integer or String 10 1 average samples average bunches x_err Logical Logical Logical 1 1 0 y_err Logical 0 Correctors String ‘’ Example: default Comment String for regions (‘1-20’) Statistical error horizontally Statistical error vertically Correctors to be used {‘ ‘number of samples’ 60 ’bunch number’ ‘1-30’ ‘average samples’, 1 ‘average bunches’ 0 ‘x_err’ 1 ‘y_err’ 1} 5 would take 60 orbit measurements of the first 30 bunches in the train and average over samples and bunches, so that ‘orbit’ would be an N_comp long and 4 (x,y,err_x,err_y) wide array. ‘status’ is an N_comp*tbd array. [charge, status, names, positions, error] = read_toroids (id, further_specs) Generic names: none further_specs: Name number of samples bunch number Type Integer Integer or String 10 1 average samples average bunches x_err Logical Logical Logical 1 1 0 y_err Logical 0 Example: Default Comment String for regions (‘1-20’) Statistical error horizontally Statistical error vertically {‘number of samples’ 60 ’bunch number’ ‘1-30’ ‘average samples’, 1 ‘average bunches’ 0 ‘x_err’ 1 ‘y_err’ 1} would take 60 charge measurements of the first 30 bunches in the train and average over samples and bunches, so that ‘charge’ would be an N_comp long and 4 (x,y,err_x,err_y) wide array. ‘status’ is an N_comp*tbd array. [losses, status, names, positions, error] = read_BLMs (id, further_specs) Generic names: ‘DBC2’, ‘UND’ etc. 6 further_specs: Name number of samples bunch number average samples average bunches Example: Type default Integer Integer Logical Logical Comment 10 1 1 1 { ‘number of samples’ 60 ’bunch number’ 1:20 ‘average samples’, 1 ‘average bunches’ 0} would take 60 loss measurements of the first 20 bunches in the train and average over samples, so that ‘losses’ would be an N_comp * number of bunches array. ‘status’ is an N_comp*tbd array. [profile_data, status, names, positions, error] = get_beam_profile (id, further_specs) Generic names: ‘DBC2’, ‘UND’ etc. further_specs: Name background_sub Type Logical 1 default number of pictures Gaussian Optics data Integer Logical Logical 10 1 1 Comment 1 subtracts background Gaussian fit 1 provides optics data for multiple profiles Profile_data is a two-column, ‘:’ separated list. ‘status’ is an N_comp*tbd array. [longitudinal_profile_data, status, names, positions, error] = get_longitudinal_profile (id, further_specs) Generic names: none 7 further_specs: Name background_sub Type Logical default 1 number of pictures Gaussian Integer Logical 10 1 Comment 1 subtracts background Gaussian fit Profile_data is a two-column, ‘:’ separated list. ‘status’ is an N_comp*tbd array. Remarks: Initiates and evaluates a LOLA measurement [rf_data, status, names, positions, error] = read_rf (id, further_specs) Generic names: none further_specs: Name Scale_magnets Type Logical default 1 Comment 1 adjusts magnets to energy rf_data is a N_comp*2 (amplitude, phases) array. ‘status’ is an N_comp*tbd array. [rf_data, status, names, positions, error] = set_rf (id, rf_set_points, further_specs) 8 Generic names: none further_specs: Name Scale_magnets Type Logical default 1 rf_data is a N_comp*2 (amplitude, phases) array. ‘status’ is an N_comp*tbd array. 9 Comment 1 adjusts magnets to energy