-
Notifications
You must be signed in to change notification settings - Fork 27
/
pdm-data-model.cds
136 lines (122 loc) · 4.81 KB
/
pdm-data-model.cds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
namespace sap.smartfactory;
using {
managed,
Currency,
sap
} from '@sap/cds/common';
////////////////////////////////////////////////////////////
//Data Model for Predctive Maintenance module
//Equipments: Equipment master data
//PlantConditions: The recorded condition of the plants given a time period.
//EquipmentConditions: The recorded condition of the equipment given a time period
//Anomalies: The detected sound anomaly attached to an equipment
//AnomalyTypes: CodeList of the sound anomaly types
//AnomalyStatus: Enum of the sound anomaly status
////////////////////////////////////////////////////////////
entity PlantConditions : managed {
key ID : Integer;
plant : String(4);
plantStatus : String(30);
recStartedAt : Timestamp;
recEndedAt : Timestamp;
date : Date;
shift : ShiftNo;
//key figures recorded in plant condition
yield : Decimal(9,2);
defectiveProd : Decimal(9,2);
energyCons : Decimal(9,2);
//Each PlantCondition is associated with the EquipmentConditions during the time period
equipmentConditions : Association to many EquipmentConditions
on equipmentConditions.plantCond = $self;
}
type ShiftNo : Integer enum {
MorningShift = 0;
AfternoonShift = 1;
NightShift = 2;
}
entity Equipments : managed {
key NR : String(18);
name : localized String(40);
desc : localized String(100);
toEquipmentStatus : Association to PlantEquipmentStatus;
//Organizational data
compCode : String(4);
plant : String(4);
plantSection : String(3);
funcLocation : String(30);
costCenter : String(10);
//historical condition record of the equipment
conditions : Association to many EquipmentConditions
on conditions.equipment = $self;
}
entity EquipmentConditions : managed {
key ID : Integer;
plantCond : Association to PlantConditions;
equipment : Association to Equipments;
toEquipmentStatus : Association to PlantEquipmentStatus;
virtual noOfAnomaliesSinceLastMT : Integer;
recStartedAt : Timestamp;
recEndedAt : Timestamp;
date : Date;
virtual moCreated : Boolean;
//detected sound anomalies of the equipment during the period
anomalies : Association to many Anomalies
on anomalies.eqCond = $self;
//follow-up action on equipment condtion level instead of Anomaly level
//which could be a maintenance request or order in SAP S/4HANA Cloud
followUpDocType : AnomalyFollowUpActionType;
followUpDocNum : String(12);
maintenanceCost : Decimal(9,2);
currency : Currency;
}
//For UI Header Annotation Criticality
type Criticality : Integer enum {
Red = 1; //Negative
Yellow = 2; //Neutral
Green = 3; //Positive
}
entity PlantEquipmentStatus {
key code : String(2);
name : localized String(20);
criticality : Criticality;
recommendation : localized String(50);
}
//////////////////////////////////////////////////////////////////////
//Anomalies entity here can be used for any kind of Anomalies, such as
//sound, image, temperature, humidity etc
//////////////////////////////////////////////////////////////////////
entity Anomalies : managed {
key ID : Integer;
detectedAt : Timestamp;
detectedDate : Date;
equipment : String(18);
//Generlise the Anomalies instead of Anomalies.
//sourceType could be sound, image, temperature, humidity etc
//If the sourceType is is sound or image, then rawValue will be the file path.
sourceType : String(20) default 'Sound';
rawValue : String(50);
rawMeasureUnit: String(10) default 'File Path';
anomalyType : Association to AnomalyTypes;
confidence : Decimal(9, 3) default 0.000;
status : AnomalyStatus;
eqCond : Association to EquipmentConditions; //> the backlink
numberOfAnomalies : Integer default 1; //for aggregation
}
entity AnomalyTypes : sap.common.CodeList {
key code : String(2);
suggestedFollowUpAction : AnomalyFollowUpActionType default 'MO';
//indicator whether to trigger the follow-up action automatically or not
autoTrigger : Boolean default true;
triggerThreshold : Integer default 2;
}
type AnomalyStatus : Integer enum {
New = 0;
InProcess = 1;
Processed = 2;
Ignored = 3;
}
type AnomalyFollowUpActionType : String enum {
MaintenanceNotfication = 'MN';
MaintenanceRequest = 'MR';
MaintenanceOrder = 'MO';
}