-
Claudio Scafuri authored193b94f7
SimulatedE2PS.h 8.40 KiB
/*----- PROTECTED REGION ID(SimulatedE2PS.h) ENABLED START -----*/
/* clang-format on */
//=============================================================================
//
// file : SimulatedE2PS.h
//
// description : Include file for the SimulatedE2PS class
//
// project : SimulatedE2PS
//
// This file is part of Tango device class.
//
// Tango is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Tango is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Tango. If not, see <http://www.gnu.org/licenses/>.
//
//
//
//=============================================================================
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//=============================================================================
#ifndef SimulatedE2PS_H
#define SimulatedE2PS_H
#include <tango/tango.h>
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // SimulatedE2PS.h
#ifdef TANGO_LOG
// cppTango after c934adea (Merge branch 'remove-cout-definition' into 'main', 2022-05-23)
// nothing to do
#else
// cppTango 9.3-backports and older
#define TANGO_LOG cout
#define TANGO_LOG_INFO cout2
#define TANGO_LOG_DEBUG cout3
#endif // TANGO_LOG
/**
* SimulatedE2PS class description:
* Simulated power supply for Elettra 2.0 tests (digiltal twin).
* Tango interface Loosely based on NGPS tango device
*/
namespace SimulatedE2PS_ns
{
/*----- PROTECTED REGION ID(SimulatedE2PS::Additional Class Declarations) ENABLED START -----*/
/* clang-format on */
// Additional Class Declarations
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // SimulatedE2PS::Additional Class Declarations
class SimulatedE2PS : public TANGO_BASE_CLASS
{
/*----- PROTECTED REGION ID(SimulatedE2PS::Data Members) ENABLED START -----*/
/* clang-format on */
// Add your own data members
friend class cyclethread;
protected :
double _current;
double _current_read;
double _current_ripple;
double _voltage;
double _ohm;
bool _busy;
bool _add_ripple;
unsigned int rand_r_seed;
class cyclethread *cycleloop;
bool thread_running;
bool abortflag;
//void psdelay();
Tango::WAttribute *attr_current;
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // SimulatedE2PS::Data Members
// Device property data members
public:
// CurrentRipple: Residual current oscillation [A]
//
// The simulator adds noise of CurrenRipple amplitude to the reading
Tango::DevDouble currentRipple;
// Attribute data members
public:
Tango::DevDouble *attr_current_read;
Tango::DevDouble *attr_voltage_read;
Tango::DevDouble *attr_currentSet_read;
Tango::DevDouble *attr_CurrentRipple_read;
Tango::DevBoolean *attr_AddRipple_read;
// Constructors and destructors
public:
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
SimulatedE2PS(Tango::DeviceClass *cl,std::string &s);
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device Name
*/
SimulatedE2PS(Tango::DeviceClass *cl,const char *s);
/**
* Constructs a newly device object.
*
* @param cl Class.
* @param s Device name
* @param d Device description.
*/
SimulatedE2PS(Tango::DeviceClass *cl,const char *s,const char *d);
/**
* The device object destructor.
*/
~SimulatedE2PS();
// Miscellaneous methods
public:
/*
* will be called at device destruction or at init command.
*/
void delete_device();
/*
* Initialize the device
*/
virtual void init_device();
/*
* Read the device properties from database
*/
void get_device_property();
/*
* Always executed method before execution command method.
*/
virtual void always_executed_hook();
// Attribute methods
public:
//--------------------------------------------------------
/*
* Method : SimulatedE2PS::read_attr_hardware()
* Description: Hardware acquisition for attributes.
*/
//--------------------------------------------------------
virtual void read_attr_hardware(std::vector<long> &attr_list);
//--------------------------------------------------------
/*
* Method : SimulatedE2PS::write_attr_hardware()
* Description: Hardware writing for attributes.
*/
//--------------------------------------------------------
virtual void write_attr_hardware(std::vector<long> &attr_list);
/**
* Attribute current related methods
* Description: The powersupply current setting in amps
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_current(Tango::Attribute &attr);
virtual void write_current(Tango::WAttribute &attr);
virtual bool is_current_allowed(Tango::AttReqType type);
/**
* Attribute voltage related methods
* Description: The powersupply voltage in volts.
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_voltage(Tango::Attribute &attr);
virtual bool is_voltage_allowed(Tango::AttReqType type);
/**
* Attribute currentSet related methods
* Description: The current set value as stored in the powersupply.
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_currentSet(Tango::Attribute &attr);
virtual bool is_currentSet_allowed(Tango::AttReqType type);
/**
* Attribute CurrentRipple related methods
* Description: Amplitude of current ripple (noise) added to output.
* Initial value from property CurrentRipple
*
* Data type: Tango::DevDouble
* Attr type: Scalar
*/
virtual void read_CurrentRipple(Tango::Attribute &attr);
virtual void write_CurrentRipple(Tango::WAttribute &attr);
virtual bool is_CurrentRipple_allowed(Tango::AttReqType type);
/**
* Attribute AddRipple related methods
* Description: Switch on/off current ripple. If False the power supply is ideal :no noise.
*
* Data type: Tango::DevBoolean
* Attr type: Scalar
*/
virtual void read_AddRipple(Tango::Attribute &attr);
virtual void write_AddRipple(Tango::WAttribute &attr);
virtual bool is_AddRipple_allowed(Tango::AttReqType type);
//--------------------------------------------------------
/**
* Method : SimulatedE2PS::add_dynamic_attributes()
* Description: Add dynamic attributes if any.
*/
//--------------------------------------------------------
void add_dynamic_attributes();
// Command related methods
public:
/**
* Command On related method
* Description: Switch powersupply ON.
*
*/
virtual void on();
virtual bool is_On_allowed(const CORBA::Any &any);
/**
* Command Off related method
* Description: Switch power supply OFF.
*
*/
virtual void off();
virtual bool is_Off_allowed(const CORBA::Any &any);
/**
* Command Reset related method
* Description: Reset the powersupply to a well known state.
*
*/
virtual void reset();
virtual bool is_Reset_allowed(const CORBA::Any &any);
/**
* Command StartCycling related method
*
*
*/
virtual void start_cycling();
virtual bool is_StartCycling_allowed(const CORBA::Any &any);
/**
* Command Abort related method
* Description: stop ramp or cycling
*
*/
virtual void abort();
virtual bool is_Abort_allowed(const CORBA::Any &any);
/**
* Command Fault related method
* Description: Force a simulated faulty condtion
*
*/
virtual void fault();
virtual bool is_Fault_allowed(const CORBA::Any &any);
//--------------------------------------------------------
/**
* Method : SimulatedE2PS::add_dynamic_commands()
* Description: Add dynamic commands if any.
*/
//--------------------------------------------------------
void add_dynamic_commands();
/*----- PROTECTED REGION ID(SimulatedE2PS::Additional Method prototypes) ENABLED START -----*/
/* clang-format on */
// Additional Method prototypes
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // SimulatedE2PS::Additional Method prototypes
};
/*----- PROTECTED REGION ID(SimulatedE2PS::Additional Classes Definitions) ENABLED START -----*/
/* clang-format on */
// Additional Classes Definitions
/* clang-format off */
/*----- PROTECTED REGION END -----*/ // SimulatedE2PS::Additional Classes Definitions
} // End of namespace
#endif // SimulatedE2PS_H