Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
NomadModules
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Instrument Control
NomadModules
Commits
84c57a1e
Commit
84c57a1e
authored
Apr 15, 2020
by
Franck Cecillon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
passive chopper
parent
6c9b8f9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
284 additions
and
0 deletions
+284
-0
src/controllers/lss/d17/D17ChopperController.cpp
src/controllers/lss/d17/D17ChopperController.cpp
+152
-0
src/controllers/lss/d17/D17ChopperController.h
src/controllers/lss/d17/D17ChopperController.h
+132
-0
No files found.
src/controllers/lss/d17/D17ChopperController.cpp
0 → 100644
View file @
84c57a1e
/*
* 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 <cmath>
#include <boost/thread/thread.hpp>
#include "Utilities/Calculations.h"
#include "drivers/legacy/def/CommandDef.h"
#include "drivers/legacy/def/DriverErrorDef.h"
#include <controllers/lss/d17/D17ChopperController.h>
#include "controllers/common/family/Families.h"
using
namespace
std
;
using
namespace
chopper
;
namespace
d17
{
const
string
D17ChopperController
::
TYPE
=
"d17chopper"
;
/*
* constructor
*/
D17ChopperController
::
D17ChopperController
(
const
string
&
name
)
:
ExperimentController
(
name
)
{
setFamily
(
family
::
BEAM_PARAMETERS
,
family
::
CHOPPER
);
// Init property
speed
.
init
(
this
,
NOSAVE
|
SPY
,
"actual_speed"
,
"Speed"
);
speed
.
setUnit
(
"rpm"
);
phase
.
init
(
this
,
NOSAVE
|
SPY
,
"actual_phase"
,
"Phase"
);
/* dir.init(this, SAVE | SCAN, "actual_dir", "wanted_dir", "Wanted dir");
phase.setUnit("~degree");
gear.init(this, SAVE | SCAN, "actual_gear", "wanted_gear", "Wanted Gear");*/
// speed.init(this, SAVE | SCAN | SPY, "actual_direction", "wanted_direction", "Wanted Direction"); //!!!!!!!!
periodusec
.
init
(
this
,
NOSAVE
,
"periodusec"
);
chopperStatus
.
init
(
this
,
NOSAVE
,
"status"
);
chopperIndice
.
init
(
this
,
SAVE
,
"chopperIndice"
);
actualMaster
.
init
(
this
,
SAVE
,
"actual_master"
);
isSync
.
init
(
this
,
NOSAVE
,
"is_sync"
);
// Init drivers
m_NCSDriver
.
init
(
this
,
"ncs_driver"
);
// General variable for command
registerFunction
(
TYPE
);
cout
<<
" registeur type"
<<
endl
;
}
/*
* destructor
*/
D17ChopperController
::~
D17ChopperController
()
{
}
/*
* postConfiguration
*/
void
D17ChopperController
::
postConfiguration
()
{
cout
<<
" ChopperController postConfiguration"
<<
endl
;
cout
<<
" postConfiguration ok"
<<
endl
;
registerUpdater
(
m_NCSDriver
->
currentSpeed
,
&
D17ChopperController
::
updateActualSpeed
,
this
);
registerUpdater
(
m_NCSDriver
->
currentPhase
,
&
D17ChopperController
::
updateActualPhase
,
this
);
registerUpdater
(
m_NCSDriver
->
chopperStatus
,
&
D17ChopperController
::
updateActualStat
,
this
);
/* registerUpdater(m_NCSDriver->currentPhase, &D17ChopperController::updateActualSpeed, this);
registerUpdater(m_NCSDriver->actualPhase, &D17ChopperController::updateActualPhase, this);
registerUpdater(m_NCSDriver->actualMaster, &D17ChopperController::updateActualMaster, this);*/
// Link with driver update
// registerProgression(chopperDriver, &D17ChopperController::updateProgression, this);
// Call to updaters
/*updateActualSpeed(0);
updateActualSpeed(1);*/
// updateActualPhase();
// Progression
// Update actual status
// chopperStatus = chopperDriver->chopperStatus();
}
/*
* updateStatus
*/
void
D17ChopperController
::
updateActualStat
(
int32
ki
)
{
/*if (ki == chopperIndice() ) {
int32 status = m_NCSDriver->chopperStatus.get(ki);
chopperStatus = status;
}*/
}
void
D17ChopperController
::
updateActualSpeed
(
int32
ki
)
{
if
(
ki
==
chopperIndice
()
)
{
speed
=
m_NCSDriver
->
currentSpeed
.
get
(
ki
);
}
}
void
D17ChopperController
::
updateActualPhase
(
int32
ki
)
{
if
(
ki
==
chopperIndice
()
)
{
phase
=
m_NCSDriver
->
currentPhase
.
get
(
ki
);
cout
<<
" updateActualPhase "
<<
phase
()
<<
endl
;
}
}
/*
* updateProgression
*/
void
D17ChopperController
::
updateProgression
()
{
/*int32 lDriverProgression;
int32 lPhaseDriverProgression;
lDriverProgression = chopperDriver->commandProgression();
lPhaseDriverProgression = chopperPhaseDriver->commandProgression();
commandProgression = chopperDriver->commandProgression(); //(lDriverProgression + lPhaseDriverProgression) / 2;*/
}
/*
* test
*/
void
D17ChopperController
::
test
()
{
//assertTrue(1 == 2);
}
}
src/controllers/lss/d17/D17ChopperController.h
0 → 100644
View file @
84c57a1e
/*
* 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 D17CHOPPERCONTROLLER_H
#define D17CHOPPERCONTROLLER_H
#include <Controller.h>
#include "controllers/common/chopper/ChopperCommon.h"
#include "controllers/common/chopper/ChopperController.h"
#include <drivers/astrium/chopper_ncs/ChopperNCSDriver.h>
namespace
d17
{
/*!
* \class CHOPPERController
* \brief Class described the CHOPPER controller functionality
*
* \par
* This class is implemented simple Chopper functionalities
*/
class
D17ChopperController
:
public
ExperimentController
{
public:
//! Type of controller
static
const
std
::
string
TYPE
;
/*!
* \brief Constructor
* \param[in] name the name of the experiment controller
*/
D17ChopperController
(
const
std
::
string
&
name
);
/*!
* \brief Destructor
*/
virtual
~
D17ChopperController
();
// <PROPERTY name="speed_status" type="int32" spy="true"/>
/*!
* Properties
*/
Property
<
int32
>
speed
;
//! speed property
Property
<
float64
>
phase
;
//! phase property
/*Property<int32, SETPOINT > gear; //! phase property
Property<std::string, SETPOINT> dir; //! phase property*/
Property
<
float64
>
periodusec
;
//! period (Time for on rotation)
// Property<int32> minAllowedSpeed; //! Speed limits (min)
// Property<int32> maxAllowedSpeed; //! Speed limits (max)
Property
<
int32
>
chopperStatus
;
//! Status property (global for the chopper)
Property
<
int32
>
chopperIndice
;
Property
<
int32
>
actualMaster
;
Property
<
int32
>
isSync
;
// DriverPtr<chopper::ChopperCommon> chopperDriver; //! Chopper driver link (speed card)
// DriverPtr<adsorptiontrough::AdsTroughDriver> m_adsDriver; //! driver link
DriverPtr
<
chopper_ncs
::
chopperNCSDriver
>
m_NCSDriver
;
//DriverPtr<adsorptiontrough::AdsTroughDriver> m_adsDriver; //! driver link
/*!
* \brief Method called before changing the property value
*
* This method is called after setting configuration during the creation of controller.
*/
virtual
void
postConfiguration
();
// /*!
// * \brief Compute estimated positioning time
// * \param[in] inc increment global counter flag
// * \return the estimated time
// */
// virtual float64 computeEstimatedTime(bool inc);
void
setMaster
();
void
brake
();
/*!
* \brief Test method for example.
*/
virtual
void
test
();
protected:
/*!
* \brief update the actual speed property from driver one
*/
virtual
void
updateActualSpeed
(
int32
ki
);
/*!
* \brief update the actual phase property from driver one
*/
virtual
void
updateActualPhase
(
int32
ki
);
virtual
void
updateActualStat
(
int32
ki
);
/*
* \brief update the status property from driver one
*/
void
updateStatus
();
/*!
* \brief update the progression property from driver one
*/
void
updateProgression
();
};
}
#endif //D17CHOPPERCONTROLLER_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment