From 4003eaefd37b3d23622c5e1e0056f6656694fa3c Mon Sep 17 00:00:00 2001 From: Claudio Scafuri <claudio.scafuri@elettra.eu> Date: Mon, 3 Mar 2025 17:51:53 +0100 Subject: [PATCH] intermiediate - not working yet --- TODO | 3 +- src/E2Sextupole.cpp | 503 ++++++++++++++++++++++++--------------- src/E2Sextupole.h | 86 ++++--- src/E2Sextupole.xmi | 51 ++-- src/E2SextupoleClass.cpp | 123 +++++++--- src/E2SextupoleClass.h | 3 + 6 files changed, 499 insertions(+), 270 deletions(-) diff --git a/TODO b/TODO index 4aa68f8..b67293e 100644 --- a/TODO +++ b/TODO @@ -1 +1,2 @@ -fix units \ No newline at end of file +fix units +exception handling reading/writng attributes \ No newline at end of file diff --git a/src/E2Sextupole.cpp b/src/E2Sextupole.cpp index b311018..fafca66 100644 --- a/src/E2Sextupole.cpp +++ b/src/E2Sextupole.cpp @@ -180,6 +180,8 @@ void E2Sextupole::delete_device() delete ceh; if(skewquadrupole) delete skewquadrupole; + if (bba_switch_dev) + delete bba_switch_dev; @@ -197,6 +199,13 @@ void E2Sextupole::delete_device() delete main_current_dev; if (sextupole) delete sextupole; + if(ceh) + delete ceh; + if(cev) + delete cev; + if(skewquadrupole) + delete skewquadrupole; + /* clang-format off */ /*----- PROTECTED REGION END -----*/ // E2Sextupole::delete_device delete[] attr_Strength_read; @@ -238,6 +247,10 @@ void E2Sextupole::init_device() set_state(Tango::UNKNOWN); set_status("Init"); design_strength_initialized = false; + pure_sext = false; + ceh_cev = false; + bba_ready = false; + sext_with_skew = false; /*----- PROTECTED REGION END -----*/ // E2Sextupole::init_device_before @@ -272,6 +285,28 @@ void E2Sextupole::init_device() /* clang-format on */ // Initialize device /* clang-format off */ + + //examine EmbbeddedConfiguration and set the configration flags + if (embeddedConfiguration == "pure_sext") + pure_sext = true; + if (embeddedConfiguration == "ceh_cev") + ceh_cev = true; + if (embeddedConfiguration == "bba_ready") + bba_ready = true; + if (embeddedConfiguration == "sext_with_skew") + sext_with_skew = true; + if (!(pure_sext || ceh_cev || bba_ready || sext_with_skew)) { + set_state(Tango::UNKNOWN); + set_status("wrong EmebddedConfiguration property"); + ERROR_STREAM << "wrong EmbeddedConfiguration property: " + << embeddedConfiguration + << " [ pure_sext | ceh_cev | bba_ready | sect_with_skew ]"; + return; //init failed! + } + + + bba_switch_dev = nullptr; + main_current_dev = nullptr; main_current_cb = nullptr; main_current_event_id = 0; @@ -302,6 +337,8 @@ void E2Sextupole::init_device() cev_current_state = Tango::OFF; //safe guess cev_design_strength = 0.0; + + // creat proxy for main sextupole coil power supply try{ main_current_dev = new Tango::DeviceProxy(currentDevice); } @@ -314,82 +351,115 @@ void E2Sextupole::init_device() set_status(st); return; } + //create MagnetModel::Sextupole - handles calibration tables and interpolations + // we do not use the EBS scheme with global properties... yet + //TODO: fix/determine format and handling of Elettra 2.0 calibrations - try{ - ceh_current_dev = new Tango::DeviceProxy(psCehDeviceName); - } - catch (Tango::DevFailed &ex){ - ERROR_STREAM << "failed to create Tango device proxy for CEH device: " - << psCehDeviceName; + sextupole = nullptr; + try { + std::string meas_strength_file_name = calibrationPath + "/" + calibrationFileName; + std::string param_file_name = calibrationPath + "/" + parameterFileName; + sextupole = new MagnetModel::PureSextupole(); + sextupole->init(true,1.0, meas_strength_file_name, param_file_name, magnetName); + } catch (std::exception &e) { + std::cerr << "fatalerror "<< e.what() << std::endl; + ERROR_STREAM << "failed to create sextupole model " << currentDevice; set_state(Tango::UNKNOWN); - std::string st = get_status(); - st += "\nfailed to create Tango device proxy for psCehDeviceName"; - set_status(st); + set_status("failed to create sextupole model CurrentDevice"); return; } - try{ - cev_current_dev = new Tango::DeviceProxy(psCevDeviceName); + //create MagnetModel::Corrector - handles calibration tables and interpolations + // we do not use the EBS scheme with global properties... yet + //TODO: fix/determine format and handling of Elettra 2.0 calibrations + + ceh = nullptr; + try { + std::string meas_strength_file_name = calibrationPath + "/" + cEHCalibrationFileName; + std::string param_file_name = calibrationPath + "/" + parameterFileName; + ceh = new MagnetModel::Corrector(); + ceh->init(true,1.0, meas_strength_file_name, param_file_name, cEHName); + } catch (std::exception &e) { + std::cerr << "fatalerror "<< e.what() << std::endl; + ERROR_STREAM << "failed to create CEH corrector model " << currentDevice; + set_state(Tango::UNKNOWN); + set_status("failed to create CEH corrector model CurrentDevice"); + return; } - catch (Tango::DevFailed &ex){ - ERROR_STREAM << "failed to create Tango device proxy for CEV device: " - << psCevDeviceName; + + cev = nullptr; + try { + std::string meas_strength_file_name = calibrationPath + "/" + cEVCalibrationFileName; + std::string param_file_name = calibrationPath + "/" + parameterFileName; + cev = new MagnetModel::Corrector(); + cev->init(true,1.0, meas_strength_file_name, param_file_name, cEVName); + } catch (std::exception &e) { + std::cerr << "fatalerror "<< e.what() << std::endl; + ERROR_STREAM << "failed to create CEV corrector model " << currentDevice; set_state(Tango::UNKNOWN); - std::string st = get_status(); - st += "\nfailed to create Tango device proxy for psCevDeviceName"; - set_status(st); + set_status("failed to create CEV corrector model CurrentDevice"); return; } - //create MagnetModel::Sextupole - handles calibration tables and interpolations + //create MagnetModel::Quadrupole - handles calibration tables and interpolations // we do not use the EBS scheme with global properties... yet //TODO: fix/determine format and handling of Elettra 2.0 calibrations + // check also for congruent configuration of properties - sextupole = nullptr; + skewquadrupole = nullptr; try { - std::string meas_strength_file_name = calibrationPath + "/" + calibrationFileName; + std::string meas_strength_file_name = calibrationPath + "/" + sQCalibrationFileName; std::string param_file_name = calibrationPath + "/" + parameterFileName; - sextupole = new MagnetModel::PureSextupole(); - sextupole->init(true,1.0, meas_strength_file_name, param_file_name, magnetName); + skewquadrupole = new MagnetModel::Quadrupole(); + skewquadrupole->init(true,1.0, meas_strength_file_name, param_file_name, magnetName); } catch (std::exception &e) { std::cerr << "fatalerror "<< e.what() << std::endl; - ERROR_STREAM << "failed to create sextupole model " << currentDevice; + ERROR_STREAM << "failed to create embedded skew quadrupole model " << sQCalibrationFileName; set_state(Tango::UNKNOWN); - set_status("failed to create sextupole model CurrentDevice"); + set_status("failed to create sembedded skew quadrupole model"); return; } - - //create MagnetModel::Corrector - handles calibration tables and interpolations - // we do not use the EBS scheme with global properties... yet - //TODO: fix/determine format and handling of Elettra 2.0 calibrations - - ceh = nullptr; - try { - std::string meas_strength_file_name = calibrationPath + "/" + cEHCalibrationFileName; - std::string param_file_name = calibrationPath + "/" + parameterFileName; - ceh = new MagnetModel::Corrector(); - ceh->init(true,1.0, meas_strength_file_name, param_file_name, cEHName); - } catch (std::exception &e) { - std::cerr << "fatalerror "<< e.what() << std::endl; - ERROR_STREAM << "failed to create CEH corrector model " << currentDevice; + if (!pure_sext){ //pure sextupole are not connected to psceh and pscev! + try{ + ceh_current_dev = new Tango::DeviceProxy(psCehDeviceName); + } + catch (Tango::DevFailed &ex){ + ERROR_STREAM << "failed to create Tango device proxy for CEH device: " + << psCehDeviceName; + set_state(Tango::UNKNOWN); + std::string st = get_status(); + st += "\nfailed to create Tango device proxy for psCehDeviceName"; + set_status(st); + return; + } + try{ + cev_current_dev = new Tango::DeviceProxy(psCevDeviceName); + } + catch (Tango::DevFailed &ex){ + ERROR_STREAM << "failed to create Tango device proxy for CEV device: " + << psCevDeviceName; set_state(Tango::UNKNOWN); - set_status("failed to create CEH corrector model CurrentDevice"); + std::string st = get_status(); + st += "\nfailed to create Tango device proxy for psCevDeviceName"; + set_status(st); return; } + } - cev = nullptr; - try { - std::string meas_strength_file_name = calibrationPath + "/" + cEVCalibrationFileName; - std::string param_file_name = calibrationPath + "/" + parameterFileName; - cev = new MagnetModel::Corrector(); - cev->init(true,1.0, meas_strength_file_name, param_file_name, cEVName); - } catch (std::exception &e) { - std::cerr << "fatalerror "<< e.what() << std::endl; - ERROR_STREAM << "failed to create CEV corrector model " << currentDevice; + if(bba_ready){ + try{ + bba_switch_dev = new Tango::DeviceProxy(bbaSwitchDeviceName); + } + catch (Tango::DevFailed &ex){ + ERROR_STREAM << "failed to create Tango device proxy for main BBA switch device: " + << bbaSwitchDeviceName; set_state(Tango::UNKNOWN); - set_status("failed to create CEV corrector model CurrentDevice"); + std::string st = get_status(); + st += "\nfailed to create Tango device proxy for bbaSwitchDeviceName"; + set_status(st); return; } + } // init energy *attr_BeamEnergy_read = default_beam_energy; @@ -438,24 +508,26 @@ void E2Sextupole::get_device_property() // Read device properties from database. Tango::DbData dev_prop; - dev_prop.push_back(Tango::DbDatum("CurrentDevice")); - dev_prop.push_back(Tango::DbDatum("Model")); - dev_prop.push_back(Tango::DbDatum("SerialNumber")); - dev_prop.push_back(Tango::DbDatum("MagnetName")); - dev_prop.push_back(Tango::DbDatum("CalibrationFileName")); - dev_prop.push_back(Tango::DbDatum("CalibrationPath")); - dev_prop.push_back(Tango::DbDatum("BBASwitchable")); - dev_prop.push_back(Tango::DbDatum("SkewQuad")); - dev_prop.push_back(Tango::DbDatum("CEHName")); - dev_prop.push_back(Tango::DbDatum("CEVName")); + dev_prop.push_back(Tango::DbDatum("BbaSwitchAttribute")); + dev_prop.push_back(Tango::DbDatum("BbaSwitchDeviceName")); + dev_prop.push_back(Tango::DbDatum("CEHCalibrationFileName")); dev_prop.push_back(Tango::DbDatum("CEHDeviceName")); + dev_prop.push_back(Tango::DbDatum("CEHName")); + dev_prop.push_back(Tango::DbDatum("CEVCalibrationFileName")); dev_prop.push_back(Tango::DbDatum("CEVDeviceName")); + dev_prop.push_back(Tango::DbDatum("CEVName")); + dev_prop.push_back(Tango::DbDatum("CalibrationFileName")); + dev_prop.push_back(Tango::DbDatum("CalibrationPath")); + dev_prop.push_back(Tango::DbDatum("CurrentDevice")); + dev_prop.push_back(Tango::DbDatum("EmbeddedConfiguration")); + dev_prop.push_back(Tango::DbDatum("MagnetName")); + dev_prop.push_back(Tango::DbDatum("Model")); + dev_prop.push_back(Tango::DbDatum("ParameterFileName")); dev_prop.push_back(Tango::DbDatum("PsCehDeviceName")); dev_prop.push_back(Tango::DbDatum("PsCevDeviceName")); - dev_prop.push_back(Tango::DbDatum("ParameterFileName")); - dev_prop.push_back(Tango::DbDatum("CEHCalibrationFileName")); dev_prop.push_back(Tango::DbDatum("SQCalibrationFileName")); - dev_prop.push_back(Tango::DbDatum("CEVCalibrationFileName")); + dev_prop.push_back(Tango::DbDatum("SerialNumber")); + dev_prop.push_back(Tango::DbDatum("SkewQuad")); // is there at least one property to be read ? if (dev_prop.size()>0) @@ -470,49 +542,97 @@ void E2Sextupole::get_device_property() (static_cast<E2SextupoleClass *>(get_device_class())); int i = -1; - // Try to initialize CurrentDevice from class property + // Try to initialize BbaSwitchAttribute from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> currentDevice; + if (cl_prop.is_empty()==false) cl_prop >> bbaSwitchAttribute; else { - // Try to initialize CurrentDevice from default device value + // Try to initialize BbaSwitchAttribute from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> currentDevice; + if (def_prop.is_empty()==false) def_prop >> bbaSwitchAttribute; } - // And try to extract CurrentDevice value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> currentDevice; + // And try to extract BbaSwitchAttribute value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> bbaSwitchAttribute; - // Try to initialize Model from class property + // Try to initialize BbaSwitchDeviceName from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> model; + if (cl_prop.is_empty()==false) cl_prop >> bbaSwitchDeviceName; else { - // Try to initialize Model from default device value + // Try to initialize BbaSwitchDeviceName from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> model; + if (def_prop.is_empty()==false) def_prop >> bbaSwitchDeviceName; } - // And try to extract Model value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> model; + // And try to extract BbaSwitchDeviceName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> bbaSwitchDeviceName; - // Try to initialize SerialNumber from class property + // Try to initialize CEHCalibrationFileName from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> serialNumber; + if (cl_prop.is_empty()==false) cl_prop >> cEHCalibrationFileName; else { - // Try to initialize SerialNumber from default device value + // Try to initialize CEHCalibrationFileName from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> serialNumber; + if (def_prop.is_empty()==false) def_prop >> cEHCalibrationFileName; } - // And try to extract SerialNumber value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> serialNumber; + // And try to extract CEHCalibrationFileName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEHCalibrationFileName; + // Property StartDsPath is mandatory, check if has been defined in database. + check_mandatory_property(cl_prop, dev_prop[i]); - // Try to initialize MagnetName from class property + // Try to initialize CEHDeviceName from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> magnetName; + if (cl_prop.is_empty()==false) cl_prop >> cEHDeviceName; else { - // Try to initialize MagnetName from default device value + // Try to initialize CEHDeviceName from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> magnetName; + if (def_prop.is_empty()==false) def_prop >> cEHDeviceName; } - // And try to extract MagnetName value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> magnetName; + // And try to extract CEHDeviceName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEHDeviceName; + + // Try to initialize CEHName from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> cEHName; + else { + // Try to initialize CEHName from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> cEHName; + } + // And try to extract CEHName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEHName; + + // Try to initialize CEVCalibrationFileName from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> cEVCalibrationFileName; + else { + // Try to initialize CEVCalibrationFileName from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> cEVCalibrationFileName; + } + // And try to extract CEVCalibrationFileName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEVCalibrationFileName; + // Property StartDsPath is mandatory, check if has been defined in database. + check_mandatory_property(cl_prop, dev_prop[i]); + + // Try to initialize CEVDeviceName from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> cEVDeviceName; + else { + // Try to initialize CEVDeviceName from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> cEVDeviceName; + } + // And try to extract CEVDeviceName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEVDeviceName; + + // Try to initialize CEVName from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> cEVName; + else { + // Try to initialize CEVName from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> cEVName; + } + // And try to extract CEVName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEVName; // Try to initialize CalibrationFileName from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); @@ -538,71 +658,64 @@ void E2Sextupole::get_device_property() // And try to extract CalibrationPath value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> calibrationPath; - // Try to initialize BBASwitchable from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> bBASwitchable; - else { - // Try to initialize BBASwitchable from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> bBASwitchable; - } - // And try to extract BBASwitchable value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> bBASwitchable; - - // Try to initialize SkewQuad from class property + // Try to initialize CurrentDevice from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> skewQuad; + if (cl_prop.is_empty()==false) cl_prop >> currentDevice; else { - // Try to initialize SkewQuad from default device value + // Try to initialize CurrentDevice from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> skewQuad; + if (def_prop.is_empty()==false) def_prop >> currentDevice; } - // And try to extract SkewQuad value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> skewQuad; + // And try to extract CurrentDevice value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> currentDevice; - // Try to initialize CEHName from class property + // Try to initialize EmbeddedConfiguration from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> cEHName; + if (cl_prop.is_empty()==false) cl_prop >> embeddedConfiguration; else { - // Try to initialize CEHName from default device value + // Try to initialize EmbeddedConfiguration from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> cEHName; + if (def_prop.is_empty()==false) def_prop >> embeddedConfiguration; } - // And try to extract CEHName value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEHName; + // And try to extract EmbeddedConfiguration value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> embeddedConfiguration; + // Property StartDsPath is mandatory, check if has been defined in database. + check_mandatory_property(cl_prop, dev_prop[i]); - // Try to initialize CEVName from class property + // Try to initialize MagnetName from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> cEVName; + if (cl_prop.is_empty()==false) cl_prop >> magnetName; else { - // Try to initialize CEVName from default device value + // Try to initialize MagnetName from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> cEVName; + if (def_prop.is_empty()==false) def_prop >> magnetName; } - // And try to extract CEVName value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEVName; + // And try to extract MagnetName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> magnetName; - // Try to initialize CEHDeviceName from class property + // Try to initialize Model from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> cEHDeviceName; + if (cl_prop.is_empty()==false) cl_prop >> model; else { - // Try to initialize CEHDeviceName from default device value + // Try to initialize Model from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> cEHDeviceName; + if (def_prop.is_empty()==false) def_prop >> model; } - // And try to extract CEHDeviceName value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEHDeviceName; + // And try to extract Model value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> model; - // Try to initialize CEVDeviceName from class property + // Try to initialize ParameterFileName from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> cEVDeviceName; + if (cl_prop.is_empty()==false) cl_prop >> parameterFileName; else { - // Try to initialize CEVDeviceName from default device value + // Try to initialize ParameterFileName from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> cEVDeviceName; + if (def_prop.is_empty()==false) def_prop >> parameterFileName; } - // And try to extract CEVDeviceName value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEVDeviceName; + // And try to extract ParameterFileName value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> parameterFileName; + // Property StartDsPath is mandatory, check if has been defined in database. + check_mandatory_property(cl_prop, dev_prop[i]); // Try to initialize PsCehDeviceName from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); @@ -626,32 +739,6 @@ void E2Sextupole::get_device_property() // And try to extract PsCevDeviceName value from database if (dev_prop[i].is_empty()==false) dev_prop[i] >> psCevDeviceName; - // Try to initialize ParameterFileName from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> parameterFileName; - else { - // Try to initialize ParameterFileName from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> parameterFileName; - } - // And try to extract ParameterFileName value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> parameterFileName; - // Property StartDsPath is mandatory, check if has been defined in database. - check_mandatory_property(cl_prop, dev_prop[i]); - - // Try to initialize CEHCalibrationFileName from class property - cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> cEHCalibrationFileName; - else { - // Try to initialize CEHCalibrationFileName from default device value - def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> cEHCalibrationFileName; - } - // And try to extract CEHCalibrationFileName value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEHCalibrationFileName; - // Property StartDsPath is mandatory, check if has been defined in database. - check_mandatory_property(cl_prop, dev_prop[i]); - // Try to initialize SQCalibrationFileName from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); if (cl_prop.is_empty()==false) cl_prop >> sQCalibrationFileName; @@ -665,18 +752,27 @@ void E2Sextupole::get_device_property() // Property StartDsPath is mandatory, check if has been defined in database. check_mandatory_property(cl_prop, dev_prop[i]); - // Try to initialize CEVCalibrationFileName from class property + // Try to initialize SerialNumber from class property cl_prop = ds_class->get_class_property(dev_prop[++i].name); - if (cl_prop.is_empty()==false) cl_prop >> cEVCalibrationFileName; + if (cl_prop.is_empty()==false) cl_prop >> serialNumber; else { - // Try to initialize CEVCalibrationFileName from default device value + // Try to initialize SerialNumber from default device value def_prop = ds_class->get_default_device_property(dev_prop[i].name); - if (def_prop.is_empty()==false) def_prop >> cEVCalibrationFileName; + if (def_prop.is_empty()==false) def_prop >> serialNumber; } - // And try to extract CEVCalibrationFileName value from database - if (dev_prop[i].is_empty()==false) dev_prop[i] >> cEVCalibrationFileName; - // Property StartDsPath is mandatory, check if has been defined in database. - check_mandatory_property(cl_prop, dev_prop[i]); + // And try to extract SerialNumber value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> serialNumber; + + // Try to initialize SkewQuad from class property + cl_prop = ds_class->get_class_property(dev_prop[++i].name); + if (cl_prop.is_empty()==false) cl_prop >> skewQuad; + else { + // Try to initialize SkewQuad from default device value + def_prop = ds_class->get_default_device_property(dev_prop[i].name); + if (def_prop.is_empty()==false) def_prop >> skewQuad; + } + // And try to extract SkewQuad value from database + if (dev_prop[i].is_empty()==false) dev_prop[i] >> skewQuad; } @@ -1088,6 +1184,11 @@ void E2Sextupole::read_bbaEnable(Tango::Attribute &attr) /*----- PROTECTED REGION ID(E2Sextupole::read_bbaEnable) ENABLED START -----*/ /* clang-format on */ // Set the attribute value + if (bba_switch_dev){ + Tango::DeviceAttribute da; + da=bba_switch_dev->read_attribute(bbaSwitchAttribute); + da >> *attr_bbaEnable_read; + } attr.set_value(attr_bbaEnable_read); /* clang-format off */ /*----- PROTECTED REGION END -----*/ // E2Sextupole::read_bbaEnable @@ -1110,6 +1211,10 @@ void E2Sextupole::write_bbaEnable(Tango::WAttribute &attr) attr.get_write_value(w_val); /*----- PROTECTED REGION ID(E2Sextupole::write_bbaEnable) ENABLED START -----*/ /* clang-format on */ + if (bba_switch_dev){ + Tango::DeviceAttribute watt(bbaSwitchAttribute,w_val); + bba_switch_dev->write_attribute(watt); + } // Add your own code /* clang-format off */ /*----- PROTECTED REGION END -----*/ // E2Sextupole::write_bbaEnable @@ -1815,7 +1920,7 @@ void E2Sextupole::init_strengths(void) // initialize strengths from power supply mainStrengthAtt->set_write_value(_strength[0]); *attr_Strength_read = _strength[0]; main_set_strength[0] = _strength[0]; - Tango::DevDouble corr = _strength[0] - *attr_DesignStrength_read; + Tango::DevDouble corr = _strength[0] - *attr_DesignStrength_read; mainCorrectionAtt->set_write_value(corr); *attr_CorrectionStrength_read = corr; wValMainCorrStrength = corr; @@ -1827,30 +1932,56 @@ void E2Sextupole::init_strengths(void) // initialize strengths from power supply Tango::Except::print_exception(e); } try { - da = ceh_current_dev->read_attribute("Current"); - vector<Tango::DevDouble> outval; - da >> outval; - std::vector<Tango::DevDouble> _current; - std::vector<Tango::DevDouble> _strength; - _current.push_back(outval[1]); //use set value of current - ceh->compute_strengths(magnet_rigidity_inv, _current, _strength); - cehCursetAtt->set_write_value(_current); - ceh_set_current[0] = _current[0]; - - cehStrengthAtt->set_write_value(_strength[0]); - *attr_CEHStrength_read = _strength[0]; - ceh_set_strength[0] = _strength[0]; - Tango::DevDouble corr = _strength[0]; - cehCorrectionAtt->set_write_value(corr); - *attr_CEHCorrectionStrength_read = corr; - wValCehCorrStrength = corr; - - cehResonanceAtt->set_write_value(0.0); // start with resonance strength always at 0! - *attr_CEHResonanceStrength_read = 0.0; - wValCehResStrength = 0.0; - } catch (Tango::DevFailed &e) { - Tango::Except::print_exception(e); - } + da = ceh_current_dev->read_attribute("Current"); + vector<Tango::DevDouble> outval; + da >> outval; + std::vector<Tango::DevDouble> _current; + std::vector<Tango::DevDouble> _strength; + _current.push_back(outval[1]); //use set value of current + ceh->compute_strengths(magnet_rigidity_inv, _current, _strength); + cehCursetAtt->set_write_value(_current); + ceh_set_current[0] = _current[0]; + + cehStrengthAtt->set_write_value(_strength[0]); + *attr_CEHStrength_read = _strength[0]; + ceh_set_strength[0] = _strength[0]; + Tango::DevDouble corr = _strength[0]; + cehCorrectionAtt->set_write_value(corr); + *attr_CEHCorrectionStrength_read = corr; + wValCehCorrStrength = corr; + + cehResonanceAtt->set_write_value(0.0); // start with resonance strength always at 0! + *attr_CEHResonanceStrength_read = 0.0; + wValCehResStrength = 0.0; + } catch (Tango::DevFailed &e) { + Tango::Except::print_exception(e); + } + + try { + da = cev_current_dev->read_attribute("Current"); + vector<Tango::DevDouble> outval; + da >> outval; + std::vector<Tango::DevDouble> _current; + std::vector<Tango::DevDouble> _strength; + _current.push_back(outval[1]); //use set value of current + cev->compute_strengths(magnet_rigidity_inv, _current, _strength); + cevCursetAtt->set_write_value(_current); + cev_set_current[0] = _current[0]; + + cevStrengthAtt->set_write_value(_strength[0]); + *attr_CEVStrength_read = _strength[0]; + cev_set_strength[0] = _strength[0]; + Tango::DevDouble corr = _strength[0]; + cevCorrectionAtt->set_write_value(corr); + *attr_CEHCorrectionStrength_read = corr; + wValCevCorrStrength = corr; + + cevResonanceAtt->set_write_value(0.0); // start with resonance strength always at 0! + *attr_CEVResonanceStrength_read = 0.0; + wValCevResStrength = 0.0; + } catch (Tango::DevFailed &e) { + Tango::Except::print_exception(e); + } } //------------------------------------------------------------ diff --git a/src/E2Sextupole.h b/src/E2Sextupole.h index 4b8d3bc..6f9f9b5 100644 --- a/src/E2Sextupole.h +++ b/src/E2Sextupole.h @@ -81,12 +81,30 @@ class E2Sextupole : public TANGO_BASE_CLASS /*----- PROTECTED REGION ID(E2Sextupole::Data Members) ENABLED START -----*/ /* clang-format on */ // Add your own data members + + //Flags and switches + + bool pure_sext; //true if the magnet is connected as a pure sextupole, emmebdded corrector coils are not powered - no need to create proxies + bool ceh_cev; //true if the magnet is connected as a sextupole, with ambedd emmebdded corrector coils - no skew quadrupole + bool sext_with_skew; //true if the emebdded correcotr coils are permanently cable as skew quadupole and vertica correcotors; no bba switch + bool bba_ready; // true if the sextupole ebedded correctors are powered and the horizontal corrector can be reconnected as skew quadrupole via the bba switch + + // these flags are set by inspecting the EmbeddedConfiguration, which can assume only the values: "pure_sext", "ceh_cev", "bba_ready", "sext_with skew". + // all calibrations are loaded indipendently of the configuration (prepare for integral model 3x3) + // + // pure_sext: no reading, setting of ceh, cev, sq, bba switch, ceh, cev, sq, always set to 0 field, only main power supply + // ceh_cev: reading and setting of ceh end cev, no bba switch, sq alway set to 0, use all power supplies + // sext_with_skew: reading and setting of SQ and cev, no bba switch, ceh always 0,use all power supplies + // bba_ready: reading and setting of ceh and cev, end bba_switch, depending on bba switch, use pscev for cev or SQ, the other is 0, use all power supplies + + MagnetModel::PureSextupole* sextupole; //magnet model MagnetModel::Corrector* ceh; //magnet model for embedded horizontal corrector MagnetModel::Corrector* cev; //magnet model for embedded vertical corrector MagnetModel::Quadrupole* skewquadrupole; // magnet model for embedded skew quadrupole double magnet_rigidity; double magnet_rigidity_inv; + Tango::DeviceProxy* bba_switch_dev; Tango::DeviceProxy *main_current_dev; Tango::DeviceProxy *ceh_current_dev; Tango::DeviceProxy *cev_current_dev; @@ -156,43 +174,57 @@ public: // Device property data members public: - // CurrentDevice: power supply tango device name - std::string currentDevice; - // Model: corrector model (part number) - std::string model; - // SerialNumber: serial number of the magnet - std::string serialNumber; - // MagnetName: Name of magnet - std::string magnetName; - // CalibrationFileName: name of calibration table file name - std::string calibrationFileName; - // CalibrationPath: path of calibration and parameter files - std::string calibrationPath; - // BBASwitchable: true if the magnet embbeded skew quadrupole cna be activated for beama based alignement operations. - Tango::DevBoolean bBASwitchable; - // SkewQuad: True if the magnet is cabled with embbedd skew quadrupole QS . In this configuration the emmbedd horizontal corrector CEH is not available. - Tango::DevBoolean skewQuad; - // CEHName: Magnet name of embbedded horizontal corrector. - std::string cEHName; - // CEVName: Magnet name of embbedded vertical corrector. - std::string cEVName; + // BbaSwitchAttribute: Attribute name of the speciific ba switch + // The BBA switches are part of Elettra 2.0 MPS (Interlock) system + std::string bbaSwitchAttribute; + // BbaSwitchDeviceName: Tango device name exporting the interface to the BBA switches. + // Part of Elettra 2.0 MPS (Interlock) system + std::string bbaSwitchDeviceName; + // CEHCalibrationFileName: name of calibration table file name for horizontal embedded corrector - to be review3d when real calibrtaion tablles wil be available + std::string cEHCalibrationFileName; // CEHDeviceName: Name of tango device implementing the interface of the embedded horizontal corrector. std::string cEHDeviceName; + // CEHName: Magnet name of embbedded horizontal corrector. + std::string cEHName; + // CEVCalibrationFileName: name of calibration table file name for vertical embedded corrector - to be reviewed when real calibration tables wil be available + std::string cEVCalibrationFileName; // CEVDeviceName: Name of tango device implementing the interface of the embedded vertical corrector. std::string cEVDeviceName; + // CEVName: Magnet name of embbedded vertical corrector. + std::string cEVName; + // CalibrationFileName: name of calibration table file name + std::string calibrationFileName; + // CalibrationPath: path of calibration and parameter files + std::string calibrationPath; + // CurrentDevice: power supply tango device name + std::string currentDevice; + // EmbeddedConfiguration: String descibing the configuration fo the embedded coils. Only three values are valid: + // + // pure_sext + // ceh_cev + // sext_with_skew + // bba_ready + // + // + // Depending on the EbenddedConfiguration the appropriate numebr of proxies for power supplies and calibration models is built. + std::string embeddedConfiguration; + // MagnetName: Name of magnet + std::string magnetName; + // Model: corrector model (part number) + std::string model; + // ParameterFileName: name of auxiliary parametr file name + // (EBSmagnet compatibility) + std::string parameterFileName; // PsCehDeviceName: Name of the tango device of powering the embbedded horizontal corrector / embedded skew quadrupole. std::string psCehDeviceName; // PsCevDeviceName: Name of the tango device of powering the embbedded vertical corrector. std::string psCevDeviceName; - // ParameterFileName: name of auxiliary parametr file name - // (EBSmagnet compatibility) - std::string parameterFileName; - // CEHCalibrationFileName: name of calibration table file name for horizontal embedded corrector - to be review3d when real calibrtaion tablles wil be available - std::string cEHCalibrationFileName; // SQCalibrationFileName: name of calibration table file name for embedded skeq quadrupole - to be reviewed when real calibration tables will be available std::string sQCalibrationFileName; - // CEVCalibrationFileName: name of calibration table file name for vertical embedded corrector - to be reviewed when real calibration tables wil be available - std::string cEVCalibrationFileName; + // SerialNumber: serial number of the magnet + std::string serialNumber; + // SkewQuad: True if the magnet is cabled with embbedd skew quadrupole QS . In this configuration the emmbedd horizontal corrector CEH is not available. + Tango::DevBoolean skewQuad; bool mandatoryNotDefined; diff --git a/src/E2Sextupole.xmi b/src/E2Sextupole.xmi index ca10219..65e5702 100644 --- a/src/E2Sextupole.xmi +++ b/src/E2Sextupole.xmi @@ -11,6 +11,10 @@ <keyWords>calibartion</keyWords> </identification> </description> + <classProperties name="BbaSwitchDeviceName" description="Tango device name exporting the interface to the BBA switches.
Part of Elettra 2.0 MPS (Interlock) system"> + <type xsi:type="pogoDsl:StringType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </classProperties> <classProperties name="BeamEnergy" description="default electron beam energy, in GeV.
Use to initialize all magnet istances BeamEnergy attribute."> <type xsi:type="pogoDsl:DoubleType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> @@ -20,61 +24,59 @@ <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </classProperties> - <deviceProperties name="CurrentDevice" description="power supply tango device name"> + <deviceProperties name="BbaSwitchAttribute" description="Attribute name of the speciific ba switch
The BBA switches are part of Elettra 2.0 MPS (Interlock) system"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="Model" description="corrector model (part number)"> + <deviceProperties name="BbaSwitchDeviceName" description="Tango device name exporting the interface to the BBA switches.
Part of Elettra 2.0 MPS (Interlock) system"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="SerialNumber" description="serial number of the magnet"> + <deviceProperties name="CEHCalibrationFileName" mandatory="true" description="name of calibration table file name for horizontal embedded corrector - to be review3d when real calibrtaion tablles wil be available"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="MagnetName" description="Name of magnet"> + <deviceProperties name="CEHDeviceName" description="Name of tango device implementing the interface of the embedded horizontal corrector."> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="CalibrationFileName" mandatory="true" description="name of calibration table file name"> + <deviceProperties name="CEHName" description="Magnet name of embbedded horizontal corrector."> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="CalibrationPath" description="path of calibration and parameter files"> + <deviceProperties name="CEVCalibrationFileName" mandatory="true" description="name of calibration table file name for vertical embedded corrector - to be reviewed when real calibration tables wil be available"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="BBASwitchable" description="true if the magnet embbeded skew quadrupole cna be activated for beama based alignement operations."> - <type xsi:type="pogoDsl:BooleanType"/> + <deviceProperties name="CEVDeviceName" description="Name of tango device implementing the interface of the embedded vertical corrector."> + <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - <DefaultPropValue>False</DefaultPropValue> </deviceProperties> - <deviceProperties name="SkewQuad" description="True if the magnet is cabled with embbedd skew quadrupole QS . In this configuration the emmbedd horizontal corrector CEH is not available."> - <type xsi:type="pogoDsl:BooleanType"/> + <deviceProperties name="CEVName" description="Magnet name of embbedded vertical corrector."> + <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - <DefaultPropValue>False</DefaultPropValue> </deviceProperties> - <deviceProperties name="CEHName" description="Magnet name of embbedded horizontal corrector."> + <deviceProperties name="CalibrationFileName" mandatory="true" description="name of calibration table file name"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="CEVName" description="Magnet name of embbedded vertical corrector."> + <deviceProperties name="CalibrationPath" description="path of calibration and parameter files"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="CEHDeviceName" description="Name of tango device implementing the interface of the embedded horizontal corrector."> + <deviceProperties name="CurrentDevice" description="power supply tango device name"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="CEVDeviceName" description="Name of tango device implementing the interface of the embedded vertical corrector."> + <deviceProperties name="EmbeddedConfiguration" mandatory="true" description="String descibing the configuration fo the embedded coils. Only three values are valid:

pure_sext
ceh_cev
sext_with_skew
bba_ready


Depending on the EbenddedConfiguration the appropriate numebr of proxies for power supplies and calibration models is built."> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="PsCehDeviceName" description="Name of the tango device of powering the embbedded horizontal corrector / embedded skew quadrupole."> + <deviceProperties name="MagnetName" description="Name of magnet"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="PsCevDeviceName" description="Name of the tango device of powering the embbedded vertical corrector."> + <deviceProperties name="Model" description="corrector model (part number)"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> @@ -82,7 +84,11 @@ <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="CEHCalibrationFileName" mandatory="true" description="name of calibration table file name for horizontal embedded corrector - to be review3d when real calibrtaion tablles wil be available"> + <deviceProperties name="PsCehDeviceName" description="Name of the tango device of powering the embbedded horizontal corrector / embedded skew quadrupole."> + <type xsi:type="pogoDsl:StringType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </deviceProperties> + <deviceProperties name="PsCevDeviceName" description="Name of the tango device of powering the embbedded vertical corrector."> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> @@ -90,10 +96,15 @@ <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> - <deviceProperties name="CEVCalibrationFileName" mandatory="true" description="name of calibration table file name for vertical embedded corrector - to be reviewed when real calibration tables wil be available"> + <deviceProperties name="SerialNumber" description="serial number of the magnet"> <type xsi:type="pogoDsl:StringType"/> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </deviceProperties> + <deviceProperties name="SkewQuad" description="True if the magnet is cabled with embbedd skew quadrupole QS . In this configuration the emmbedd horizontal corrector CEH is not available."> + <type xsi:type="pogoDsl:BooleanType"/> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + <DefaultPropValue>False</DefaultPropValue> + </deviceProperties> <commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0"> <argin description="none"> <type xsi:type="pogoDsl:VoidType"/> diff --git a/src/E2SextupoleClass.cpp b/src/E2SextupoleClass.cpp index 2fd95ec..059a551 100644 --- a/src/E2SextupoleClass.cpp +++ b/src/E2SextupoleClass.cpp @@ -275,6 +275,7 @@ void E2SextupoleClass::get_class_property() /* clang-format off */ /*----- PROTECTED REGION END -----*/ // E2SextupoleClass::get_class_property_before // Read class properties from database. + cl_prop.push_back(Tango::DbDatum("BbaSwitchDeviceName")); cl_prop.push_back(Tango::DbDatum("BeamEnergy")); cl_prop.push_back(Tango::DbDatum("CalibrationPath")); @@ -284,6 +285,18 @@ void E2SextupoleClass::get_class_property() Tango::DbDatum def_prop; int i = -1; + // Try to extract BbaSwitchDeviceName value + if (cl_prop[++i].is_empty()==false) cl_prop[i] >> bbaSwitchDeviceName; + else + { + // Check default value for BbaSwitchDeviceName + def_prop = get_default_class_property(cl_prop[i].name); + if (def_prop.is_empty()==false) + { + def_prop >> bbaSwitchDeviceName; + cl_prop[i] << bbaSwitchDeviceName; + } + } // Try to extract BeamEnergy value if (cl_prop[++i].is_empty()==false) cl_prop[i] >> beamEnergy; else @@ -333,6 +346,19 @@ void E2SextupoleClass::set_default_property() std::vector<std::string> vect_data; // Set Default Class Properties + prop_name = "BbaSwitchDeviceName"; + prop_desc = "Tango device name exporting the interface to the BBA switches.\nPart of Elettra 2.0 MPS (Interlock) system"; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + cl_def_prop.push_back(data); + add_wiz_class_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_class_prop(prop_name, prop_desc); prop_name = "BeamEnergy"; prop_desc = "default electron beam energy, in GeV.\nUse to initialize all magnet istances BeamEnergy attribute."; prop_def = "2.4"; @@ -362,8 +388,8 @@ void E2SextupoleClass::set_default_property() add_wiz_class_prop(prop_name, prop_desc); // Set Default device Properties - prop_name = "CurrentDevice"; - prop_desc = "power supply tango device name"; + prop_name = "BbaSwitchAttribute"; + prop_desc = "Attribute name of the speciific ba switch\nThe BBA switches are part of Elettra 2.0 MPS (Interlock) system"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -375,8 +401,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "Model"; - prop_desc = "corrector model (part number)"; + prop_name = "BbaSwitchDeviceName"; + prop_desc = "Tango device name exporting the interface to the BBA switches.\nPart of Elettra 2.0 MPS (Interlock) system"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -388,8 +414,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "SerialNumber"; - prop_desc = "serial number of the magnet"; + prop_name = "CEHCalibrationFileName"; + prop_desc = "name of calibration table file name for horizontal embedded corrector - to be review3d when real calibrtaion tablles wil be available"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -401,8 +427,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "MagnetName"; - prop_desc = "Name of magnet"; + prop_name = "CEHDeviceName"; + prop_desc = "Name of tango device implementing the interface of the embedded horizontal corrector."; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -414,8 +440,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "CalibrationFileName"; - prop_desc = "name of calibration table file name"; + prop_name = "CEHName"; + prop_desc = "Magnet name of embbedded horizontal corrector."; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -427,8 +453,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "CalibrationPath"; - prop_desc = "path of calibration and parameter files"; + prop_name = "CEVCalibrationFileName"; + prop_desc = "name of calibration table file name for vertical embedded corrector - to be reviewed when real calibration tables wil be available"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -440,11 +466,10 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "BBASwitchable"; - prop_desc = "true if the magnet embbeded skew quadrupole cna be activated for beama based alignement operations."; - prop_def = "False"; + prop_name = "CEVDeviceName"; + prop_desc = "Name of tango device implementing the interface of the embedded vertical corrector."; + prop_def = ""; vect_data.clear(); - vect_data.push_back("False"); if (prop_def.length()>0) { Tango::DbDatum data(prop_name); @@ -454,11 +479,10 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "SkewQuad"; - prop_desc = "True if the magnet is cabled with embbedd skew quadrupole QS . In this configuration the emmbedd horizontal corrector CEH is not available."; - prop_def = "False"; + prop_name = "CEVName"; + prop_desc = "Magnet name of embbedded vertical corrector."; + prop_def = ""; vect_data.clear(); - vect_data.push_back("False"); if (prop_def.length()>0) { Tango::DbDatum data(prop_name); @@ -468,8 +492,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "CEHName"; - prop_desc = "Magnet name of embbedded horizontal corrector."; + prop_name = "CalibrationFileName"; + prop_desc = "name of calibration table file name"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -481,8 +505,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "CEVName"; - prop_desc = "Magnet name of embbedded vertical corrector."; + prop_name = "CalibrationPath"; + prop_desc = "path of calibration and parameter files"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -494,8 +518,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "CEHDeviceName"; - prop_desc = "Name of tango device implementing the interface of the embedded horizontal corrector."; + prop_name = "CurrentDevice"; + prop_desc = "power supply tango device name"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -507,8 +531,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "CEVDeviceName"; - prop_desc = "Name of tango device implementing the interface of the embedded vertical corrector."; + prop_name = "EmbeddedConfiguration"; + prop_desc = "String descibing the configuration fo the embedded coils. Only three values are valid:\n\npure_sext\nceh_cev\nsext_with_skew\nbba_ready\n\n\nDepending on the EbenddedConfiguration the appropriate numebr of proxies for power supplies and calibration models is built."; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -520,8 +544,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "PsCehDeviceName"; - prop_desc = "Name of the tango device of powering the embbedded horizontal corrector / embedded skew quadrupole."; + prop_name = "MagnetName"; + prop_desc = "Name of magnet"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -533,8 +557,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "PsCevDeviceName"; - prop_desc = "Name of the tango device of powering the embbedded vertical corrector."; + prop_name = "Model"; + prop_desc = "corrector model (part number)"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -559,8 +583,21 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "CEHCalibrationFileName"; - prop_desc = "name of calibration table file name for horizontal embedded corrector - to be review3d when real calibrtaion tablles wil be available"; + prop_name = "PsCehDeviceName"; + prop_desc = "Name of the tango device of powering the embbedded horizontal corrector / embedded skew quadrupole."; + prop_def = ""; + vect_data.clear(); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); + prop_name = "PsCevDeviceName"; + prop_desc = "Name of the tango device of powering the embbedded vertical corrector."; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -585,8 +622,8 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); - prop_name = "CEVCalibrationFileName"; - prop_desc = "name of calibration table file name for vertical embedded corrector - to be reviewed when real calibration tables wil be available"; + prop_name = "SerialNumber"; + prop_desc = "serial number of the magnet"; prop_def = ""; vect_data.clear(); if (prop_def.length()>0) @@ -598,6 +635,20 @@ void E2SextupoleClass::set_default_property() } else add_wiz_dev_prop(prop_name, prop_desc); + prop_name = "SkewQuad"; + prop_desc = "True if the magnet is cabled with embbedd skew quadrupole QS . In this configuration the emmbedd horizontal corrector CEH is not available."; + prop_def = "False"; + vect_data.clear(); + vect_data.push_back("False"); + if (prop_def.length()>0) + { + Tango::DbDatum data(prop_name); + data << vect_data ; + dev_def_prop.push_back(data); + add_wiz_dev_prop(prop_name, prop_desc, prop_def); + } + else + add_wiz_dev_prop(prop_name, prop_desc); } //-------------------------------------------------------- diff --git a/src/E2SextupoleClass.h b/src/E2SextupoleClass.h index e7651d3..4436a82 100644 --- a/src/E2SextupoleClass.h +++ b/src/E2SextupoleClass.h @@ -449,6 +449,9 @@ class E2SextupoleClass : public Tango::DeviceClass public: // Class properties data members + // BbaSwitchDeviceName: Tango device name exporting the interface to the BBA switches. + // Part of Elettra 2.0 MPS (Interlock) system + std::string bbaSwitchDeviceName; // BeamEnergy: default electron beam energy, in GeV. // Use to initialize all magnet istances BeamEnergy attribute. Tango::DevDouble beamEnergy; -- GitLab