|
3 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
4 | 4 | *
|
5 | 5 | * Copyright 2022 (c) Sebastian Friedl, ISW University of Stuttgart (for VDMA e.V.)
|
| 6 | + * Copyright 2022 (c) Alen Galinec |
6 | 7 | */
|
7 | 8 |
|
8 | 9 | #include "BasicGMS.hpp"
|
9 | 10 |
|
| 11 | +#include <sstream> |
10 | 12 | #include <string>
|
| 13 | +#include <unordered_map> |
11 | 14 |
|
12 | 15 | #include "../TypeDefinition/GMS/Constants.hpp"
|
13 | 16 | #include "../TypeDefinition/GMS/GMSType.hpp"
|
| 17 | +#include "../TypeDefinition/TypeDefinition.hpp" |
14 | 18 |
|
15 |
| -BasicGMS::BasicGMS(UA_Server *pServer) : InstantiatedMachineTool(pServer) { |
| 19 | +BasicGMS::BasicGMS(UA_Server *pServer) : InstantiatedGMS(pServer) { |
16 | 20 | MachineName = "BasicGMS";
|
17 | 21 | CreateObject();
|
18 | 22 | }
|
@@ -42,8 +46,10 @@ void BasicGMS::CreateObject() {
|
42 | 46 | InstantiateIdentification();
|
43 | 47 | InstantiateMonitoring();
|
44 | 48 | InstantiateProduction();
|
| 49 | + InstantiateEquipment(); |
45 | 50 | InstantiateTools();
|
46 | 51 | InstantiateResultManagement();
|
| 52 | + InstantiateNotification(); |
47 | 53 |
|
48 | 54 | InstantiateOptional(mt.Notification->Prognoses, m_pServer, n);
|
49 | 55 | InstantiateOptional(mt.Notification->Prognoses->Calibration, m_pServer, n);
|
@@ -179,6 +185,65 @@ void BasicGMS::InstantiateTools() {
|
179 | 185 | }
|
180 | 186 | }
|
181 | 187 |
|
| 188 | +void BasicGMS::InstantiateEquipment() { |
| 189 | + InstantiateOptional(gms.Equipment->Tools, m_pServer, n); |
| 190 | + |
| 191 | + auto &sensor1 = InstantiateSensor("Sensor1"); |
| 192 | + sensor1.Class->Value = 2; /* TactileTouchTrigger */ |
| 193 | + sensor1.ControlIdentifier1 = 11; |
| 194 | + sensor1.ControlIdentifier2 = 3; |
| 195 | + sensor1.ControlIdentifierInterpretation = UA_ToolManagement::UA_TOOLMANAGEMENT_GROUPBASED; |
| 196 | + sensor1.Locked->Value = true; |
| 197 | + sensor1.Locked->ReasonForLocking = UA_ToolLocked::UA_TOOLLOCKED_BYOPERATOR; |
| 198 | + sensor1.Name = "T11_P3"; |
| 199 | + InstantiateOptional(sensor1.ControlIdentifier2, m_pServer, n); |
| 200 | + InstantiateOptional(sensor1.Name, m_pServer, n); |
| 201 | + |
| 202 | + // Additional SensorType members |
| 203 | + InstantiateOptional(sensor1.Alignment, m_pServer, n); |
| 204 | + sensor1.Alignment = UA_ToolAlignmentState::UA_TOOLALIGNMENTSTATE_INDEXED; |
| 205 | + |
| 206 | + // TODO: What is the correct format of the "Axes" property according to the spec? |
| 207 | + InstantiateOptional(sensor1.Axes, m_pServer, n); |
| 208 | + sensor1.Axes->push_back("X"); |
| 209 | + sensor1.Axes->push_back("Y"); |
| 210 | + |
| 211 | + InstantiateOptional(sensor1.Capabilities, m_pServer, n); |
| 212 | + sensor1.Capabilities->push_back(UA_ToolCapabilities::UA_TOOLCAPABILITIES_PTMEAS); |
| 213 | + |
| 214 | + InstantiateOptional(sensor1.IsQualifiedStatus, m_pServer, n); |
| 215 | + sensor1.IsQualifiedStatus = UA_ToolIsQualifiedStatus::UA_TOOLISQUALIFIEDSTATUS_QUALIFIED; |
| 216 | + |
| 217 | + // EUInformation for Days according to CEFACT |
| 218 | + const UmatiServerLib::EUInformation_t EU_Days{ |
| 219 | + .NamespaceUri = "http://www.opcfoundation.org/UA/units/un/cefact", .UnitId = 4473177, .DisplayName = {"", "d"}, .Description = {"", "days"}}; |
| 220 | + |
| 221 | + sensor1.ToolLife->Qualified->EngineeringUnits = EU_Days; |
| 222 | + sensor1.ToolLife->Qualified->IsCountingUp = true; |
| 223 | + sensor1.ToolLife->Qualified->StartValue = 0; |
| 224 | + sensor1.ToolLife->Qualified->WarningValue = 5; |
| 225 | + sensor1.ToolLife->Qualified->LimitValue = 7; |
| 226 | + sensor1.ToolLife->Qualified->Value = 1; |
| 227 | + InstantiateOptional(sensor1.ToolLife, m_pServer, n); |
| 228 | + InstantiateOptional(sensor1.ToolLife->Qualified, m_pServer, n); |
| 229 | + InstantiateOptional(sensor1.ToolLife->Qualified->Value, m_pServer, n); |
| 230 | + InstantiateOptional(sensor1.ToolLife->Qualified->StartValue, m_pServer, n); |
| 231 | + InstantiateOptional(sensor1.ToolLife->Qualified->WarningValue, m_pServer, n); |
| 232 | + InstantiateOptional(sensor1.ToolLife->Qualified->LimitValue, m_pServer, n); |
| 233 | +} |
| 234 | + |
| 235 | +void BasicGMS::InstantiateNotification() { |
| 236 | + InstantiateOptional(gms.Notification->Prognoses, m_pServer, n); |
| 237 | + InstantiateOptional(gms.Notification->Prognoses->Calibration, m_pServer, n); |
| 238 | + gms.Notification->Prognoses->Calibration.value.Calibrated = true; |
| 239 | + InstantiateOptional(gms.Notification->Prognoses->Calibration->CalibrationCertificate, m_pServer, n); |
| 240 | + { |
| 241 | + std::stringstream ss; |
| 242 | + ss << "https://www.ptb.de/dcc/#" << MachineName; |
| 243 | + gms.Notification->Prognoses->Calibration.value.CalibrationCertificate->push_back(ss.str()); |
| 244 | + } |
| 245 | +} |
| 246 | + |
182 | 247 | void BasicGMS::Simulate() {
|
183 | 248 | ++m_simStep;
|
184 | 249 | int i = m_simStep;
|
|
0 commit comments