Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
12d41c29
Unverified
Commit
12d41c29
authored
1 year ago
by
Jens Georg
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix example2a to actually work (#307)
parent
8fdaacec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
example2a/demoApp2a.cc
+12
-32
12 additions, 32 deletions
example2a/demoApp2a.cc
with
12 additions
and
32 deletions
example2a/demoApp2a.cc
+
12
−
32
View file @
12d41c29
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
#include
<ChimeraTK/ApplicationCore/ApplicationCore.h>
#include
<ChimeraTK/ApplicationCore/ConfigReader.h>
#include
<ChimeraTK/ApplicationCore/EnableXMLGenerator.h>
...
...
@@ -9,12 +10,12 @@ namespace ctk = ChimeraTK;
struct
Controller
:
public
ctk
::
ApplicationModule
{
using
ctk
::
ApplicationModule
::
ApplicationModule
;
ctk
::
ScalarPollInput
<
double
>
sp
{
this
,
"temperatureSetpoint"
,
"degC"
,
"Description"
,
{
"CS"
}
};
ctk
::
ScalarPushInput
<
double
>
rb
{
this
,
"temperatureReadback"
,
"degC"
,
"..."
,
{
"DEV"
,
"CS"
}
};
ctk
::
ScalarOutput
<
double
>
cur
{
this
,
"heatingCurrent"
,
"mA"
,
"..."
,
{
"DEV"
}
};
ctk
::
ScalarPollInput
<
float
>
sp
{
this
,
"temperatureSetpoint"
,
"degC"
,
"Description"
};
ctk
::
ScalarPushInput
<
float
>
rb
{
this
,
"
/heater/
temperatureReadback"
,
"degC"
,
"..."
};
ctk
::
ScalarOutput
<
float
>
cur
{
this
,
"
/heater/
heatingCurrent"
,
"mA"
,
"..."
};
void
mainLoop
()
{
const
double
gain
=
100.0
;
void
mainLoop
()
final
{
const
float
gain
=
100.0
F
;
while
(
true
)
{
readAll
();
// waits until rb updated, then reads sp
...
...
@@ -26,12 +27,12 @@ struct Controller : public ctk::ApplicationModule {
struct
Automation
:
public
ctk
::
ApplicationModule
{
using
ctk
::
ApplicationModule
::
ApplicationModule
;
ctk
::
ScalarPollInput
<
double
>
opSp
{
this
,
"operatorSetpoint"
,
"degC"
,
"..."
,
{
"CS"
}
};
ctk
::
ScalarOutput
<
double
>
actSp
{
this
,
"temperatureSetpoint"
,
"degC"
,
"..."
,
{
"Controller"
}
};
ctk
::
ScalarPollInput
<
float
>
opSp
{
this
,
"operatorSetpoint"
,
"degC"
,
"..."
};
ctk
::
ScalarOutput
<
float
>
actSp
{
this
,
"
/Controller/
temperatureSetpoint"
,
"degC"
,
"..."
};
ctk
::
ScalarPushInput
<
uint64_t
>
trigger
{
this
,
"/Timer/tick"
,
""
,
"..."
};
void
mainLoop
()
{
const
double
maxStep
=
0.1
;
void
mainLoop
()
final
{
const
float
maxStep
=
0.1
F
;
while
(
true
)
{
readAll
();
// waits until trigger received, then read opSp
actSp
+=
std
::
max
(
std
::
min
(
opSp
-
actSp
,
maxStep
),
-
maxStep
);
...
...
@@ -40,15 +41,13 @@ struct Automation : public ctk::ApplicationModule {
}
};
struct
ExampleApp
:
public
ctk
::
Application
{
struct
ExampleApp
final
:
public
ctk
::
Application
{
ExampleApp
()
:
Application
(
"exampleApp2a"
)
{
if
(
config
.
get
<
int
>
(
"enableAutomation"
))
{
automation
=
Automation
(
this
,
"Automation"
,
"Slow setpoint ramping algorithm"
);
// automation.findTag("Controller").connectTo(controller);
// timer.tick >> automation.trigger;
}
}
~
ExampleApp
()
{
shutdown
();
}
~
ExampleApp
()
final
{
shutdown
();
}
ctk
::
SetDMapFilePath
dmapPath
{
"example2.dmap"
};
...
...
@@ -62,24 +61,5 @@ struct ExampleApp : public ctk::Application {
ctk
::
DeviceModule
oven
{
this
,
"oven"
,
"/Timer/tick"
};
Automation
automation
;
// ctk::ControlSystemModule cs;
// void defineConnections();
};
static
ExampleApp
theExampleApp
;
/*
void ExampleApp::defineConnections() {
ChimeraTK::setDMapFilePath("example2.dmap");
config.connectTo(cs["Configuration"]);
if(config.get<int>("enableAutomation")) {
automation = Automation(this, "Automation", "Slow setpoint ramping algorithm");
automation.findTag("Controller").connectTo(controller);
timer.tick >> automation.trigger;
}
controller.findTag("DEV").connectTo(oven["heater"], timer.tick);
findTag("CS").connectTo(cs);
}
*/
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