Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/basyx/aas/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"""

import abc
from datetime import datetime
import inspect
import itertools
from enum import Enum, unique
Expand All @@ -26,6 +27,7 @@
ValueDataType = datatypes.AnyXSDType # any xsd atomic type (from .datatypes)
ValueList = Set["ValueReferencePair"]
BlobType = bytes
DateTimeUTC = datetime

# The following string aliases are constrained by the decorator functions defined in the string_constraints module,
# wherever they are used for an instance attributes.
Expand Down
9 changes: 7 additions & 2 deletions sdk/basyx/aas/model/submodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import abc
import uuid
from datetime import timezone
from typing import Optional, Set, Iterable, TYPE_CHECKING, List, Type, TypeVar, Generic, Union

from . import base, datatypes, _string_constraints
Expand Down Expand Up @@ -1284,7 +1285,7 @@ def __init__(self,
message_topic: Optional[base.MessageTopicType] = None,
message_broker: Optional[base.ModelReference[Union[Submodel, SubmodelElementList,
SubmodelElementCollection, Entity]]] = None,
last_update: Optional[datatypes.DateTime] = None,
last_update: Optional[base.DateTimeUTC] = None,
min_interval: Optional[datatypes.Duration] = None,
max_interval: Optional[datatypes.Duration] = None,
display_name: Optional[base.MultiLanguageNameType] = None,
Expand All @@ -1310,7 +1311,11 @@ def __init__(self,
self.message_topic: Optional[base.MessageTopicType] = message_topic
self.message_broker: Optional[base.ModelReference[Union[Submodel, SubmodelElementList,
SubmodelElementCollection, Entity]]] = message_broker
self.last_update: Optional[datatypes.DateTime] = last_update
self.last_update: Optional[base.DateTimeUTC] = last_update
if ((last_update and last_update.tzinfo and
last_update.tzinfo.utcoffset(last_update) != timezone.utc.utcoffset(None))
or (last_update and last_update.tzinfo is None)):
raise ValueError("Last update must be in UTC!")
Comment on lines +1315 to +1318

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a feeling, I'd say this check should be before the attribute self.last_update is written.
However, this whole thing seems a little hacky, maybe we should discuss this in our next meeting.

self.min_interval: Optional[datatypes.Duration] = min_interval
self.max_interval: Optional[datatypes.Duration] = max_interval

Expand Down
Loading