From 2ca9f50195fa64161d520f927b2aa0c61530aefa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=B6tz=20G=C3=B6risch?= Date: Wed, 26 Apr 2023 10:23:18 +0000 Subject: [PATCH 1/2] feat(GMS): Bring features of FullGMS to BasicGMS --- GMS/BasicGMS.cpp | 68 ++++++++++++++++++++++++++++++++++++++++- GMS/BasicGMS.hpp | 8 +++-- GMS/InstantiatedGMS.cpp | 6 ++++ GMS/InstantiatedGMS.hpp | 2 ++ SampleServer.cpp | 4 +-- 5 files changed, 83 insertions(+), 5 deletions(-) diff --git a/GMS/BasicGMS.cpp b/GMS/BasicGMS.cpp index 5fa47006..a8140680 100644 --- a/GMS/BasicGMS.cpp +++ b/GMS/BasicGMS.cpp @@ -3,16 +3,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2022 (c) Sebastian Friedl, ISW University of Stuttgart (for VDMA e.V.) + * Copyright 2022 (c) Alen Galinec */ #include "BasicGMS.hpp" +#include #include +#include #include "../TypeDefinition/GMS/Constants.hpp" #include "../TypeDefinition/GMS/GMSType.hpp" +#include "../TypeDefinition/TypeDefinition.hpp" -BasicGMS::BasicGMS(UA_Server* pServer) : InstantiatedMachineTool(pServer) { +BasicGMS::BasicGMS(UA_Server* pServer) : InstantiatedGMS(pServer) { MachineName = "BasicGMS"; CreateObject(); } @@ -42,8 +46,10 @@ void BasicGMS::CreateObject() { InstantiateIdentification(); InstantiateMonitoring(); InstantiateProduction(); + InstantiateEquipment(); InstantiateTools(); InstantiateResultManagement(); + InstantiateNotification(); InstantiateOptional(mt.Notification->Prognoses, m_pServer, n); InstantiateOptional(mt.Notification->Prognoses->Calibration, m_pServer, n); @@ -179,6 +185,66 @@ void BasicGMS::InstantiateTools() { } } +void BasicGMS::InstantiateEquipment() { + InstantiateOptional(gms.Equipment->Tools, m_pServer, n); + + auto &sensor1 = InstantiateSensor("Sensor1"); + sensor1.Class->Value = 2; /* TactileTouchTrigger */ + sensor1.ControlIdentifier1 = 11; + sensor1.ControlIdentifier2 = 3; + sensor1.ControlIdentifierInterpretation = UA_ToolManagement::UA_TOOLMANAGEMENT_GROUPBASED; + sensor1.Locked->Value = true; + sensor1.Locked->ReasonForLocking = UA_ToolLocked::UA_TOOLLOCKED_BYOPERATOR; + sensor1.Name = "T11_P3"; + InstantiateOptional(sensor1.ControlIdentifier2, m_pServer, n); + InstantiateOptional(sensor1.Name, m_pServer, n); + + // Additional SensorType members + InstantiateOptional(sensor1.Alignment, m_pServer, n); + sensor1.Alignment = UA_ToolAlignmentState::UA_TOOLALIGNMENTSTATE_INDEXED; + + // TODO: What is the correct format of the "Axes" property according to the spec? + InstantiateOptional(sensor1.Axes, m_pServer, n); + sensor1.Axes->push_back("X"); + sensor1.Axes->push_back("Y"); + + InstantiateOptional(sensor1.Capabilities, m_pServer, n); + // sensor1.Capabilities->push_back(UA_ToolCapabilities::UA_TOOLCAPABILITIES_PTMEAS); + + InstantiateOptional(sensor1.IsQualifiedStatus, m_pServer, n); + /// \todo Must be updated to release specification + sensor1.IsQualifiedStatus = UA_ToolIsQualifiedStatus::UA_TOOLISQUALIFIEDSTATUS_QUALIFIED; + + // EUInformation for Days according to CEFACT + const UmatiServerLib::EUInformation_t EU_Days{ + .NamespaceUri = "http://www.opcfoundation.org/UA/units/un/cefact", .UnitId = 4473177, .DisplayName = {"", "d"}, .Description = {"", "days"}}; + + sensor1.ToolLife->Qualified->EngineeringUnits = EU_Days; + sensor1.ToolLife->Qualified->IsCountingUp = true; + sensor1.ToolLife->Qualified->StartValue = 0; + sensor1.ToolLife->Qualified->WarningValue = 5; + sensor1.ToolLife->Qualified->LimitValue = 7; + sensor1.ToolLife->Qualified->Value = 1; + InstantiateOptional(sensor1.ToolLife, m_pServer, n); + InstantiateOptional(sensor1.ToolLife->Qualified, m_pServer, n); + InstantiateOptional(sensor1.ToolLife->Qualified->Value, m_pServer, n); + InstantiateOptional(sensor1.ToolLife->Qualified->StartValue, m_pServer, n); + InstantiateOptional(sensor1.ToolLife->Qualified->WarningValue, m_pServer, n); + InstantiateOptional(sensor1.ToolLife->Qualified->LimitValue, m_pServer, n); +} + +void BasicGMS::InstantiateNotification() { + InstantiateOptional(gms.Notification->Prognoses, m_pServer, n); + InstantiateOptional(gms.Notification->Prognoses->Calibration, m_pServer, n); + gms.Notification->Prognoses->Calibration.value.Calibrated = true; + InstantiateOptional(gms.Notification->Prognoses->Calibration->CalibrationCertificate, m_pServer, n); + { + std::stringstream ss; + ss << "https://www.ptb.de/dcc/#" << MachineName; + gms.Notification->Prognoses->Calibration.value.CalibrationCertificate->push_back(ss.str()); + } +} + void BasicGMS::Simulate() { ++m_simStep; int i = m_simStep; diff --git a/GMS/BasicGMS.hpp b/GMS/BasicGMS.hpp index f9cd11d5..1211f359 100644 --- a/GMS/BasicGMS.hpp +++ b/GMS/BasicGMS.hpp @@ -3,13 +3,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2022 (c) Sebastian Friedl, ISW University of Stuttgart (for VDMA e.V.) + * Copyright 2022 (c) Alen Galinec */ #pragma once -#include "../MachineTools/InstantiatedMachineTool.hpp" + #include "../TypeDefinition/GMS/GMSType.hpp" +#include "InstantiatedGMS.hpp" -class BasicGMS : public InstantiatedMachineTool { +class BasicGMS : public InstantiatedGMS { public: BasicGMS(UA_Server* pServer); @@ -25,6 +27,8 @@ class BasicGMS : public InstantiatedMachineTool { void InstantiateMonitoring(); void InstantiateProduction(); void InstantiateTools(); + void InstantiateEquipment() override; + void InstantiateNotification() override; int m_simStep = 0; void initCorrection(GMS::CorrectionType_t& corr, std::string Identifier, std::string CharacteristicIdentifier, double value); diff --git a/GMS/InstantiatedGMS.cpp b/GMS/InstantiatedGMS.cpp index 2929ddb1..d3c59cb1 100644 --- a/GMS/InstantiatedGMS.cpp +++ b/GMS/InstantiatedGMS.cpp @@ -78,6 +78,12 @@ void InstantiatedGMS::InstantiateResultManagement() {} void InstantiatedGMS::InstantiateMonitoring() {} +void InstantiatedGMS::SimulateStacklight() { + for (auto& light : gms.Monitoring->Stacklight->OrderedObjects.value) { + light->SignalOn = (rnd() % 2) == 0; + } +} + GMS::GMSSensor_t& InstantiatedGMS::InstantiateSensor(std::string const& sensorName) { // It seems very wasteful for every instance of a sensor to have its own copy of the "Class" EnumStrings[]. // I assume this array is the same for all the sensors of the instance. diff --git a/GMS/InstantiatedGMS.hpp b/GMS/InstantiatedGMS.hpp index c721bcdd..b65294e4 100644 --- a/GMS/InstantiatedGMS.hpp +++ b/GMS/InstantiatedGMS.hpp @@ -12,6 +12,7 @@ #include #include +#include "../MachineTools/InstantiatedMachineTool.hpp" #include "../MachineTools/SimulatedInstance.hpp" #include "../TypeDefinition/GMS/GMSType.hpp" #include "../UmatiServerLib/NodesMaster.hpp" @@ -33,6 +34,7 @@ class InstantiatedGMS : public SimulatedInstance { virtual void InstantiateProduction(); virtual void InstantiateResultManagement(); virtual void InstantiateMonitoring(); + virtual void SimulateStacklight(); // TODO: Take care of subcomponents later // virtual void InstantiateNotificationCalibration(); diff --git a/SampleServer.cpp b/SampleServer.cpp index 8d1bab74..c7fc468e 100644 --- a/SampleServer.cpp +++ b/SampleServer.cpp @@ -45,7 +45,7 @@ #include "AdditiveManufacturing/ShowcaseAMMachine.hpp" #include "Configuration/Configuration_json.hpp" #include "GMS/BasicGMS.hpp" -/* #include "GMS/FullGMS.hpp" */ +#include "GMS/FullGMS.hpp" #include "GMS/HexagonGlobal.hpp" #include "GMS/HexagonSim.hpp" #include "GMS/OGPSmartScopeCNC500.hpp" @@ -255,7 +255,7 @@ int main(int argc, char* argv[]) { machineTools.push_back(std::make_shared(pServer)); machineTools.push_back(std::make_shared(pServer)); machineTools.push_back(std::make_shared(pServer)); - /*machineTools.push_back(std::make_shared(pServer));*/ + machineTools.push_back(std::make_shared(pServer)); machineTools.push_back(std::make_shared(pServer)); machineTools.push_back(std::make_shared(pServer)); From e31bfd9fcd2c3e97a9969f7d15ae662f2fc8398f Mon Sep 17 00:00:00 2001 From: Goetz Goerisch Date: Thu, 19 Feb 2026 17:03:55 +0100 Subject: [PATCH 2/2] feat!(GMS): disables BasicGMS Signed-off-by: Goetz Goerisch --- SampleServer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SampleServer.cpp b/SampleServer.cpp index c7fc468e..ab3e148e 100644 --- a/SampleServer.cpp +++ b/SampleServer.cpp @@ -44,7 +44,7 @@ #include "AdditiveManufacturing/BasicAMMachine.hpp" #include "AdditiveManufacturing/ShowcaseAMMachine.hpp" #include "Configuration/Configuration_json.hpp" -#include "GMS/BasicGMS.hpp" +// #include "GMS/BasicGMS.hpp" #include "GMS/FullGMS.hpp" #include "GMS/HexagonGlobal.hpp" #include "GMS/HexagonSim.hpp" @@ -250,7 +250,7 @@ int main(int argc, char* argv[]) { /*machineTools.push_back(std::make_shared(pServer));*/ machineTools.push_back(std::make_shared(pServer)); machineTools.push_back(std::make_shared(pServer)); - machineTools.push_back(std::make_shared(pServer)); + // machineTools.push_back(std::make_shared(pServer)); machineTools.push_back(std::make_shared(pServer)); machineTools.push_back(std::make_shared(pServer)); machineTools.push_back(std::make_shared(pServer));