Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SY2527Channel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Tango devices
PowerSupply
SY2527Channel
Commits
9cdf5c5a
Commit
9cdf5c5a
authored
Sep 7, 2007
by
Sebastien Leport
Browse files
Options
Downloads
Patches
Plain Diff
- add position_in_crate (vector) data member
parent
82057927
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/SY2527Channel.cpp
+308
-329
308 additions, 329 deletions
src/SY2527Channel.cpp
src/SY2527Channel.h
+10
-2
10 additions, 2 deletions
src/SY2527Channel.h
with
318 additions
and
331 deletions
src/SY2527Channel.cpp
+
308
−
329
View file @
9cdf5c5a
static
const
char
*
RcsId
=
"$Header: /users/chaize/newsvn/cvsroot/Instrumentation/SY2527Channel/src/SY2527Channel.cpp,v 1.
5
2007-09-0
6 09:21:12
sebleport Exp $"
;
static
const
char
*
RcsId
=
"$Header: /users/chaize/newsvn/cvsroot/Instrumentation/SY2527Channel/src/SY2527Channel.cpp,v 1.
6
2007-09-0
7 13:14:56
sebleport Exp $"
;
//+=============================================================================
//+=============================================================================
//
//
// file : SY2527Channel.cpp
// file : SY2527Channel.cpp
...
@@ -13,9 +13,14 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
...
@@ -13,9 +13,14 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
//
//
// $Author: sebleport $
// $Author: sebleport $
//
//
// $Revision: 1.
5
$
// $Revision: 1.
6
$
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
// Revision 1.5 2007/09/06 09:21:12 sebleport
// - shiftVoltage changed by deltaVoltage attribute
// - add OFF state
// - RUNNING state priority has changed
//
// Revision 1.4 2007/09/06 09:13:44 sebleport
// Revision 1.4 2007/09/06 09:13:44 sebleport
// - shiftVoltage changed by deltaVoltage attribute
// - shiftVoltage changed by deltaVoltage attribute
// - add OFF state
// - add OFF state
...
@@ -78,21 +83,18 @@ SY2527Channel::SY2527Channel(Tango::DeviceClass *cl,string &s)
...
@@ -78,21 +83,18 @@ SY2527Channel::SY2527Channel(Tango::DeviceClass *cl,string &s)
:
Tango
::
Device_3Impl
(
cl
,
s
.
c_str
())
:
Tango
::
Device_3Impl
(
cl
,
s
.
c_str
())
{
{
init_device
();
init_device
();
SY2527_crate_proxy
=
0
;
}
}
SY2527Channel
::
SY2527Channel
(
Tango
::
DeviceClass
*
cl
,
const
char
*
s
)
SY2527Channel
::
SY2527Channel
(
Tango
::
DeviceClass
*
cl
,
const
char
*
s
)
:
Tango
::
Device_3Impl
(
cl
,
s
)
:
Tango
::
Device_3Impl
(
cl
,
s
)
{
{
init_device
();
init_device
();
SY2527_crate_proxy
=
0
;
}
}
SY2527Channel
::
SY2527Channel
(
Tango
::
DeviceClass
*
cl
,
const
char
*
s
,
const
char
*
d
)
SY2527Channel
::
SY2527Channel
(
Tango
::
DeviceClass
*
cl
,
const
char
*
s
,
const
char
*
d
)
:
Tango
::
Device_3Impl
(
cl
,
s
,
d
)
:
Tango
::
Device_3Impl
(
cl
,
s
,
d
)
{
{
init_device
();
init_device
();
SY2527_crate_proxy
=
0
;
}
}
//+----------------------------------------------------------------------------
//+----------------------------------------------------------------------------
//
//
...
@@ -106,6 +108,8 @@ void SY2527Channel::delete_device()
...
@@ -106,6 +108,8 @@ void SY2527Channel::delete_device()
// Delete device's allocated object
// Delete device's allocated object
DELETE_SCALAR_ATTRIBUTE
(
attr_voltage_read
);
DELETE_SCALAR_ATTRIBUTE
(
attr_voltage_read
);
position_in_crate
.
clear
();
}
}
//+----------------------------------------------------------------------------
//+----------------------------------------------------------------------------
...
@@ -121,11 +125,17 @@ void SY2527Channel::init_device()
...
@@ -121,11 +125,17 @@ void SY2527Channel::init_device()
// Initialise variables to default values
// Initialise variables to default values
//--------------------------------------------
//--------------------------------------------
SY2527_crate_proxy
=
0
;
message
=
""
;
get_device_property
();
get_device_property
();
CREATE_SCALAR_ATTRIBUTE
(
attr_voltage_read
);
CREATE_SCALAR_ATTRIBUTE
(
attr_voltage_read
);
}
// initialise array of parameters for Proxy commands
position_in_crate
.
push_back
(
slotNumber
);
position_in_crate
.
push_back
(
channelNumber
);
}
//+----------------------------------------------------------------------------
//+----------------------------------------------------------------------------
//
//
...
@@ -139,8 +149,11 @@ void SY2527Channel::get_device_property()
...
@@ -139,8 +149,11 @@ void SY2527Channel::get_device_property()
// Initialize your default values here (if not done with POGO).
// Initialize your default values here (if not done with POGO).
//------------------------------------------------------------------
//------------------------------------------------------------------
long
def_slotNumber
=
444
;
// defaut values are impossible to oblige user to define correct values
long
def_channelNumber
=
444
;
const
long
IMPOSSIBLE_VALUE
=
-
1
;
long
def_slotNumber
=
IMPOSSIBLE_VALUE
;
long
def_channelNumber
=
IMPOSSIBLE_VALUE
;
// Read device properties from database.(Automatic code generation)
// Read device properties from database.(Automatic code generation)
//------------------------------------------------------------------
//------------------------------------------------------------------
...
@@ -232,13 +245,13 @@ void SY2527Channel::get_device_property()
...
@@ -232,13 +245,13 @@ void SY2527Channel::get_device_property()
get_db_device
()
->
put_property
(
db_d
);
get_db_device
()
->
put_property
(
db_d
);
if
(
sY2527CrateProxyName
==
"none"
)
if
(
(
sY2527CrateProxyName
==
"none"
)
||
(
slotNumber
==
def_slotNumber
)
||
(
channelNumber
==
def_channelNumber
))
{
{
ERROR_STREAM
<<
" sY2527CrateProxyName property is missing "
<<
endl
;
message
=
" sY2527CrateProxyName property are wrong. Check device properties "
;
ERROR_STREAM
<<
message
<<
endl
;
}
}
INFO_STREAM
<<
"slot number: "
<<
slotNumber
<<
endl
;
INFO_STREAM
<<
"slot number: "
<<
slotNumber
<<
endl
;
INFO_STREAM
<<
"channel number: "
<<
channelNumber
<<
endl
;
INFO_STREAM
<<
"channel number: "
<<
channelNumber
<<
endl
;
}
}
...
@@ -252,15 +265,10 @@ void SY2527Channel::get_device_property()
...
@@ -252,15 +265,10 @@ void SY2527Channel::get_device_property()
void
SY2527Channel
::
always_executed_hook
()
void
SY2527Channel
::
always_executed_hook
()
{
{
if
(
SY2527_crate_proxy
==
0
)
if
(
SY2527_crate_proxy
==
0
)
{
try
{
{
SY2527_crate_proxy
=
new
Tango
::
DeviceProxyHelper
(
this
->
sY2527CrateProxyName
,
this
);
SY2527_crate_proxy
=
new
Tango
::
DeviceProxyHelper
(
this
->
sY2527CrateProxyName
,
this
);
if
(
SY2527_crate_proxy
==
0
)
if
(
SY2527_crate_proxy
==
0
)
throw
std
::
bad_alloc
();
}
catch
(
std
::
bad_alloc
&
)
{
{
Tango
::
Except
::
throw_exception
(
Tango
::
Except
::
throw_exception
(
static_cast
<
const
char
*>
(
"OUT_OF_MEMORY"
),
static_cast
<
const
char
*>
(
"OUT_OF_MEMORY"
),
...
@@ -268,6 +276,7 @@ void SY2527Channel::always_executed_hook()
...
@@ -268,6 +276,7 @@ void SY2527Channel::always_executed_hook()
static_cast
<
const
char
*>
(
"SY2527Channel::always_executed_hook"
)
static_cast
<
const
char
*>
(
"SY2527Channel::always_executed_hook"
)
);
);
}
}
}
}
}
}
//+----------------------------------------------------------------------------
//+----------------------------------------------------------------------------
...
@@ -309,17 +318,15 @@ void SY2527Channel::write_deltaVoltage(Tango::WAttribute &attr)
...
@@ -309,17 +318,15 @@ void SY2527Channel::write_deltaVoltage(Tango::WAttribute &attr)
double
presetVoltage
=
attr_voltage_write
+
attr_deltaVoltage_write
;
double
presetVoltage
=
attr_voltage_write
+
attr_deltaVoltage_write
;
Tango
::
DevVarDoubleArray
*
argin
=
new
Tango
::
DevVarDoubleArray
;
vector
<
double
>
set_delta_voltage_array
;
argin
->
length
(
3
);
(
*
argin
)[
0
]
=
slotNumber
;
set_delta_voltage_array
.
push_back
(
slotNumber
)
;
(
*
argin
)[
1
]
=
channelNumber
;
set_delta_voltage_array
.
push_back
(
channelNumber
)
;
(
*
argin
)[
2
]
=
presetVoltage
;
set_delta_voltage_array
.
push_back
(
presetVoltage
)
;
try
try
{
{
SY2527_crate_proxy
->
command_in
(
"SetVoltageOnChannel"
,
argin
);
SY2527_crate_proxy
->
command_in
(
"SetVoltageOnChannel"
,
set_delta_voltage_array
);
}
}
catch
(
Tango
::
DevFailed
&
df
)
catch
(
Tango
::
DevFailed
&
df
)
{
{
...
@@ -346,15 +353,9 @@ void SY2527Channel::read_voltage(Tango::Attribute &attr)
...
@@ -346,15 +353,9 @@ void SY2527Channel::read_voltage(Tango::Attribute &attr)
{
{
DEBUG_STREAM
<<
"SY2527Channel::read_voltage(Tango::Attribute &attr) entering... "
<<
endl
;
DEBUG_STREAM
<<
"SY2527Channel::read_voltage(Tango::Attribute &attr) entering... "
<<
endl
;
Tango
::
DevVarShortArray
*
argin
=
new
Tango
::
DevVarShortArray
;
argin
->
length
(
2
);
(
*
argin
)[
0
]
=
slotNumber
;
(
*
argin
)[
1
]
=
channelNumber
;
try
try
{
{
SY2527_crate_proxy
->
command_inout
(
"GetMeasVoltageOnChannel"
,
argin
,
*
attr_voltage_read
);
SY2527_crate_proxy
->
command_inout
(
"GetMeasVoltageOnChannel"
,
position_in_crate
,
*
attr_voltage_read
);
attr
.
set_value
(
attr_voltage_read
);
attr
.
set_value
(
attr_voltage_read
);
attr
.
set_quality
(
Tango
::
ATTR_VALID
);
attr
.
set_quality
(
Tango
::
ATTR_VALID
);
...
@@ -389,17 +390,15 @@ void SY2527Channel::write_voltage(Tango::WAttribute &attr)
...
@@ -389,17 +390,15 @@ void SY2527Channel::write_voltage(Tango::WAttribute &attr)
attr
.
get_write_value
(
attr_voltage_write
);
attr
.
get_write_value
(
attr_voltage_write
);
Tango
::
DevVarDoubleArray
*
argin
=
new
Tango
::
DevVarDoubleArray
;
vector
<
double
>
set_voltage_array
;
argin
->
length
(
3
);
(
*
argin
)[
0
]
=
slotNumber
;
set_voltage_array
.
push_back
(
slotNumber
)
;
(
*
argin
)[
1
]
=
channelNumber
;
set_voltage_array
.
push_back
(
channelNumber
)
;
(
*
argin
)[
2
]
=
attr_voltage_write
;
set_voltage_array
.
push_back
(
attr_voltage_write
)
;
try
try
{
{
SY2527_crate_proxy
->
command_in
(
"SetVoltageOnChannel"
,
argin
);
SY2527_crate_proxy
->
command_in
(
"SetVoltageOnChannel"
,
set_voltage_array
);
}
}
catch
(
Tango
::
DevFailed
&
df
)
catch
(
Tango
::
DevFailed
&
df
)
...
@@ -431,16 +430,9 @@ void SY2527Channel::power_on()
...
@@ -431,16 +430,9 @@ void SY2527Channel::power_on()
// Add your own code to control device here
// Add your own code to control device here
Tango
::
DevVarUShortArray
*
argin
=
new
Tango
::
DevVarUShortArray
;
argin
->
length
(
2
);
(
*
argin
)[
0
]
=
slotNumber
;
(
*
argin
)[
1
]
=
channelNumber
;
try
try
{
{
SY2527_crate_proxy
->
command_in
(
"PowerOnChannel"
,
argin
);
SY2527_crate_proxy
->
command_in
(
"PowerOnChannel"
,
position_in_crate
);
}
}
catch
(
Tango
::
DevFailed
&
df
)
catch
(
Tango
::
DevFailed
&
df
)
{
{
...
@@ -470,17 +462,9 @@ void SY2527Channel::power_off()
...
@@ -470,17 +462,9 @@ void SY2527Channel::power_off()
DEBUG_STREAM
<<
"SY2527Channel::power_off(): entering... !"
<<
endl
;
DEBUG_STREAM
<<
"SY2527Channel::power_off(): entering... !"
<<
endl
;
// Add your own code to control device here
// Add your own code to control device here
Tango
::
DevVarUShortArray
*
argin
=
new
Tango
::
DevVarUShortArray
;
argin
->
length
(
2
);
(
*
argin
)[
0
]
=
slotNumber
;
(
*
argin
)[
1
]
=
channelNumber
;
try
try
{
{
SY2527_crate_proxy
->
command_in
(
"PowerOffChannel"
,
argin
);
SY2527_crate_proxy
->
command_in
(
"PowerOffChannel"
,
position_in_crate
);
}
}
catch
(
Tango
::
DevFailed
&
df
)
catch
(
Tango
::
DevFailed
&
df
)
{
{
...
@@ -514,22 +498,15 @@ Tango::DevState SY2527Channel::dev_state()
...
@@ -514,22 +498,15 @@ Tango::DevState SY2527Channel::dev_state()
Tango
::
DevState
state_to_return
;
Tango
::
DevState
state_to_return
;
std
::
stringstream
s
;
std
::
stringstream
s
;
// concatenate internal message string
s
<<
message
<<
endl
;
//Tango::DevUShort argout;
Tango
::
DevUShort
status_byte
;
unsigned
short
argout
;
short
status_byte
;
Tango
::
DevVarUShortArray
*
argin
=
new
Tango
::
DevVarUShortArray
;
argin
->
length
(
2
);
(
*
argin
)[
0
]
=
slotNumber
;
(
*
argin
)[
1
]
=
channelNumber
;
// try to get channel status byte
try
try
{
{
SY2527_crate_proxy
->
command_inout
(
"GetChannelStatus"
,
argin
,
argout
);
SY2527_crate_proxy
->
command_inout
(
"GetChannelStatus"
,
position_in_crate
,
status_byte
);
}
}
catch
(
Tango
::
DevFailed
&
df
)
catch
(
Tango
::
DevFailed
&
df
)
{
{
...
@@ -549,7 +526,7 @@ Tango::DevState SY2527Channel::dev_state()
...
@@ -549,7 +526,7 @@ Tango::DevState SY2527Channel::dev_state()
return
state_to_return
;
return
state_to_return
;
}
}
status_byte
=
argout
;
// Manage the returned value
// STANDBY State
// STANDBY State
if
(
status_byte
&
0x01
)
// bit 0
if
(
status_byte
&
0x01
)
// bit 0
...
@@ -566,12 +543,12 @@ Tango::DevState SY2527Channel::dev_state()
...
@@ -566,12 +543,12 @@ Tango::DevState SY2527Channel::dev_state()
// RUNNING State
// RUNNING State
if
(
status_byte
&
0x02
)
// bit 1
if
(
status_byte
&
0x02
)
// bit 1
{
{
s
<<
"Channel is r
u
mping up"
<<
endl
;
s
<<
"Channel is r
a
mping up"
<<
endl
;
state_to_return
=
Tango
::
RUNNING
;
state_to_return
=
Tango
::
RUNNING
;
}
}
if
(
status_byte
&
0x04
)
// bit 2
if
(
status_byte
&
0x04
)
// bit 2
{
{
s
<<
"Channel is r
u
mping down"
<<
endl
;
s
<<
"Channel is r
a
mping down"
<<
endl
;
state_to_return
=
Tango
::
RUNNING
;
state_to_return
=
Tango
::
RUNNING
;
}
}
...
@@ -613,7 +590,9 @@ Tango::DevState SY2527Channel::dev_state()
...
@@ -613,7 +590,9 @@ Tango::DevState SY2527Channel::dev_state()
state_to_return
=
Tango
::
FAULT
;
state_to_return
=
Tango
::
FAULT
;
}
}
// NO corresponding state
// NO corresponding state because transient conditions
// this bit should not change Tango state
if
(
status_byte
&
0x40
)
// bit 6
if
(
status_byte
&
0x40
)
// bit 6
{
{
s
<<
"Channel is in external trip "
<<
endl
;
s
<<
"Channel is in external trip "
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
src/SY2527Channel.h
+
10
−
2
View file @
9cdf5c5a
...
@@ -8,9 +8,14 @@
...
@@ -8,9 +8,14 @@
//
//
// $Author: sebleport $
// $Author: sebleport $
//
//
// $Revision: 1.
3
$
// $Revision: 1.
4
$
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
// Revision 1.3 2007/09/06 09:13:44 sebleport
// - shiftVoltage changed by deltaVoltage attribute
// - add OFF state
// - RUNNING state priority has changed
//
// Revision 1.2 2007/09/05 09:41:37 sebleport
// Revision 1.2 2007/09/05 09:41:37 sebleport
// the command and attribute code has been implemeted
// the command and attribute code has been implemeted
//
//
...
@@ -44,7 +49,7 @@
...
@@ -44,7 +49,7 @@
/**
/**
* @author $Author: sebleport $
* @author $Author: sebleport $
* @version $Revision: 1.
3
$
* @version $Revision: 1.
4
$
*/
*/
// Add your own constants definitions here.
// Add your own constants definitions here.
...
@@ -242,6 +247,9 @@ protected :
...
@@ -242,6 +247,9 @@ protected :
//-----------------------------------------
//-----------------------------------------
Tango
::
DeviceProxyHelper
*
SY2527_crate_proxy
;
Tango
::
DeviceProxyHelper
*
SY2527_crate_proxy
;
std
::
string
message
;
vector
<
unsigned
short
>
position_in_crate
;
};
};
}
// namespace_ns
}
// namespace_ns
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment