Commit 58ac6202 authored by Jiahang Chen's avatar Jiahang Chen
Browse files

Merge branch 'c3s_demostrator' into 'master'

C3s demostrator

See merge request !10
parents 5ed3fdb6 2d886e53
Pipeline #503444 passed with stages
in 29 seconds
......@@ -58,6 +58,8 @@
from ml.fml40.roles.dts.forest.forest_segment import ForestSegment
from ml.fml40.roles.dts.forest.tree import Tree
from ml.mml40.roles.dts.parts.cantilever import Cantilever
from ml.ml40.features.properties.associations.association import Association
from ml.ml40.features.properties.associations.composite import Composite
from ml.ml40.features.properties.property import Property
......@@ -65,7 +67,9 @@
from ml.ml40.features.properties.values.address import Address
from ml.ml40.features.properties.values.count import Count
from ml.ml40.features.properties.values.dimensions import Dimensions
from ml.ml40.features.properties.values.distance import Distance
from ml.ml40.features.properties.values.expansion_length import ExpansionLength
from ml.ml40.features.properties.values.force import Force
from ml.ml40.features.properties.values.generic_property import GenericProperty
from ml.ml40.features.properties.values.last_service_check import LastServiceCheck
from ml.ml40.features.properties.values.lot import Lot
......@@ -111,7 +115,6 @@
from ml.fml40.features.properties.values.documents.jobs.forwarding_job import ForwardingJob
from ml.fml40.features.properties.values.documents.jobs.log_transportation_job import LogTransportationJob
from ml.fml40.features.properties.values.documents.reports.afforestation_suggestion import AfforestationSuggestion
from ml.fml40.features.properties.values.documents.reports.felling_tool import FellingTool
from ml.fml40.features.properties.values.documents.reports.log_measurement import LogMeasurement
......@@ -121,11 +124,14 @@
from ml.fml40.features.properties.values.documents.reports.passability_report import PassabilityReport
from ml.fml40.features.properties.values.documents.reports.soil_moisture_measurement import SoilMoistureMeasurement
from ml.mml40.features.properties.values.Displacement import Displacement
from ml.mml40.features.properties.values.MaterialProperties import MaterialProperties
from ml.mml40.features.properties.values.Stretch import Stretch
from ml.ml40.features.functionalities.accepts_jobs import AcceptsJobs
from ml.ml40.features.functionalities.accepts_reports import AcceptsReports
from ml.ml40.features.functionalities.clears_jobs import ClearsJobs
from ml.ml40.features.functionalities.functionality import Functionality
from ml.ml40.features.functionalities.get_xml_value import GetXMLValue
from ml.ml40.features.functionalities.manages_jobs import ManagesJobs
from ml.ml40.features.functionalities.plans_routes import PlansRoutes
from ml.ml40.features.functionalities.provides_map_data import ProvidesMapData
......@@ -154,7 +160,6 @@
from ml.fml40.features.functionalities.forwards import Forwards
from ml.fml40.features.functionalities.generates_afforestation_suggestions import GeneratesAfforestationSuggestions
from ml.fml40.features.functionalities.generates_felling_suggestions import GeneratesFellingSuggestions
from ml.fml40.features.functionalities.get_stanford2010_value import GetStanForD2010Value
from ml.fml40.features.functionalities.grabs import Grabs
from ml.fml40.features.functionalities.harvests import Harvests
from ml.fml40.features.functionalities.measure_wood import MeasuresWood
......@@ -168,6 +173,9 @@
from ml.fml40.features.functionalities.supports_felling import SupportsFelling
from ml.fml40.features.functionalities.transports_logs import TransportsLogs
from ml.mml40.features.functionalities.ProvidesDisplacementData import ProvidesDisplacementData
from ml.mml40.features.functionalities.ProvidesForceData import ProvidesForceData
from ml.mml40.features.functionalities.ProvidesStretchData import ProvidesStretchData
# TODO: Get rid of this global variable
# TODO: automatically get all classes in module
DT_FACTORY = {}
......@@ -243,6 +251,7 @@ def build(thing, model):
ditto_features = model.get("features", None)
if not isinstance(model, dict):
# TODO JSON Schema
APP_LOGGER.critical("model is no valid JSON")
return
roles = attributes.get("roles", [])
......@@ -342,7 +351,8 @@ def add_function_impl_obj(thing, impl_obj, feature_name, **kwargs):
def create_thing(model, grant_type="password",
secret="", username=None, password=None,
is_broker_rest=False, is_broker=False, is_repo=False, is_stanford2010=False,
stanford2010_sync_freq=None,stanford2010_path=None):
stanford2010_sync_freq=None, stanford2010_path=None, is_database=False,
database_conf=None, database_file=None):
"""
Creates and launches a thing which connects to the S3I
......@@ -387,7 +397,10 @@ def create_thing(model, grant_type="password",
is_repo=is_repo,
is_stanford2010=is_stanford2010,
stanford2010_sync_freq=stanford2010_sync_freq,
stanford2010_path=stanford2010_path
stanford2010_path=stanford2010_path,
is_database=is_database,
database_conf=database_conf,
database_file=database_file,
)
build(thing_ref, model)
......
......@@ -22,6 +22,8 @@ def __init__(self, name="", identifier=""):
# TODO: Move setup code of __class_name into the correct setter method.
if 'ml\\fml40' in sys.modules[self.__class__.__module__].__file__:
self.__class_name = "fml40::{}".format(self.__class__.__name__)
elif 'ml\\mml40' in sys.modules[self.__class__.__module__].__file__:
self.__class_name = "mml40::{}".format(self.__class__.__name__)
else:
self.__class_name = "ml40::{}".format(self.__class__.__name__)
self.__identifier = identifier
......
from ml.ml40.features.properties.values.value import Value
class Distance(Value):
def __init__(self, name="", identifier=""):
super().__init__(
name=name,
identifier=identifier)
self.__distance = None
@property
def distance(self):
return self.__distance
@distance.setter
def distance(self, value):
self.__distance = value
def to_json(self):
self.__json_out = super().to_json()
if self.__distance is not None:
self.__json_out["distance"] = self.__distance
return self.__json_out
\ No newline at end of file
from ml.ml40.features.properties.values.value import Value
class Force(Value):
def __init__(self, name="", identifier=""):
super().__init__(
name=name,
identifier=identifier)
self.__force = None
self.__min_force = None
self.__max_force = None
@property
def force(self):
return self.__force
@force.setter
def force(self, value):
self.__force = value
@property
def minForce(self):
return self.__min_force
@minForce.setter
def minForce(self, value):
self.__min_force = value
@property
def maxForce(self):
return self.__max_force
@maxForce.setter
def maxForce(self, value):
self.__max_force = value
def to_json(self):
self.__json_out = super().to_json()
if self.__force is not None:
self.__json_out["force"] = self.__force
if self.__min_force is not None:
self.__json_out["minForce"] = self.__min_force
if self.__max_force is not None:
self.__json_out["maxForce"] = self.__max_force
return self.__json_out
\ No newline at end of file
from ml.ml40.features.functionalities.functionality import Functionality
from ml.mml40.features.properties.values.Displacement import Displacement
class ProvidesDisplacementData(Functionality):
def __init__(self, name="", identifier=""):
"""Initializes the object.
:param name: Object name
:param identifier: Identifier
"""
super().__init__(
name=name,
identifier=identifier)
def compileDisplacementWithGeometry(self, geometryType) -> Displacement:
pass
def compileDisplacementWithMaterial(self, materialType) -> Displacement:
pass
def getMaxDisplacement(self) -> Displacement:
pass
def getMinDisplacement(self) -> Displacement:
pass
def getDisplacementData(self, time) -> Displacement:
pass
def getDisplacementDataSeries(self, startTime, endTime):
pass
from ml.ml40.features.functionalities.functionality import Functionality
from ml.ml40.features.properties.values.force import Force
class ProvidesForceData(Functionality):
def __init__(self, name="", identifier=""):
"""Initializes the object.
:param name: Object name
:param identifier: Identifier
"""
super().__init__(
name=name,
identifier=identifier)
def compileForceWithMaterial(self, materialType) -> Force:
pass
def compileForceWithGeometry(self, geometryType) -> Force:
pass
def getMaxForce(self) -> Force:
pass
def getMinForce(self) -> Force:
pass
def getForceData(self, time) -> Force:
pass
def getForceDataSeries(self, startTime, endTime):
pass
from ml.ml40.features.functionalities.functionality import Functionality
from ml.mml40.features.properties.values.Stretch import Stretch
class GetXMLValue(Functionality):
class ProvidesStretchData(Functionality):
def __init__(self, name="", identifier=""):
"""Initializes the object.
:param name: Object name
:param identifier: Identifier
"""
super().__init__(
name=name,
identifier=identifier)
def getValueByPath(self, XPath):
pass
\ No newline at end of file
def getStretchData(self, time) -> Stretch:
pass
def getStretchDataSeries(self, startTime, endTime):
pass
def getMaxStretch(self) -> Stretch:
pass
def getMinStretch(self) -> Stretch:
pass
from ml.ml40.features.properties.values.value import Value
class Displacement(Value):
def __init__(self, name="", identifier=""):
super().__init__(
name=name,
identifier=identifier)
self.__displacement = None
@property
def displacement(self):
return self.__displacement
@displacement.setter
def displacement(self, value):
self.__displacement = value
def to_json(self):
self.__json_out = super().to_json()
if self.displacement is not None:
self.__json_out["displacement"] = self.displacement
return self.__json_out
\ No newline at end of file
from ml.ml40.features.properties.values.value import Value
class MaterialProperties(Value):
def __init__(self, name="", identifier=""):
super().__init__(
name=name,
identifier=identifier)
self.__load_changes = None
self.__material_type = None
self.__yield_strength = None
self.__young_modulus = None
self.__json_out = dict()
@property
def loadChanges(self):
return self.__load_changes
@loadChanges.setter
def loadChanges(self, value):
self.__load_changes = value
@property
def materialType(self):
return self.__material_type
@materialType.setter
def materialType(self, value):
self.__material_type = value
@property
def yieldStrength(self):
return self.__yield_strength
@yieldStrength.setter
def yieldStrength(self, value):
self.__yield_strength = value
@property
def youngModulus(self):
return self.__young_modulus
@youngModulus.setter
def youngModulus(self, value):
self.__young_modulus = value
def to_json(self):
self.__json_out = super().to_json()
if self.loadChanges is not None:
self.__json_out["loadChanges"] = self.loadChanges
if self.materialType is not None:
self.__json_out["materialType"] = self.materialType
if self.yieldStrength is not None:
self.__json_out["yieldStrength"] = self.yieldStrength
if self.youngModulus is not None:
self.__json_out["youngModulus"] = self.youngModulus
return self.__json_out
from ml.ml40.features.properties.values.value import Value
class Stretch(Value):
def __init__(self, name="", identifier=""):
super().__init__(
name=name,
identifier=identifier)
self.__stretch = None
@property
def stretch(self):
return self.__stretch
@stretch.setter
def stretch(self, value):
self.__stretch = value
def to_json(self):
self.__json_out = super().to_json()
if self.__stretch is not None:
self.__json_out["stretch"] = self.__stretch
return self.__json_out
from ml.ml40.features.functionalities.get_xml_value import GetXMLValue
from ml.ml40.roles.dts.parts.part import Part
class GetStanForD2010Value(GetXMLValue):
class Cantilever(Part):
def __init__(self, name="", identifier=""):
super().__init__(
name=name,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment