Commit b4deadc7 authored by Abdelali Elaazzouzi's avatar Abdelali Elaazzouzi

new hp controller from sane

parent 5b42a19d
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include "HPStickController.h"
#include "Utilities/Counter.h"
using namespace std;
namespace sampletemperature {
const string HPStickController::TYPE = "hpstick";
/*
* Constructor
*/
HPStickController::HPStickController(const string& name) :
SampleTemperatureController(name) {
stickTemp.init(this, NOSAVE | SPY, "sticktemp", "stickTemp");
vacuum.init(this, NOSAVE | SPY, "vacuum", "Vacuum");
vacuum.setUnit("mbar");
registerFunction(TYPE);
}
/*
* Destructor
*/
HPStickController::~HPStickController() {
// Empty
}
/*
* postConfiguration
*/
void HPStickController::postConfiguration() {
SampleTemperatureController::postConfiguration();
stickTemp.setUnit(temperatureUnit());
registerUpdater(m_SampleDriver->vacuum, &HPStickController::updateVacuum, this);
registerUpdater(m_SampleDriver->temp3, &HPStickController::updatestickTemp, this);
updateVacuum();
updatestickTemp();
}
/*
* updateTemp3
*/
void HPStickController::updatestickTemp() {
SampleTemperatureController::updateTemp3();
stickTemp.update(temp3Temperature());
}
/*
* updateColdValvePressure
*/
void HPStickController::updateVacuum() {
vacuum.update(m_SampleDriver->vacuum());
}
}
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef HPStickCONTROLLER_H
#define HPStickCONTROLLER_H
#include "SampleTemperatureController.h"
namespace sampletemperature {
/*!
* \class
* \brief Class described
*/
class HPStickController: public SampleTemperatureController {
public:
//! Type of controller
static const std::string TYPE;
/*!
* \brief Constructor
* \param[in] name the name of the experiment controller
*/
HPStickController(const std::string& name);
/*!
* \brief Destructor
*/
virtual ~HPStickController();
/*!
* \brief Method called before changing the property value
*
* This method is called after setting configuration during the creation of controller.
*/
virtual void postConfiguration();
/*!
* Properties
*/
Property<float64> stickTemp;
Property<float64> vacuum;
private:
void updateVacuum();
void updatestickTemp();
};
}
#endif //CRYOSTATORANGECONTROLLER_H
......@@ -5,6 +5,7 @@
<controller class="sampletemperature::DisplexPlusController"/>
<controller class="sampletemperature::FurnaceController"/>
<controller class="sampletemperature::GhsdiController"/>
<controller class="sampletemperature::HPStickController"/>
<controller class="sampletemperature::SampleTemperatureController"/>
<controller class="sampletemperature::CryostatOrangeDualExchanger"/>
</module>
# Spy
hpstick.SamplePrefix=Sample
hpstick.RegulationPrefix=Regulation
hpstick.SetPointPrefix=SetPoint
hpstick.WantedPrefix=Wanted
hpstick.temperatureSwitcher=Temperatures
# Command
hpstick.wantedTemperaturePrefix=Temperature
##########
# Settings
hpstick.second=s
# Status
hpstick.setPointTempPrefix=SetPoint Temperature
hpstick.regulationTempPrefix=Regulation Temperature
hpstick.sampleTempPrefix=Sample Temperature
hpstick.cryostatRegulationTempPrefix=Cryostat Temperature
hpstick.stickTempPrefix=Stick Temperature
hpstick.vacuumPrefix=Vacuum
# Temperature group
hpstick.temperatureTitle=Temperature Control
hpstick.wantedTempPrefix=Temperature Setpoint
hpstick.rampModePrefix=Ramp Mode
hpstick.deltaPrefix=~Delta
# Ramp mode
hpstick.noneRampValue=none
hpstick.setpointRampValue=setpoint
hpstick.regulationRampValue=regulation
hpstick.sampleRampValue=sample
hpstick.noneRampLabel=None
hpstick.setpointRampLabel=SetPoint
hpstick.regulationRampLabel=Regulation
hpstick.sampleRampLabel=Sample
# Temperature Param group
hpstick.tempParamTitle=Temperature Parameters
hpstick.maxTempPrefix=Maximum Temperature
hpstick.minTempPrefix=Minimum Temperature
hpstick.tolerancePrefix=Tolerance (+/-)
hpstick.tolModePrefix=on
hpstick.sampleTolLabel=Sample sensor
hpstick.sampleTolValue=sample
hpstick.regulationTolLabel=Regulation sensor
hpstick.regulationTolValue=regulation
hpstick.timeoutPrefix=Time Out
hpstick.stabilisationPrefix=Stabilisation
# Check Button
hpstick.timeoutCheckedValue=true
hpstick.timeoutUncheckedValue=false
hpstick.stabilisationCheckedValue=true
hpstick.stabilisationUncheckedValue=false
# Radio buttons h/m/s
hpstick.hValue=h
hpstick.hLabel=h
hpstick.mValue=m
hpstick.mLabel=m
hpstick.sValue=s
hpstick.sLabel=s
<plugin>
<controller type="hpstick" role="hpstick1"/>
<number_of_lines nb_lines="3"/>
<!-- Force set values order (PID2 requirement) -->
<property role="hpstick1" property="wanted_temperature" save_value="true"/>
<property role="hpstick1" property="sample_temperature"/>
<property role="hpstick1" property="ramp_mode" save_value="true"/>
<property role="hpstick1" property="ramp_speed" save_value="true"/>
<property role="hpstick1" property="ramp_time" save_value="true"/>
<property role="hpstick1" property="use_timeout" save_value="true"/>
<property role="hpstick1" property="timeout" save_value="true"/>
<property role="hpstick1" property="timeout_type" save_value="true"/>
<property role="hpstick1" property="use_stabilisation" save_value="true"/>
<property role="hpstick1" property="stabilisation" save_value="true"/>
<property role="hpstick1" property="stabilisation_type" save_value="true"/>
<property role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin"/>
<property role="hpstick1" property="tolerance"/>
<property role="hpstick1" property="allow_user_tolerance"/>
<property role="hpstick1" property="user_tolerance" save_value="true"/>
<property role="hpstick1" property="use_pid2"/>
<property role="hpstick1" property="pid2_active" save_value="true"/>
<property role="hpstick1" property="use_fastmode" save_value="true"/>
<property_switcher role="hpstick1" property="ramp_mode" switcher_key="ramp_modeSwitcher"/>
<property_switcher role="hpstick1" property="allow_user_tolerance" switcher_key="allow_user_toleranceSwitcher"/>
<text role="hpstick1" property="wanted_temperature" prefix="hpstick.wantedTemperaturePrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<switchable_composite switcher_key="allow_user_toleranceSwitcher" switch_values="true">
<text role="hpstick1" property="user_tolerance" prefix="hpstick.tolerancePrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
</switchable_composite>
<newLine/>
<switchable_composite switcher_key="pid2ActiveSwitcher" switch_values="false">
<combo role="hpstick1" property="ramp_mode" prefix="hpstick.rampModePrefix" valuesAndLabels="hpstick.noneRamp,hpstick.setpointRamp,hpstick.regulationRamp,hpstick.sampleRamp"/>
<switchable_composite switch_values="regulation,sample,setpoint" switcher_key="ramp_modeSwitcher">
<text role="hpstick1" property="ramp_speed" prefix="hpstick.deltaPrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<text role="hpstick1" property="ramp_time" suffix="hpstick.second"/>
</switchable_composite>
</switchable_composite>
<newLine/>
<property_switcher role="hpstick1" property="use_stabilisation" switcher_key="stabilisationSwitcher"/>
<check role="hpstick1" property="use_stabilisation" prefix="hpstick.stabilisationPrefix" checkBoxValues="hpstick.stabilisation"/>
<switchable_composite switcher_key="stabilisationSwitcher" switch_values="true">
<text role="hpstick1" property="stabilisation"/>
<radio role="hpstick1" property="stabilisation_type" valuesAndLabels="hpstick.h,hpstick.m,hpstick.s" spaceBefore="false"/>
</switchable_composite>
<property_switcher role="hpstick1" property="use_timeout" switcher_key="timeoutSwitcher"/>
<check role="hpstick1" property="use_timeout" prefix="hpstick.timeoutPrefix" checkBoxValues="hpstick.timeout"/>
<switchable_composite switcher_key="timeoutSwitcher" switch_values="true">
<text role="hpstick1" property="timeout"/>
<radio role="hpstick1" property="timeout_type" valuesAndLabels="hpstick.h,hpstick.m,hpstick.s" spaceBefore="false"/>
</switchable_composite>
<construction>
<simple_image prefix="LEFT_TO_RIGHT_ARROW"/>
<label role="hpstick1" property="wanted_temperature"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
</construction>
<running>
<label role="hpstick1" property="sample_temperature"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<simple_image prefix="LEFT_TO_RIGHT_ARROW"/>
<label role="hpstick1" property="wanted_temperature"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
</running>
<finished>
<simple_image prefix="TICK"/>
<label role="hpstick1" property="wanted_temperature"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
</finished>
</plugin>
<controller_plugin_config type="hpstick">
<image key="CRYOSTAT_ORANGE"/>
<settings view="hpstickView.xml"/>
<command view="hpstickCommandView.xml" backgroundable="true"/>
</controller_plugin_config>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<controller type="hpstick">
<property name="use_timeout" type="Boolean">
</property>
<property name="timeout" type="int32" max_length="6">
<strictly_positive/>
</property>
<property name="timeout_type" type="String">
<specific_values values="h,m,s"/>
</property>
<property name="use_stabilisation" type="Boolean">
</property>
<property name="stabilisation" type="int32" max_length="6">
<strictly_positive/>
</property>
<property name="stabilisation_type" type="String">
<specific_values values="h,m,s"/>
</property>
<property name="regulation_temperature" type="float64" max_length="7">
<decimal_format nb_decimal_places="3"/>
<positive/>
</property>
<property name="sticktemp" type="float64" max_length="7">
<decimal_format nb_decimal_places="3"/>
</property>
<property name="vacuum" type="float64" max_length="7">
<decimal_format nb_decimal_places="3"/>
</property>
<property name="wanted_temperature" type="float64" max_length="7">
<property_range min_property="min_temperature" max_property="max_temperature"/>
<decimal_format nb_decimal_places="3"/>
<positive/>
</property>
<property name="temperature_unit" type="String" max_length="2">
</property>
<property name="sample_temperature" type="float64" max_length="7">
<decimal_format nb_decimal_places="3"/>
</property>
<property name="max_temperature" type="float64" max_length="7">
<decimal_format nb_decimal_places="3"/>
<positive/>
</property>
<property name="min_temperature" type="float64" max_length="7">
<decimal_format nb_decimal_places="3"/>
<positive/>
</property>
<property name="tolerance" type="float64" max_length="6">
<decimal_format nb_decimal_places="3"/>
<positive/>
</property>
<property name="tolerance_mode" type="String">
</property>
<property name="ramp_speed" type="float64" max_length="6">
<decimal_format nb_decimal_places="3"/>
</property>
<property name="ramp_time" type="float64" max_length="6">
<decimal_format nb_decimal_places="0"/>
</property>
<property name="setpoint_temperature" type="float64" max_length="7">
<decimal_format nb_decimal_places="3"/>
</property>
<property name="commandStatus" type="int32">
</property>
<property name="ramp_mode" type="String">
</property>
<property name="allow_user_tolerance" type="Boolean">
</property>
<property name="user_tolerance" type="float64" max_length="5">
<decimal_format nb_decimal_places="3"/>
<positive/>
</property>
<property name="controller_id" type="String" max_length="15">
</property>
<property name="controller_description" type="String" max_length="30">
</property>
</controller>
<plugin>
<controller type="hpstick" role="hpstick1"/>
<property_switcher role="hpstick1" property="ramp_mode" switcher_key="rampModeSwitcher"/>
<property_switcher role="hpstick1" property="use_timeout" switcher_key="timeoutSwitcher"/>
<property_switcher role="hpstick1" property="use_stabilisation" switcher_key="stabilisationSwitcher"/>
<label role="hpstick1" property="controller_id"/>
<label role="hpstick1" property="controller_description"/>
<newLine/>
<group title="hpstick.temperatureTitle">
<text role="hpstick1" property="wanted_temperature" prefix="hpstick.wantedTempPrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<newLine/>
<combo role="hpstick1" property="ramp_mode" prefix="hpstick.rampModePrefix" valuesAndLabels="hpstick.noneRamp,hpstick.setpointRamp,hpstick.regulationRamp,hpstick.sampleRamp"/>
<switchable_composite switcher_key="rampModeSwitcher" switch_values="setpoint,regulation,sample">
<text role="hpstick1" property="ramp_speed" prefix="hpstick.deltaPrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<text role="hpstick1" property="ramp_time" suffix="hpstick.second"/>
</switchable_composite>
<newLine/>
<check role="hpstick1" property="use_timeout" prefix="hpstick.timeoutPrefix" checkBoxValues="hpstick.timeout"/>
<switchable_composite switcher_key="timeoutSwitcher" switch_values="true">
<text role="hpstick1" property="timeout" spaceBefore="false"/>
<radio role="hpstick1" property="timeout_type" valuesAndLabels="hpstick.h,hpstick.m,hpstick.s" spaceBefore="false"/>
</switchable_composite>
<newLine/>
<check role="hpstick1" property="use_stabilisation" prefix="hpstick.stabilisationPrefix" checkBoxValues="hpstick.stabilisation"/>
<switchable_composite switcher_key="stabilisationSwitcher" switch_values="true">
<text role="hpstick1" property="stabilisation" spaceBefore="false"/>
<radio role="hpstick1" property="stabilisation_type" valuesAndLabels="hpstick.h,hpstick.m,hpstick.s" spaceBefore="false"/>
</switchable_composite>
</group>
<newLine/>
<switchable_composite switcher_key="simpleAdvancedModeSwitcher" switch_values="MORE_OPTIONS_BUTTON"/>
<switchable_composite switcher_key="simpleAdvancedModeSwitcher" switch_values="LESS_OPTIONS_BUTTON">
<group title="hpstick.tempParamTitle">
<text role="hpstick1" property="max_temperature" prefix="hpstick.maxTempPrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<text role="hpstick1" property="min_temperature" prefix="hpstick.minTempPrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<newLine/>
<text role="hpstick1" property="tolerance" prefix="hpstick.tolerancePrefix"/>
</group>
<newLine/>
</switchable_composite>
<title>
<graphical_switcher switcher_key="simpleAdvancedModeSwitcher" switcher_type="button"/>
</title>
<summary>
<summary_content>
<label role="hpstick1" property="regulation_temperature" prefix="hpstick.regulationTempPrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<newLine/>
<label role="hpstick1" property="sample_temperature" prefix="hpstick.sampleTempPrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<newLine/>
<label role="hpstick1" property="setpoint_temperature" prefix="hpstick.setPointTempPrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<newLine/>
<label role="hpstick1" property="sticktemp" prefix="hpstick.stickTempPrefix"/>
<label role="hpstick1" property="temperature_unit" valuesAndLabels="temperature.celsius,temperature.kelvin" spaceBefore="false"/>
<newLine/>
<label role="hpstick1" property="vacuum" prefix="hpstick.vacuumPrefix"/>
<newLine/>
<status role="hpstick1" property="commandStatus" valuesImagesAndLabels="commandStatusUnknown,commandStatusIdle,commandStatusRunning,commandStatusWarning,commandStatusError"/>
</summary_content>
</summary>
</plugin>
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef HPSTICKCTRLDEF_H
#define HPSTICKCTRLDEF_H
#include "common/base/BaseTypes.h"
namespace hpstickctrl {
// Cryostat regulation temperature - Read only - float -
static const int32 CRYOSTAT_REGULATION_TEMPERATURE_REGISTER = 1;
// CRYOSTAT setpoint - Read/Write - float -
static const int32 CRYOSTAT_SETPOINT_REGISTER = 3;
// stick regulation temperature - Read only - float -
static const int32 STICK_REGULATION_TEMPERATURE_REGISTER = 5;
// vaccum - Read only - float -
static const int32 VACUUM_REGISTER = 7;
// Sample temperature - Read only - float -
static const int32 SAMPLE_TEMPERATURE_REGISTER = 9;
// nomad flag- Read /write - float -
static const int32 NOMAD_FLAG_REGISTER = 11;
// Equipment status - Read/Write - word 16-bit - %MW550
// bit 0 - Idle -> physical parameter between the tolerance range
// bit 1 - Running -> physical parameter out of the tolerance range
// bit 2 - Remote/local -> remote(false)/local(true)
// bit 3 - Fault -> défaut bloquant pour la manip
static const int32 STATUS_REGISTER = 551;
// Tolerance for idle and running status - Read/Write - float 32-bit - %MW552
static const int32 TOLERANCE_REGISTER = 553;
/*!
* Status
*/
static const int32 HPSTICKCTRL_NO_STATUS = 0;
static const int32 HPSTICKCTRL_IDLE_STATUS = 1;
static const int32 HPSTICKCTRL_RUNNING_STATUS = 2;
static const int32 HPSTICKCTRL_REMOTE_LOCAL_STATUS = 4;
static const int32 HPSTICKCTRL_FAULT_STATUS = 8;
}
#endif //HPSTICKCTRLDEF_H
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include <drivers/ill/sane/hpctickctrl/HPStickCtrlDef.h>
#include <drivers/ill/sane/hpctickctrl/HPStickCtrlDriver.h>
#include <drivers/ill/sane/hpctickctrl/HPStickCtrlState.h>
#include <drivers/ill/sane/hpctickctrl/PerfectHPStickCtrlDriver.h>
#include <drivers/ill/sane/hpctickctrl/RealHPStickCtrlDriver.h>
#include <drivers/ill/sane/hpctickctrl/SimulatedHPStickCtrlDriver.h>
// Trace include
using namespace boost;
namespace hpstickctrl {
const std::string HPStickCtrlDriver::TYPE = "HPStickCtrl";
/*
* Constructor
*/
HPStickCtrlDriver::HPStickCtrlDriver(const std::string& name) :
sampletemperature::SampleTemperatureCommon(name) {
driver::ModBusTCP::init(name);
simulatedLocalMode.init(this, SAVE, "simulated_localmode");