From 87dc57a160f3b122af46a9927ee6abb62fdf4159 Mon Sep 17 00:00:00 2001 From: Carlo Migoni Date: Wed, 21 Jun 2023 15:39:20 +0200 Subject: [PATCH] Fix #619, Active Surface can change LUT on the fly (#800) * Fix #619, Active Surface can change LUT on the fly This feature was added in both Medicina and SRT components * Fix #619, updated CHANGELOG.md --------- Co-authored-by: Giuseppe Carboni --- CHANGELOG.md | 2 ++ Common/Servers/Scheduler/src/Core.cpp | 1 + .../include/MedicinaActiveSurfaceBossCore.h | 6 ++++++ .../src/MedicinaActiveSurfaceBossCore.cpp | 16 ++++++++++++++-- .../src/MedicinaActiveSurfaceBossImpl.cpp | 1 + .../include/SRTActiveSurfaceBossCore.h | 4 ++++ .../src/SRTActiveSurfaceBossCore.cpp | 16 ++++++++++++++-- .../src/SRTActiveSurfaceBossImpl.cpp | 1 + 8 files changed, 43 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 554329e5f..19df7c13a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/ issue #791 - Nodding added for TotalPower and Sardara components via the `enable` command. This command can only be issued from a schedule and not via the operatorInput CLI. The syntax for the command is the following: `enable=X;Y` with X and Y representing the 2 feeds the user would like to use for the Nodding observation. This command must be placed in the .bck file in order to work properly. + issue #619 - Active surface components are now capable of changing look-up tables on the fly via the `asSetLUT` command + ## Fixed ## Changed issue #689 - The dataset provided by weather station has been enlarged by the wind direction. The correctponding RAL 'wx' command will noe provided wind direction readout, as well diff --git a/Common/Servers/Scheduler/src/Core.cpp b/Common/Servers/Scheduler/src/Core.cpp index fc9a24616..888b55ddc 100644 --- a/Common/Servers/Scheduler/src/Core.cpp +++ b/Common/Servers/Scheduler/src/Core.cpp @@ -223,6 +223,7 @@ void CCore::execute() throw(ComponentErrors::TimerErrorExImpl, ComponentErrors:: m_parser->add("asPark", "activesurface", 5, &CCore::remoteCall); m_parser->add("asOn", "activesurface", 5, &CCore::remoteCall); m_parser->add("asOff", "activesurface", 5, &CCore::remoteCall); + m_parser->add("asSetLUT", "activesurface", 5, &CCore::remoteCall); // procedures loadProcedures(m_config->getDefaultProceduresFile()); // throws ManagementErrors::ProcedureFileLoadingErrorExImpl diff --git a/Medicina/Servers/MedicinaActiveSurfaceBoss/include/MedicinaActiveSurfaceBossCore.h b/Medicina/Servers/MedicinaActiveSurfaceBoss/include/MedicinaActiveSurfaceBossCore.h index 4042735db..f0a05f146 100644 --- a/Medicina/Servers/MedicinaActiveSurfaceBoss/include/MedicinaActiveSurfaceBossCore.h +++ b/Medicina/Servers/MedicinaActiveSurfaceBoss/include/MedicinaActiveSurfaceBossCore.h @@ -169,6 +169,8 @@ public: void setProfile (const ActiveSurface::TASProfile& profile) throw (ComponentErrors::ComponentErrorsExImpl); + void asSetLUT (const char* newlut); + private: std::map m_error_strings; ContainerServices* m_services; @@ -223,6 +225,10 @@ private: bool m_profileSetted; bool m_ASup; + + bool m_newlut; + + const char* m_lut; }; #endif /*MEDICINAACTIVESURFACEBOSSCORE_H_*/ diff --git a/Medicina/Servers/MedicinaActiveSurfaceBoss/src/MedicinaActiveSurfaceBossCore.cpp b/Medicina/Servers/MedicinaActiveSurfaceBoss/src/MedicinaActiveSurfaceBossCore.cpp index a0673a0cf..1c3f6af6b 100644 --- a/Medicina/Servers/MedicinaActiveSurfaceBoss/src/MedicinaActiveSurfaceBossCore.cpp +++ b/Medicina/Servers/MedicinaActiveSurfaceBoss/src/MedicinaActiveSurfaceBossCore.cpp @@ -55,6 +55,7 @@ void CMedicinaActiveSurfaceBossCore::initialize() } m_profileSetted = false; m_ASup = false; + m_newlut = false; } void CMedicinaActiveSurfaceBossCore::execute() throw (ComponentErrors::CouldntGetComponentExImpl) @@ -1334,6 +1335,12 @@ void CMedicinaActiveSurfaceBossCore::workingActiveSurface() throw (ComponentErro } } +void CMedicinaActiveSurfaceBossCore::asSetLUT(const char *newlut) +{ + m_lut= (CDBPATH + "alma/AS/" + newlut).c_str(); + m_newlut = true; +} + void CMedicinaActiveSurfaceBossCore::setProfile(const ActiveSurface::TASProfile& newProfile) throw (ComponentErrors::ComponentErrorsExImpl) { bool all_sectors = true; @@ -1342,12 +1349,17 @@ void CMedicinaActiveSurfaceBossCore::setProfile(const ActiveSurface::TASProfile& if(!m_sector[i]) all_sectors = false; } + if (m_newlut == false) + m_lut = USDTABLECORRECTIONS; + if(all_sectors) // USD tables has not been loaded yet { - ifstream usdCorrections (USDTABLECORRECTIONS); + ifstream usdCorrections (m_lut); + //ifstream usdCorrections (USDTABLECORRECTIONS); if(!usdCorrections) { - ACS_SHORT_LOG ((LM_INFO, "File %s not found", USDTABLECORRECTIONS)); + ACS_SHORT_LOG ((LM_INFO, "File %s not found", m_lut)); + //ACS_SHORT_LOG ((LM_INFO, "File %s not found", USDTABLECORRECTIONS)); exit(-1); } actuatorsCorrections.length(NPOSITIONS); diff --git a/Medicina/Servers/MedicinaActiveSurfaceBoss/src/MedicinaActiveSurfaceBossImpl.cpp b/Medicina/Servers/MedicinaActiveSurfaceBoss/src/MedicinaActiveSurfaceBossImpl.cpp index 563a651c3..f5a3018fe 100644 --- a/Medicina/Servers/MedicinaActiveSurfaceBoss/src/MedicinaActiveSurfaceBossImpl.cpp +++ b/Medicina/Servers/MedicinaActiveSurfaceBoss/src/MedicinaActiveSurfaceBossImpl.cpp @@ -139,6 +139,7 @@ void MedicinaActiveSurfaceBossImpl::initialize() throw (ACSErr::ACSbaseExImpl) m_parser->add("asOn",new function0(boss,&CMedicinaActiveSurfaceBossCore::asOn),0); m_parser->add("asOff",new function0(boss,&CMedicinaActiveSurfaceBossCore::asOff),0); m_parser->add("asPark",new function0(boss,&CMedicinaActiveSurfaceBossCore::asPark),0); + m_parser->add("asSetLUT",new function1 >(boss,&CMedicinaActiveSurfaceBossCore::asSetLUT),1 ); ACS_LOG(LM_FULL_INFO, "MedicinaActiveSurfaceBossImpl::initialize()", (LM_INFO,"COMPSTATE_INITIALIZED")); } diff --git a/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossCore.h b/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossCore.h index 9ccedea21..2019c0f1b 100644 --- a/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossCore.h +++ b/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossCore.h @@ -223,6 +223,10 @@ private: bool m_profileSetted; bool m_ASup; + + bool m_newlut; + + const char* m_lut; }; #endif /*SRTACTIVESURFACEBOSSCORE_H_*/ diff --git a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossCore.cpp b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossCore.cpp index 8cc4638d9..1e5be0b37 100644 --- a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossCore.cpp +++ b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossCore.cpp @@ -55,6 +55,7 @@ void CSRTActiveSurfaceBossCore::initialize() } m_profileSetted = false; m_ASup = false; + m_newlut = false; } void CSRTActiveSurfaceBossCore::execute() throw (ComponentErrors::CouldntGetComponentExImpl) @@ -1357,6 +1358,12 @@ void CSRTActiveSurfaceBossCore::workingActiveSurface() throw (ComponentErrors::C } } +void CSRTActiveSurfaceBossCore::asSetLUT(const char *newlut) +{ + m_lut= (CDBPATH + "alma/AS/" + newlut).c_str(); + m_newlut = true; +} + void CSRTActiveSurfaceBossCore::setProfile(const ActiveSurface::TASProfile& newProfile) throw (ComponentErrors::ComponentErrorsExImpl) { bool all_sectors = true; @@ -1365,12 +1372,17 @@ void CSRTActiveSurfaceBossCore::setProfile(const ActiveSurface::TASProfile& newP if(!m_sector[i]) all_sectors = false; } + if (m_newlut == false) + m_lut = USDTABLECORRECTIONS; + if(all_sectors) // USD tables has not been loaded yet { - ifstream usdCorrections (USDTABLECORRECTIONS); + ifstream usdCorrections (m_lut); + //ifstream usdCorrections (USDTABLECORRECTIONS); if(!usdCorrections) { - ACS_SHORT_LOG ((LM_INFO, "File %s not found", USDTABLECORRECTIONS)); + ACS_SHORT_LOG ((LM_INFO, "File %s not found", m_lut)); + //ACS_SHORT_LOG ((LM_INFO, "File %s not found", USDTABLECORRECTIONS)); exit(-1); } actuatorsCorrections.length(NPOSITIONS); diff --git a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossImpl.cpp b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossImpl.cpp index e2440af01..54cb831db 100644 --- a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossImpl.cpp +++ b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossImpl.cpp @@ -151,6 +151,7 @@ void SRTActiveSurfaceBossImpl::initialize() throw (ACSErr::ACSbaseExImpl) m_parser->add("asOn",new function0(boss,&CSRTActiveSurfaceBossCore::asOn),0); m_parser->add("asOff",new function0(boss,&CSRTActiveSurfaceBossCore::asOff),0); m_parser->add("asPark",new function0(boss,&CSRTActiveSurfaceBossCore::asPark),0); + m_parser->add("asSetLUT",new function1 >(boss,&CSRTActiveSurfaceBossCore::asSetLUT),1 ); ACS_LOG(LM_FULL_INFO, "SRTActiveSurfaceBossImpl::initialize()", (LM_INFO,"COMPSTATE_INITIALIZED")); } -- GitLab