From ba06beec02b3aca0e7800d77fcef2ed2d5a21367 Mon Sep 17 00:00:00 2001 From: Marvin Michael Manoury Date: Fri, 15 Nov 2024 11:57:27 +0100 Subject: [PATCH 1/3] Added test file --- Functions/Integration/Integration.sysml | 627 ++++++++++++++++++++++++ Functions/Integration/integrate.sh | 9 + 2 files changed, 636 insertions(+) create mode 100644 Functions/Integration/Integration.sysml create mode 100644 Functions/Integration/integrate.sh diff --git a/Functions/Integration/Integration.sysml b/Functions/Integration/Integration.sysml new file mode 100644 index 0000000..a3a78aa --- /dev/null +++ b/Functions/Integration/Integration.sysml @@ -0,0 +1,627 @@ +package 'Robotic Vacuum Cleaner'{ + + import Controller::*; + import Navigation::*; + import EnergySupplySystem::*; + import VacuumingSystem::*; + import RobotPortDefs::*; + + part def RoboticVacuumCleaner{ + part ControllerSystem : controller; + part NavigationSystem : navigation; + part EnergySystem : energySupplySystem; + part VacuumingSystem : vacuumingSystem; + + port driverUnitControlSignal : DriverUnitControlSignal; + port powerSignal : PowerSignal; + port dirtyAirFlow : DirtyAirFlow; + port cleanAirFlow : CleanAirFlow; + + interface : DriverUnitControlInterface connect + supliertPort ::> ControllerSystem.driverSignalOutputPort to + consumerPort ::> NavigationSystem.driverUnitControlSignalInputPort; + + // Interfaces to/from Vaccuming System + connect ControllerSystem to VacuumingSystem; + + // Control signal for level of suction intesity + interface def suctionLevelPorts { + end supplierPort : SuctionLevel; + end consumerPort : SuctionLevel; + } + + interface: suctionLevelPorts connect + supplierPort ::> ControllerSystem.suctionLevel to + consumerPort ::> VacuumingSystem.suctionLevel; + + // Control signal for brush rotation level + interface def brushRotationLevelPorts { + end supplierPort : BrushRotationLevel; + end consumerPort : BrushRotationLevel; + } + + interface: brushRotationLevelPorts connect + supplierPort ::> ControllerSystem.brushRotationLevel to + consumerPort ::> VacuumingSystem.bs.brushRotationLevel; + + // Current fill state of debris container + interface def fillStatePorts { + end supplierPort : FillState; + end consumerPort : FillState; + } + + interface: fillStatePorts connect + supplierPort ::> VacuumingSystem.fillState to + consumerPort ::> ControllerSystem.fillState; + + // Dirty air flow + interface def dirtyAirPorts { + end supplierPort : DirtyAirFlow; + end consumerPort : DirtyAirFlow; + } + + interface: dirtyAirPorts connect + supplierPort ::> dirtyAirFlow to + consumerPort ::> VacuumingSystem.dirtyAirFlow; + + // Clean air flow + interface def cleanAirPorts { + end supplierPort : CleanAirFlow; + end consumerPort : CleanAirFlow; + } + + interface: cleanAirPorts connect + supplierPort ::> VacuumingSystem.cleanAirFlow to + consumerPort ::> cleanAirFlow; + + } +} +package 'Energy Supply System' { + + import ScalarValues::*; + import RoboCleanRequirements::*; + import PortDef::*; + import Signals::*; + import Signals::BatterySignals::BatterySignal; + + doc /* + ======================================================================= + The following SysML v2 package specifies the battery + of the vacuum cleaner robot in a black-box fashion + ======================================================================= + */ + + part def Battery { + // Ports + port requriedEnergy : PowerInOutPort; // in + port providedEnergy : PowerInOutPort; // out + port batSig : BatterySignal; // out + + + // TOOD: Decompose in individual cells + + // TODO: Add battery management such as overcharging protection + } + + // The Energy supply system provides the electical energy for the robot vacuum cleaner + + attribute def essStatus { + statusLED : Integer; + SOC : Real; + } + + comment about essStatus + /* SOC = State of Charge */ + + part def Accumulator { + item def Energy; + attribute mass : Real; + // attribute TotCapacity : ActiveEnergyValue; + attribute TotCapacity; + + part def cell { + Capacity : Real; + Voltage : Real; + } + + part def cellConnector; + + attribute def layout { + numOfParCells : Integer; + numOfSerCells : Integer; + } + } + + part def BMS { // @Ralf: now instantiated by CPU? + // Maybe move to EnergySupply.sysml + // Parts + part def volSensor; + part def curSensor; + part def tempSensor; + part def microController; + part def Balancer; + + // Ports + port batSig : BatterySignal; + + } + + comment about BMS + /* BMS = Battery Management System */ + + part def Charger { + attribute power : Real; + attribute voltage : Real; + + part def Plug; + part def Converter; // ACDC Converter + part def batConector; + } +}package 'BatteryLevelComputer' { + + import Signals::*; + import ScalarValues::*; + import ControllerSignals::*; + import Signals::BatterySignals::BatterySignal; + + /** + * This part takes a BatterySignal as input and translates it into a + * color to be shown by the LED of EnergySupplySystem + */ + part def BatteryLevelComputer { + // Ports + port batSig : BatterySignal; // in + port ledSig : LEDSignal; // out + + // Attributes + attribute batteryCapacity : Real = 1000; + + // Behavior + // Realized through a StateChart which takes inputs from the incoming port + // and part attribute. Produces a return value to outgoing port ledSig. + exhibit state BatteryLevelComputerStates { + in ref batCap = batSig::curBatCapacity; + in ref maxBatCap = batteryCapacity; // 'this' would be nice + //out ref ledSig {color = computedColor;} + } + + } + + /** + * As actions need to be instnatiated somewhere, we leverage a very small + * statechart to perform the actual computations. + */ + state def BatteryLevelComputerStates { + entry; then x; // Initial state x + + // Definition of state x instantiates action + state x { + entry act {batCap; maxBatCap; computedColor;} + } + } + + action act : ComputeBatteryInfo{batCap; maxBatCap; computedColor;} + + /** + * The action ComputeBatteryInfo delegates to the calculation CalcBatteryLevel + */ + action def ComputeBatteryInfo{in batteryCapacity : Real; + in maxBatteryCapacity : Real; + out batteryColor : LED_COLOR = CalcBatteryLevel(batteryCapacity, maxBatteryCapacity); + } + + calc def CalcBatteryLevel{ + in energy : Real; + in capacity : Real; + + energy / capacity + } + +}package EnergySupplyProcessor { + + import BatteryLevelComputer::BatteryLevelComputer; + import Signals::BatterySignals::*; + + /** + * The CPU performs computations of the EnergySupplySystem. To this end + * it has two parts taking care of battery management and indicating the + * current battery level to the user. + */ + part def CPU { + // Parts + part blc : BatteryLevelComputer; + part bms : BatteryMangementSystem; // TODO: Needs to be defined and imported properly + + // Ports + port requriedEnergy : PowerInOutPort; // in + port batSig : BatterySignal; // in + port ledSig : LEDSignal; // out + + interface : BatterySignalInterface connect + src ::> batSig to + tgt ::> bms::batSig; + + interface : BatterySignalInterface connect + src ::> batSig to + tgt ::> blc::batSig; + + interface : LEDSignalInterface connect + src ::> batSig to + tgt ::> bms::ledSig; + } + + // just a surrogate + part def BatteryMangementSystem { + port batSig : BatterySignal; + port ledSig : LEDSignal; + } +} package DockingStation { + doc /* + ======================================================================= + The following SysML v2 package specifies the charging + station of the vacuum cleaner robot + ======================================================================= + */ + + import PortDef::*; + import Signals::*; + import Signals::ControllerSignals::PowerSignal; + + part def Station { + part charger : Charger; + } + + part def Charger { + port energy : PowerInOutPort; + port emergencyStop : ~BooleanSignal; + port powerSignal : ~PowerSignal; + } + + part charger : Charger; + +} +package EnergySupply { + doc /* + ======================================================================= + The following SysML v2 package specifies the energy + supply system of the vacuum cleaner robot + ======================================================================= + */ + + import PortDef::*; + import Signals::*; + import DockingStation::*; + import BatteryLevelComputer::*; + import 'Energy Supply System'::*; + import EnergySupplyProcessor::*; + import BLI::LED; + + + /* Part definitions */ + + part def EnergySupplySystem { + // Parts + part bat : Battery; + part cpu : CPU; + part led : LED; + + // Ports + port requiredEnergy : PowerInOutPort; // in + + // Connections + /* interface : RequiredEnergyInterface connect + src ::> requiredEnergy to + tgt ::> bat::requiredEnergy;*/ + + interface : PowerInterface connect + src ::> bat::providedEnergy to + tgt ::> cpu::requriedEnergy; + + interface : PowerInterface connect + src ::> bat::providedEnergy to + tgt ::> led::requriedEnergy; + + interface : BatterySignalInterface connect + src ::> bat::batSig to + tgt ::> cpu::batSig; + + interface : LEDSignalInterface connect + src ::> cpu::ledSig to + tgt ::> led::ledSignal; + + + } + +} +package 'EnergySupplyTypes' { + + import ScalarValues::*; + import Signals::ControllerSignals::*; + + doc /* + ======================================================================= + This package defines basic datatypes used throughout the EnergySupply + and related components + ======================================================================= + */ + + + // TODO: Should we use SI units? + + /// DATA TYPES /////////////////////////////////////////////////////////////// + + item def ElectricalEnergy; + + /// PORTS //////////////////////////////////////////////////////////////////// + + port def EnergyInOutPort { + inout item e : ElectricalEnergy; // TODO: units? + } + + port def RelativeBatteryLevelPort { + attribute voltageInPercent : ScalarValues::Real; + // TODO: Muss es hier ein flow feature geben + // in ??? wert : Real; + } + + port def BatteryLevelColorPort { + attribute color : LED_COLOR; + } + + /// CONNECTIONS /////////////////////////////////////////////////////////////// + + connection def WhySoComplicated { + end : ScalarValues::Real; + end : ScalarValues::Real; + } + + connection def EnergyToEnergy { + end : ElectricalEnergy; + end : ElectricalEnergy; + } + +} +package 'BLI' { + import PortDef::*; + import Signals::*; + import Signals::ControllerSignals::*; + import EnergySupplyTypes::*; + + part def LED { + // Ports + port ledSignal : LEDSignal; + port requriedEnergy : EnergyInOutPort; + } + + action def setColor{ + in color : LED_COLOR; + language "Java" + /* + * Here, we could pollute our model with actual Java code for a + * robot-specific middleware / implementation. With this being out of + * scope of this example, the body of this opaque method is empty. + */ + } +}package DriveUnit{ + // global imports + import ScalarValues::*; + import ISQ::*; + import SI::*; + import ISQElectromagnetism::*; + import partDef::*; + import PortDef::*; + + + part def logicalDriveUnit { + + part motor1 : dcMotor { + part tire1 redefines motorTire[1]; + } + part motor2 : dcMotor { + part tire2 redefines motorTire[1]; + } + part drvController : driveController{ + attribute redefines architecture = EeArchitecture::arm; //man muss bei "redefine" keinen neuen Namen vergeben. + } + part orientation : Lasertower; + part collision : Bumber; + part psuDetection : timeofFlightController; + + port powerSupply : DriveUnitPowerSupply; + port controlSignal : DriverUnitControlSignal; + + } + interface : PowerInterface connect supplierPort ::> logicalDriveUnit::powerSupply to consumerPort ::> logicalDriveUnit::motor1::psu; + interface : PowerInterface connect supplierPort ::> logicalDriveUnit::powerSupply to consumerPort ::> logicalDriveUnit::motor2::psu; + interface : PowerInterface connect supplierPort ::> logicalDriveUnit::powerSupply to consumerPort ::> logicalDriveUnit::orientation::psu; + + //satisfy Beschleunigen by driveUnit; // Funktioniert noch nicht + } + + package partDef +{ + import portDef::*; + + part def tire { + attribute diameter : LengthValue; //LengthValue kommt aus dem ISQ-Paket und beinhaltet ein Real und eine Einheit + } + + enum def EeArchitecture { + enum arm; + enum arm64; + enum i386; + enum amd64; + } + + part def driveController { + attribute architecture : EeArchitecture; + + part stearingController; + part orientationController; + } + + part def dcMotor { + attribute maxTorque :> ISQ::torque; // maximales Drehmoment + attribute rpm0 : Real; // Nenndrehzahl + attribute voltage :> ISQ::voltage; // Voltage; + + action def ConvertEletricalToMechanicalEnergy { + in current; + in voltage; + in rpm0; + out mechanicalEnergy; + + calc Torque; + } + + action def ProvideTorque { + in current; + in voltage; + in rpm0; + out torque:>ISQ::torque; + + bind convertEnergy::current = current; + bind convertEnergy::voltage = voltage; + bind convertEnergy::rpm0 = rpm0; + + action convertEnergy:ConvertEletricalToMechanicalEnergy {in current; in voltage; in rpm0; out mechanicalEnergy;} + + bind convertEnergy::mechanicalEnergy = torque; + + } + + port psu :powerSupplyPort; + port Torque : torque; + + part motorTire : tire [1..2]; + + state def motorDirection { + entry; then idle; + + state idle; + + transition idle_to_left + first idle + then left; + + transition idle_to_right + first idle + then right; + + state left; + + transition left_to_idle + first left + then idle; + + state right; + + transition right_to_idle + first right + then idle; + } + } + + part def Lasertower { + attribute distance : LengthValue; // abstand in meter + attribute distanceAngle : Real; // winkel der zum abstand gemessen wurden + attribute motor; // für das rotieren + port position : LaserTowerPosition; + port psu : powerSupplyPort; + } + + part def Bumber { + attribute isContact : Boolean; + + port Contact : contact; + } + + part def infrarotController{ + // berechnet Abbstand + //sendet signal + } + part def timeOfFlightSensor{ + port i2cSlave : i2c; + } + + part def timeofFlightController{ + part timeOfFlightSensor; + port psu : powerSupplyPort; + port i2cMaster : i2c; + + } +}package portDef{ + // global import + import ScalarValues::*; + import ISQ::*; + import SI::*; + import ISQElectromagnetism::*; + + port def powerSupplyPort{ + inout attribute power :> ISQElectromagnetism::instantaneousPower; // alias of electricPower + } + + port def mountingPort; + + port def externalPowerSupplyPort { + in attribute power :> ISQ::voltage; + in attribute ground :> ISQ::voltage; + } + + port def LaserTowerPosition{ + out attribute angle : Real; + out attribute distance: Real; + } + + port def contact; + port def torque; + + port def i2c{ + attribute SDA; + attribute SCL; + attribute vin; + attribute ground; + } + + port def psuSignal{ + attribute isChargingPositioN : Boolean; + } + + port def DriveUnitPowerSupply{ + inout attribute power :> ISQElectromagnetism::instantaneousPower; // alias of electricPower + } + + port def DriverUnitControlSignal{ + // this is an example port, there are other possibilities + in attribute forwards : Boolean; + in attribute left : Boolean; + in attribute right: Boolean; + } + package interfaceDef{ + import portDef::*; + + interface def EnergyInterface{ + end supplierPort { + in item energyIn; + out item energyOut; + } + end consumerPort{ + in item energyIn; + out item energyOut; + } + + flow supplierPort::energyOut to consumerPort::energyIn; + flow consumerPort::energyOut to supplierPort::energyIn; + } + + interface def PowerInterface{ + end supplierPort{ + inout item PowerInOut; + } + end consumerPort{ + inout item PowerInOut; + } + flow supplierPort::PowerInOut to consumerPort::PowerInOut; + } + } +} diff --git a/Functions/Integration/integrate.sh b/Functions/Integration/integrate.sh new file mode 100644 index 0000000..4db8b7b --- /dev/null +++ b/Functions/Integration/integrate.sh @@ -0,0 +1,9 @@ +#!/bin/bash +FILENAME="Integration" +cat *.sysml > $FILENAME.sysml + + +# "VacuumingSystem" mit Errors +for folder in "EnergySupplySystem" "NavigationSystem" ; do + cat ../$folder/*.sysml >> $FILENAME.sysml +done \ No newline at end of file From 1aa4fefb4049396fd55c1b204e99e75f1c4d1a9f Mon Sep 17 00:00:00 2001 From: Marvin Michael Manoury Date: Wed, 20 Nov 2024 18:24:00 +0100 Subject: [PATCH 2/3] added private declaration for imports and commented out errors --- .../ControllerSystem/ControllerSystem.sysml | 10 +++---- .../EnergySupplySystem.sysml | 2 +- .../NavigationSystem/NavigationSystem.sysml | 2 +- .../Ports&Signals/RobotPortDefs.sysml | 4 +-- .../Integration/Staubsaugerroboter.sysml | 14 +++++----- .../VacuumingSystem/BrushSystem.sysml | 24 ++++++++-------- .../VacuumingSystem/FilterSystem.sysml | 2 +- .../VacuumingSystem/SuctionDevice.sysml | 28 ++++++++++--------- .../VacuumingSystem/VacuumingSystem.sysml | 9 +++--- Functions/PortDef.sysml | 21 +++++++++++++- Functions/Signals.sysml | 6 ++-- 11 files changed, 72 insertions(+), 50 deletions(-) diff --git a/Functions/Integration/ControllerSystem/ControllerSystem.sysml b/Functions/Integration/ControllerSystem/ControllerSystem.sysml index 2603d03..5e62567 100644 --- a/Functions/Integration/ControllerSystem/ControllerSystem.sysml +++ b/Functions/Integration/ControllerSystem/ControllerSystem.sysml @@ -1,11 +1,11 @@ package Controller{ - import RobotPortDefs::*; - import Signals::ControllerSignals::*; + private import RobotPortDefs::*; + private import Signals::ControllerSignals::*; port def DriverUnitControlSignal { - out attribute forward : Boolean; - out attribute left : Boolean; - out attribute right : Boolean; + out attribute forward; + out attribute left; + out attribute right; } interface def DriverUnitControlInterface{ diff --git a/Functions/Integration/EnergySupplySystem/EnergySupplySystem.sysml b/Functions/Integration/EnergySupplySystem/EnergySupplySystem.sysml index 603bd3b..59bf53d 100644 --- a/Functions/Integration/EnergySupplySystem/EnergySupplySystem.sysml +++ b/Functions/Integration/EnergySupplySystem/EnergySupplySystem.sysml @@ -1,5 +1,5 @@ package EnergySupplySystem{ - import RobotPortDefs::*; + private import RobotPortDefs::*; part def energySupplySystem{ port powerSignal : PowerSignal; diff --git a/Functions/Integration/NavigationSystem/NavigationSystem.sysml b/Functions/Integration/NavigationSystem/NavigationSystem.sysml index 9a3ea38..8eb0197 100644 --- a/Functions/Integration/NavigationSystem/NavigationSystem.sysml +++ b/Functions/Integration/NavigationSystem/NavigationSystem.sysml @@ -2,7 +2,7 @@ package Navigation{ /*This module implements the Navigation-System * The Navigation-System is used for navigating the system */ - import Ports::*; + private import RobotPortDefs::*; private import Controller::*; private import Bumber::*; diff --git a/Functions/Integration/Ports&Signals/RobotPortDefs.sysml b/Functions/Integration/Ports&Signals/RobotPortDefs.sysml index f4c7ca8..9a2664e 100644 --- a/Functions/Integration/Ports&Signals/RobotPortDefs.sysml +++ b/Functions/Integration/Ports&Signals/RobotPortDefs.sysml @@ -1,7 +1,7 @@ package RobotPortDefs { - import ScalarValues::*; - import ISQ::*; + private import ScalarValues::*; + private import ISQ::*; // Ports for Navigation System diff --git a/Functions/Integration/Staubsaugerroboter.sysml b/Functions/Integration/Staubsaugerroboter.sysml index 3316811..6389d9a 100644 --- a/Functions/Integration/Staubsaugerroboter.sysml +++ b/Functions/Integration/Staubsaugerroboter.sysml @@ -1,10 +1,10 @@ package 'Robotic Vacuum Cleaner'{ - import Controller::*; - import Navigation::*; - import EnergySupplySystem::*; - import VacuumingSystem::*; - import RobotPortDefs::*; + private import Controller::*; + private import Navigation::*; + private import EnergySupplySystem::*; + private import VacuumingSystem::*; + private import RobotPortDefs::*; part def RoboticVacuumCleaner{ part ControllerSystem : controller; @@ -17,10 +17,10 @@ package 'Robotic Vacuum Cleaner'{ port dirtyAirFlow : DirtyAirFlow; port cleanAirFlow : CleanAirFlow; - interface : DriverUnitControlInterface connect + /*interface : DriverUnitControlInterface connect supliertPort ::> ControllerSystem.driverSignalOutputPort to consumerPort ::> NavigationSystem.driverUnitControlSignalInputPort; - + */ // Interfaces to/from Vaccuming System connect ControllerSystem to VacuumingSystem; diff --git a/Functions/Integration/VacuumingSystem/BrushSystem.sysml b/Functions/Integration/VacuumingSystem/BrushSystem.sysml index b73f7af..898280b 100644 --- a/Functions/Integration/VacuumingSystem/BrushSystem.sysml +++ b/Functions/Integration/VacuumingSystem/BrushSystem.sysml @@ -1,8 +1,8 @@ package BrushSystem { - import ScalarValues::*; - import RobotPortDefs::*; - import ISQSpaceTime::*; - + private import ScalarValues::*; + private import RobotPortDefs::*; + private import ISQSpaceTime::*; + /* calc def calcSetpointRPM { in rotationLevel : Real; in maxRPM :> ISQSpaceTime::rotationalFrequency; @@ -10,7 +10,7 @@ package BrushSystem { rotationLevel * maxRPM } - + */ part def MainBrush { port rotationSpeed : ~BrushRotationSpeed; } @@ -20,17 +20,17 @@ package BrushSystem { } part def BrushController { - port rotationSpeed : BrushRotationSpeed = setpointRPM.rotSpeed; + //port rotationSpeed : BrushRotationSpeed = setpointRPM.rotSpeed; port brushRotationLevel : ~BrushRotationLevel; attribute parMaxRPM :> ISQSpaceTime::rotationalFrequency; - + /* calc setpointRPM : calcSetpointRPM { in rotationLevel = brushRotationLevel::brushRotationLevel; in maxRPM = parMaxRPM; return rotSpeed; } - + */ } part def brushSystem{ @@ -48,22 +48,22 @@ package BrushSystem { end supplierPort : BrushRotationSpeed; end consumerPort : BrushRotationSpeed; } - + /* interface: rotationSetPointMainPorts connect supplierPort ::> bc.rotationSpeed to consumerPort ::> mb.rotationSpeed; connect bc to sb; - + */ interface def rotationSetPointSmallPorts { end supplierPort : BrushRotationSpeed; end consumerPort : BrushRotationSpeed; } - + /* interface: rotationSetPointSmallPorts connect supplierPort ::> bc.rotationSpeed to consumerPort ::> sb.rotationSpeed; - + */ } } diff --git a/Functions/Integration/VacuumingSystem/FilterSystem.sysml b/Functions/Integration/VacuumingSystem/FilterSystem.sysml index 77656f4..a82dbdb 100644 --- a/Functions/Integration/VacuumingSystem/FilterSystem.sysml +++ b/Functions/Integration/VacuumingSystem/FilterSystem.sysml @@ -1,6 +1,6 @@ package FilterSystem { - import RobotPortDefs::*; + private import RobotPortDefs::*; part def Tank { port debris : ~Debris; diff --git a/Functions/Integration/VacuumingSystem/SuctionDevice.sysml b/Functions/Integration/VacuumingSystem/SuctionDevice.sysml index 30b0523..550a930 100644 --- a/Functions/Integration/VacuumingSystem/SuctionDevice.sysml +++ b/Functions/Integration/VacuumingSystem/SuctionDevice.sysml @@ -1,11 +1,12 @@ package SuctionDevice { - import RobotPortDefs::*; - import ISQ::*; - import ISQMechanics::*; - import ISQSpaceTime::*; - import ScalarValues::*; - + private import RobotPortDefs::*; + private import Ports::*; + private import ISQ::*; + private import ISQMechanics::*; + private import ISQSpaceTime::*; + private import ScalarValues::*; +/* calc def calcActualPower { in powerLevel : Real; in maxPower : PowerValue; @@ -27,38 +28,39 @@ package SuctionDevice { return : ISQSpaceTime::volume; // not sure how to model without time steps - } + }*/ part def SuctionMotor { port suctionLevel : ~SuctionLevel; port suctionPower : SuctionPower { - suctionPower = powerOut.res; + //suctionPower = powerOut.res; } attribute parMaxPower :> ISQ::power; - + /* calc powerOut : calcActualPower { in powerLevel = suctionLevel::suctionLevel; in maxPower = parMaxPower; return res; - } + + }*/ } part def SuctionChamber { port dirtyAirFlowIn : DirtyAirFlow; port dirtyAirFlowOut : ~DirtyAirFlow { - dirtyAirFlow = flowRate.currentFlowRate; + //dirtyAirFlow = flowRate.currentFlowRate; } port suctionPower : ~SuctionPower; attribute parDiffPressure :> ISQ::pressure; - + /* calc flowRate : calcFlowRate { in inFlow = dirtyAirFlowIn::dirtyAirFlow; in volFlow = calcVolFlow(suctionPower::suctionPower, parDiffPressure); return currentFlowRate; - } + }*/ } part def suctionDevice { diff --git a/Functions/Integration/VacuumingSystem/VacuumingSystem.sysml b/Functions/Integration/VacuumingSystem/VacuumingSystem.sysml index 1f68683..328fb0a 100644 --- a/Functions/Integration/VacuumingSystem/VacuumingSystem.sysml +++ b/Functions/Integration/VacuumingSystem/VacuumingSystem.sysml @@ -1,8 +1,9 @@ package VacuumingSystem{ - import BrushSystem::*; - import SuctionDevice::*; - import FilterSystem::*; - import Ports::*; + private import BrushSystem::*; + private import SuctionDevice::*; + private import FilterSystem::*; + private import Ports::*; + private import RobotPortDefs::*; part def vacuumingSystem{ part bs : brushSystem; diff --git a/Functions/PortDef.sysml b/Functions/PortDef.sysml index 392cf0d..5d10fe4 100644 --- a/Functions/PortDef.sysml +++ b/Functions/PortDef.sysml @@ -1 +1,20 @@ -package PortDef { doc /* ======================================================================= The following SysML v2 package DEFINES a power port R. Schuler, June 2021 ======================================================================= */ import ISQ::*; port def PowerInOutPort{ inout attribute power :> ISQElectromagnetism::instantaneousPower; } interface def PowerInterface { end supplierPort : PowerInOutPort; end consumerPort : PowerInOutPort; } } \ No newline at end of file +package PortDef { + doc /* + ======================================================================= + The following SysML v2 package DEFINES + a power port + R. Schuler, June 2021 + ======================================================================= + */ + + private import ISQ::*; + + port def PowerInOutPort{ + inout attribute power :> ISQElectromagnetism::instantaneousPower; + } + + interface def PowerInterface { + end supplierPort : PowerInOutPort; + end consumerPort : PowerInOutPort; + } +} \ No newline at end of file diff --git a/Functions/Signals.sysml b/Functions/Signals.sysml index 0d3403c..39f8186 100644 --- a/Functions/Signals.sysml +++ b/Functions/Signals.sysml @@ -6,8 +6,8 @@ package Signals { ======================================================================= */ - import ScalarValues::*; - import ISQ::*; + private import ScalarValues::*; + private import ISQ::*; /* Primitive and basic signals */ @@ -74,7 +74,7 @@ package Signals { package BatterySignals { - import Signals::ControllerSignals::*; + private import Signals::ControllerSignals::*; port def PowerInOutPort{ inout attribute :> ISQMechanics::power; From f5a84d3f6d2aa9acf7e1061789404ea41492a850 Mon Sep 17 00:00:00 2001 From: Marvin Michael Manoury Date: Wed, 20 Nov 2024 18:24:31 +0100 Subject: [PATCH 3/3] added folders in scripts --- Functions/Integration/Integration.sysml | 1124 +++++++++++++---------- Functions/Integration/integrate.sh | 8 +- 2 files changed, 664 insertions(+), 468 deletions(-) diff --git a/Functions/Integration/Integration.sysml b/Functions/Integration/Integration.sysml index a3a78aa..65bd0e4 100644 --- a/Functions/Integration/Integration.sysml +++ b/Functions/Integration/Integration.sysml @@ -1,10 +1,10 @@ package 'Robotic Vacuum Cleaner'{ - import Controller::*; - import Navigation::*; - import EnergySupplySystem::*; - import VacuumingSystem::*; - import RobotPortDefs::*; + private import Controller::*; + private import Navigation::*; + private import EnergySupplySystem::*; + private import VacuumingSystem::*; + private import RobotPortDefs::*; part def RoboticVacuumCleaner{ part ControllerSystem : controller; @@ -17,10 +17,10 @@ package 'Robotic Vacuum Cleaner'{ port dirtyAirFlow : DirtyAirFlow; port cleanAirFlow : CleanAirFlow; - interface : DriverUnitControlInterface connect + /*interface : DriverUnitControlInterface connect supliertPort ::> ControllerSystem.driverSignalOutputPort to consumerPort ::> NavigationSystem.driverUnitControlSignalInputPort; - + */ // Interfaces to/from Vaccuming System connect ControllerSystem to VacuumingSystem; @@ -76,424 +76,677 @@ package 'Robotic Vacuum Cleaner'{ } } -package 'Energy Supply System' { - - import ScalarValues::*; - import RoboCleanRequirements::*; - import PortDef::*; - import Signals::*; - import Signals::BatterySignals::BatterySignal; - - doc /* +package PortDef { + doc /* ======================================================================= - The following SysML v2 package specifies the battery - of the vacuum cleaner robot in a black-box fashion + The following SysML v2 package DEFINES + a power port + R. Schuler, June 2021 ======================================================================= - */ - - part def Battery { - // Ports - port requriedEnergy : PowerInOutPort; // in - port providedEnergy : PowerInOutPort; // out - port batSig : BatterySignal; // out + */ + + private import ISQ::*; + + port def PowerInOutPort{ + inout attribute power :> ISQElectromagnetism::instantaneousPower; + } + interface def PowerInterface { + end supplierPort : PowerInOutPort; + end consumerPort : PowerInOutPort; + } +}package Signals { + doc /* + ======================================================================= + The following SysML v2 package DEFINES + multiple signal ports and interfaces + ======================================================================= + */ - // TOOD: Decompose in individual cells + private import ScalarValues::*; + private import ISQ::*; - // TODO: Add battery management such as overcharging protection - } - - // The Energy supply system provides the electical energy for the robot vacuum cleaner - - attribute def essStatus { - statusLED : Integer; - SOC : Real; - } - - comment about essStatus - /* SOC = State of Charge */ - - part def Accumulator { - item def Energy; - attribute mass : Real; - // attribute TotCapacity : ActiveEnergyValue; - attribute TotCapacity; + /* Primitive and basic signals */ - part def cell { - Capacity : Real; - Voltage : Real; + port def BooleanSignal { + out attribute val : Boolean; } - part def cellConnector; - - attribute def layout { - numOfParCells : Integer; - numOfSerCells : Integer; + interface def BooleanSignalInterface { + end src : BooleanSignal; + end tgt : ~BooleanSignal; } - } - - part def BMS { // @Ralf: now instantiated by CPU? - // Maybe move to EnergySupply.sysml - // Parts - part def volSensor; - part def curSensor; - part def tempSensor; - part def microController; - part def Balancer; - - // Ports - port batSig : BatterySignal; - - } - - comment about BMS - /* BMS = Battery Management System */ - - part def Charger { - attribute power : Real; - attribute voltage : Real; - part def Plug; - part def Converter; // ACDC Converter - part def batConector; - } -}package 'BatteryLevelComputer' { - - import Signals::*; - import ScalarValues::*; - import ControllerSignals::*; - import Signals::BatterySignals::BatterySignal; - - /** - * This part takes a BatterySignal as input and translates it into a - * color to be shown by the LED of EnergySupplySystem - */ - part def BatteryLevelComputer { - // Ports - port batSig : BatterySignal; // in - port ledSig : LEDSignal; // out - - // Attributes - attribute batteryCapacity : Real = 1000; + port def NumericSignal { + out attribute val : Real; + } - // Behavior - // Realized through a StateChart which takes inputs from the incoming port - // and part attribute. Produces a return value to outgoing port ledSig. - exhibit state BatteryLevelComputerStates { - in ref batCap = batSig::curBatCapacity; - in ref maxBatCap = batteryCapacity; // 'this' would be nice - //out ref ledSig {color = computedColor;} + interface def NumericSignalInterface { + end src : NumericSignal; + end tgt : ~NumericSignal; } - } - - /** - * As actions need to be instnatiated somewhere, we leverage a very small - * statechart to perform the actual computations. - */ - state def BatteryLevelComputerStates { - entry; then x; // Initial state x - - // Definition of state x instantiates action - state x { - entry act {batCap; maxBatCap; computedColor;} - } - } + + /* Customized and advanced signals of the different sub-systems */ + + package ControllerSignals { - action act : ComputeBatteryInfo{batCap; maxBatCap; computedColor;} - - /** - * The action ComputeBatteryInfo delegates to the calculation CalcBatteryLevel - */ - action def ComputeBatteryInfo{in batteryCapacity : Real; - in maxBatteryCapacity : Real; - out batteryColor : LED_COLOR = CalcBatteryLevel(batteryCapacity, maxBatteryCapacity); - } - - calc def CalcBatteryLevel{ - in energy : Real; - in capacity : Real; - - energy / capacity - } + port def PowerSignal { + out attribute constantCurrent :> totalCurrent; + out attribute constantVoltage :> voltage; + } -}package EnergySupplyProcessor { - - import BatteryLevelComputer::BatteryLevelComputer; - import Signals::BatterySignals::*; - - /** - * The CPU performs computations of the EnergySupplySystem. To this end - * it has two parts taking care of battery management and indicating the - * current battery level to the user. - */ - part def CPU { - // Parts - part blc : BatteryLevelComputer; - part bms : BatteryMangementSystem; // TODO: Needs to be defined and imported properly - - // Ports - port requriedEnergy : PowerInOutPort; // in - port batSig : BatterySignal; // in - port ledSig : LEDSignal; // out - - interface : BatterySignalInterface connect - src ::> batSig to - tgt ::> bms::batSig; - - interface : BatterySignalInterface connect - src ::> batSig to - tgt ::> blc::batSig; - - interface : LEDSignalInterface connect - src ::> batSig to - tgt ::> bms::ledSig; - } + interface def PowerSignalInterface { + end src : PowerSignal; + end tgt : ~PowerSignal; + } - // just a surrogate - part def BatteryMangementSystem { - port batSig : BatterySignal; - port ledSig : LEDSignal; - } -} package DockingStation { - doc /* - ======================================================================= - The following SysML v2 package specifies the charging - station of the vacuum cleaner robot - ======================================================================= - */ - - import PortDef::*; - import Signals::*; - import Signals::ControllerSignals::PowerSignal; + port def DriverUnitControlSignal { + out attribute forwards : Boolean; + out attribute left : Boolean; + out attribute right : Boolean; + } - part def Station { - part charger : Charger; + interface def DriverUnitControlInterface { + end src : DriverUnitControlSignal; + end tgt : ~DriverUnitControlSignal; + } + + port def LEDSignal { + out color : LED_COLOR; + } + + interface def LEDInterface { + end src : LEDSignal; + end tgt : ~LEDSignal; + } + + enum def LED_COLOR { + RED; + YELLOW; + GREEN; + } + } - part def Charger { - port energy : PowerInOutPort; - port emergencyStop : ~BooleanSignal; - port powerSignal : ~PowerSignal; + package BatterySignals { + + private import Signals::ControllerSignals::*; + + port def PowerInOutPort{ + inout attribute :> ISQMechanics::power; + } + + interface def PowerInterface { + end supplierPort : PowerInOutPort; + end consumerPort : PowerInOutPort; + } + + /* wurde in "out" umbenannt, da konjugation sinnvoller ist*/ + port def VacuumSystemPowerOutPort { + out attribute suctionPower :> ISQMechanics::power; + out attribute brushPower :> ISQMechanics::power; + } + + interface def VacuumSystemPowerInterface { + end supplierPort : VacuumSystemPowerOutPort; + end consumerPort : VacuumSystemPowerOutPort; + } + + port def LEDSignal { + inout attribute color : LED_COLOR; + } + + interface def LEDSignalInterface { + end supplierPort : LEDSignal; + end consumerPort : LEDSignal; + } + + port def BatterySignal { // @Ralf: hier bitte ergänzen + // current capactity of battery + inout attribute curBatCapacity : Real; + + } + + interface def BatterySignalInterface { + end supplierPort : BatterySignal; + end consumerPort : BatterySignal; + } } - part charger : Charger; -} -package EnergySupply { - doc /* - ======================================================================= - The following SysML v2 package specifies the energy - supply system of the vacuum cleaner robot - ======================================================================= - */ - import PortDef::*; - import Signals::*; - import DockingStation::*; - import BatteryLevelComputer::*; - import 'Energy Supply System'::*; - import EnergySupplyProcessor::*; - import BLI::LED; +}package RobotPortDefs { + + private import ScalarValues::*; + private import ISQ::*; + + // Ports for Navigation System - /* Part definitions */ - - part def EnergySupplySystem { - // Parts - part bat : Battery; - part cpu : CPU; - part led : LED; + port def PowerSignal { + out constantCurrent :> totalCurrent; + out constantVoltage :> voltage; + } - // Ports - port requiredEnergy : PowerInOutPort; // in + // Ports for Vacuuming System - // Connections - /* interface : RequiredEnergyInterface connect - src ::> requiredEnergy to - tgt ::> bat::requiredEnergy;*/ + port def DirtyAirFlow { + out dirtyAirFlow :> ISQSpaceTime::volume; + } - interface : PowerInterface connect - src ::> bat::providedEnergy to - tgt ::> cpu::requriedEnergy; + port def CleanAirFlow { + out cleanAirFlow :> ISQSpaceTime::volume; + } - interface : PowerInterface connect - src ::> bat::providedEnergy to - tgt ::> led::requriedEnergy; + port def Debris { + out debrisVolume :> SI::'m³'; + out debrisMass :> SI::kg; + } - interface : BatterySignalInterface connect - src ::> bat::batSig to - tgt ::> cpu::batSig; + port def FillState { + out fillState : Real; + } - interface : LEDSignalInterface connect - src ::> cpu::ledSig to - tgt ::> led::ledSignal; + port def SuctionLevel { + out suctionLevel : Real; + } + port def SuctionPower { + out suctionPower :> ISQ::power; + } + port def BrushRotationLevel { + out brushRotationLevel : Real; } - -} -package 'EnergySupplyTypes' { - import ScalarValues::*; - import Signals::ControllerSignals::*; + port def BrushRotationSpeed { + out brushRotationSpeed :> ISQSpaceTime::rotationalFrequency; + } - doc /* - ======================================================================= - This package defines basic datatypes used throughout the EnergySupply - and related components - ======================================================================= - */ +}package EnergySupplySystem{ + private import RobotPortDefs::*; + + part def energySupplySystem{ + port powerSignal : PowerSignal; + } +}package Navigation{ +/*This module implements the Navigation-System + * The Navigation-System is used for navigating the system + */ + private import RobotPortDefs::*; + + private import Controller::*; + private import Bumber::*; + private import Engine::*; + private import LaserTower::*; + private import DriveController::*; + private import InfraredController::*; + + + part def navigation{ + part DriveController : driveController; + part Engine[2] : engine; + part LaserTower : laserTower; + part Bumber : bumber; + part InfraredController : infraredController; + + port driverUnitControlSignalInputPort : ~DriverUnitControlSignal; + port powerSignal : PowerSignal; - // TODO: Should we use SI units? + bind driverUnitControlSignalInputPort = DriveController.driverUnitControlSignalInputPort; - /// DATA TYPES /////////////////////////////////////////////////////////////// - - item def ElectricalEnergy; + interface : bumberInterface connect + suppliertPort ::> Bumber.CollisionOutputPort to + consumerPort ::> DriveController.CollisionInputPort; + + interface : laserTowerInterface connect + supplierPort ::> LaserTower.LaserTowerPositionOutputPort to + consumerPort ::> DriveController.LaserTowerInputPort; + + interface : infraredControllerInterface connect + supplierPort ::> InfraredController.ContactChargerOutputPort to + consumerPort ::> DriveController.ContactChargerInputPort; + + interface : pwmControllInterface connect + suppliertPort ::> Engine.PwmInputPort to + consumerPort ::> DriveController.PwmOutputPort; - /// PORTS //////////////////////////////////////////////////////////////////// - - port def EnergyInOutPort { - inout item e : ElectricalEnergy; // TODO: units? } - - port def RelativeBatteryLevelPort { - attribute voltageInPercent : ScalarValues::Real; - // TODO: Muss es hier ein flow feature geben - // in ??? wert : Real; - } - - port def BatteryLevelColorPort { - attribute color : LED_COLOR; - } - - /// CONNECTIONS /////////////////////////////////////////////////////////////// - - connection def WhySoComplicated { - end : ScalarValues::Real; - end : ScalarValues::Real; - } +}package Controller{ + private import RobotPortDefs::*; + private import Signals::ControllerSignals::*; + + port def DriverUnitControlSignal { + out attribute forward; + out attribute left; + out attribute right; + } - connection def EnergyToEnergy { - end : ElectricalEnergy; - end : ElectricalEnergy; - } - + interface def DriverUnitControlInterface{ + end supplierPort : DriverUnitControlSignal; + end consumerPort : ~DriverUnitControlSignal; + + flow supplierPort.forward to consumerPort.forward; + flow supplierPort.left to consumerPort.left; + flow supplierPort.right to consumerPort.right; + } + + part def controller{ + port driverSignalOutputPort : DriverUnitControlSignal; + port powerSignal : ~PowerSignal; + + // To Vacuuming System + port suctionLevel : SuctionLevel; + port brushRotationLevel : BrushRotationLevel; + + // From Vacuuming System + port fillState : ~FillState; + } } -package 'BLI' { - import PortDef::*; - import Signals::*; - import Signals::ControllerSignals::*; - import EnergySupplyTypes::*; - - part def LED { - // Ports - port ledSignal : LEDSignal; - port requriedEnergy : EnergyInOutPort; - } - - action def setColor{ - in color : LED_COLOR; - language "Java" - /* - * Here, we could pollute our model with actual Java code for a - * robot-specific middleware / implementation. With this being out of - * scope of this example, the body of this opaque method is empty. - */ +package BrushSystem { + private import ScalarValues::*; + private import RobotPortDefs::*; + private import ISQSpaceTime::*; + /* + calc def calcSetpointRPM { + in rotationLevel : Real; + in maxRPM :> ISQSpaceTime::rotationalFrequency; + return : ISQSpaceTime::rotationalFrequency; + + rotationLevel * maxRPM + } + */ + part def MainBrush { + port rotationSpeed : ~BrushRotationSpeed; } -}package DriveUnit{ - // global imports - import ScalarValues::*; - import ISQ::*; - import SI::*; - import ISQElectromagnetism::*; - import partDef::*; - import PortDef::*; - - - part def logicalDriveUnit { + + part def SmallBrush { + port rotationSpeed : ~BrushRotationSpeed; + } + + part def BrushController { + //port rotationSpeed : BrushRotationSpeed = setpointRPM.rotSpeed; + port brushRotationLevel : ~BrushRotationLevel; + + attribute parMaxRPM :> ISQSpaceTime::rotationalFrequency; + /* + calc setpointRPM : calcSetpointRPM { + in rotationLevel = brushRotationLevel::brushRotationLevel; + in maxRPM = parMaxRPM; + return rotSpeed; + } + */ + } + + part def brushSystem{ + part mb : MainBrush; + part sb : SmallBrush[2]; + part bc : BrushController{ + attribute redefines parMaxRPM = 167; // 10000 rpm is a common rotational speed of the brushes, recalculation because rotationalFrequency is [1/s] + } + + port brushRotationLevel : ~BrushRotationLevel; + + connect bc to mb; + + interface def rotationSetPointMainPorts { + end supplierPort : BrushRotationSpeed; + end consumerPort : BrushRotationSpeed; + } + /* + interface: rotationSetPointMainPorts connect + supplierPort ::> bc.rotationSpeed to + consumerPort ::> mb.rotationSpeed; + + connect bc to sb; + */ + interface def rotationSetPointSmallPorts { + end supplierPort : BrushRotationSpeed; + end consumerPort : BrushRotationSpeed; + } + /* + interface: rotationSetPointSmallPorts connect + supplierPort ::> bc.rotationSpeed to + consumerPort ::> sb.rotationSpeed; + */ + } +} + + package FilterSystem { - part motor1 : dcMotor { - part tire1 redefines motorTire[1]; - } - part motor2 : dcMotor { - part tire2 redefines motorTire[1]; - } - part drvController : driveController{ - attribute redefines architecture = EeArchitecture::arm; //man muss bei "redefine" keinen neuen Namen vergeben. - } - part orientation : Lasertower; - part collision : Bumber; - part psuDetection : timeofFlightController; - - port powerSupply : DriveUnitPowerSupply; - port controlSignal : DriverUnitControlSignal; + private import RobotPortDefs::*; + + part def Tank { + port debris : ~Debris; + port fillState : FillState; + + // Missing State Machine + } + + part def Filter { + port dirtyAirFlow : DirtyAirFlow; + port cleanAirFlow : CleanAirFlow; + port debris : Debris; + } + + part def filterSystem { + port dirtyAirFlow : DirtyAirFlow; + port cleanAirFlow : CleanAirFlow; + port fillState : FillState; + + part filterCmp : Filter; + part tank : Tank; + + interface def dirtyAirFlowPorts { + end supplierPort : DirtyAirFlow; + end consumerPort : DirtyAirFlow; + } + + interface: dirtyAirFlowPorts connect + supplierPort ::> dirtyAirFlow to + consumerPort ::> filterCmp.dirtyAirFlow; + + interface def cleanAirFlowPorts { + end supplierPort : CleanAirFlow; + end consumerPort : CleanAirFlow; + } + + interface: cleanAirFlowPorts connect + supplierPort ::> filterCmp.cleanAirFlow to + consumerPort ::> cleanAirFlow; + + connect filterCmp to tank; + + interface def debrisPorts { + end supplierPort : Debris; + end consumerPort : Debris; + } + + interface: dirtyAirFlowPorts connect + supplierPort ::> filterCmp.debris to + consumerPort ::> tank.debris; + + interface def fillStatePorts { + end supplierPort : FillState; + end consumerPort : FillState; + } + + interface: fillStatePorts connect + supplierPort ::> tank.fillState to + consumerPort ::> fillState; + } +}package SuctionDevice { + + private import RobotPortDefs::*; + private import Ports::*; + private import ISQ::*; + private import ISQMechanics::*; + private import ISQSpaceTime::*; + private import ScalarValues::*; +/* + calc def calcActualPower { + in powerLevel : Real; + in maxPower : PowerValue; + + return PowerValue = powerLevel * maxPower; + } + + calc def calcVolFlow { + in setpointPower :> ISQ::power; + in diffPressure :> ISQ::pressure; + return : ISQMechanics::volumeFlowRate = setpointPower / diffPressure; } - interface : PowerInterface connect supplierPort ::> logicalDriveUnit::powerSupply to consumerPort ::> logicalDriveUnit::motor1::psu; - interface : PowerInterface connect supplierPort ::> logicalDriveUnit::powerSupply to consumerPort ::> logicalDriveUnit::motor2::psu; - interface : PowerInterface connect supplierPort ::> logicalDriveUnit::powerSupply to consumerPort ::> logicalDriveUnit::orientation::psu; + + calc def calcFlowRate { + in inFlow :> ISQSpaceTime::volume; + in volFlow :> ISQMechanics::volumeFlowRate; - //satisfy Beschleunigen by driveUnit; // Funktioniert noch nicht + return : ISQSpaceTime::volume; + // not sure how to model without time steps + + }*/ + + part def SuctionMotor { + port suctionLevel : ~SuctionLevel; + port suctionPower : SuctionPower { + //suctionPower = powerOut.res; + } + + attribute parMaxPower :> ISQ::power; + /* + calc powerOut : calcActualPower { + in powerLevel = suctionLevel::suctionLevel; + in maxPower = parMaxPower; + return res; + + }*/ + + } + + part def SuctionChamber { + port dirtyAirFlowIn : DirtyAirFlow; + port dirtyAirFlowOut : ~DirtyAirFlow { + //dirtyAirFlow = flowRate.currentFlowRate; + } + port suctionPower : ~SuctionPower; + + attribute parDiffPressure :> ISQ::pressure; + /* + calc flowRate : calcFlowRate { + in inFlow = dirtyAirFlowIn::dirtyAirFlow; + in volFlow = calcVolFlow(suctionPower::suctionPower, parDiffPressure); + return currentFlowRate; + }*/ } + + part def suctionDevice { + part sm : SuctionMotor; + part sc : SuctionChamber { + attribute redefines parDiffPressure = 25000; // 25kPa is a common pressure difference for suction devices + } + + port dirtyAirFlowIn : DirtyAirFlow; + port dirtyAirFlowOut : ~DirtyAirFlow; + port suctionLevel : ~SuctionLevel; - package partDef -{ - import portDef::*; + interface def dirtyAirFlowInPorts { + end supplierPort : DirtyAirFlow; + end consumerPort : DirtyAirFlow; + } + + interface: dirtyAirFlowInPorts connect + supplierPort ::> dirtyAirFlowIn to + consumerPort ::> sc.dirtyAirFlowIn; + + interface def dirtyAirFlowOutPorts { + end supplierPort : DirtyAirFlow; + end consumerPort : DirtyAirFlow; + } + + interface: dirtyAirFlowOutPorts connect + supplierPort ::> sc.dirtyAirFlowOut to + consumerPort ::> dirtyAirFlowOut; + + interface def suctionLevelPorts { + end supplierPort : SuctionLevel; + end consumerPort : SuctionLevel; + } + + interface: suctionLevelPorts connect + supplierPort ::> suctionLevel to + consumerPort ::> sm.suctionLevel; - part def tire { - attribute diameter : LengthValue; //LengthValue kommt aus dem ISQ-Paket und beinhaltet ein Real und eine Einheit - } + connect sm to sc; + + interface def suctionPowerPorts { + end supplierPort : SuctionPower; + end consumerPort : SuctionPower; + } + + interface: suctionPowerPorts connect + supplierPort ::> sm.suctionPower to + consumerPort ::> sc.suctionPower; + } +}package VacuumingSystem{ + private import BrushSystem::*; + private import SuctionDevice::*; + private import FilterSystem::*; + private import Ports::*; + private import RobotPortDefs::*; + + part def vacuumingSystem{ + part bs : brushSystem; + part sd : suctionDevice; + part fs : filterSystem; + + port dirtyAirFlow : DirtyAirFlow; + port cleanAirFlow : CleanAirFlow; + port debris : Debris; + port fillState : FillState; + port suctionLevel : ~SuctionLevel; + port brushRotationLevel : ~BrushRotationLevel; + + interface def rotationLevelPorts { + end supplierPort : BrushRotationLevel; + end consumerPort : BrushRotationLevel; + } + + interface: rotationLevelPorts connect + supplierPort ::> brushRotationLevel to + consumerPort ::> bs.brushRotationLevel; + + interface def externalDirtyAirPorts { + end supplierPort : DirtyAirFlow; + end consumerPort : DirtyAirFlow; + } + + interface: externalDirtyAirPorts connect + supplierPort ::> dirtyAirFlow to + consumerPort ::> sd.dirtyAirFlowIn; + + connect sd to fs; + + interface def internalDirtyAirPorts { + end supplierPort : DirtyAirFlow; + end consumerPort : DirtyAirFlow; + } + + interface: internalDirtyAirPorts connect + supplierPort ::> sd.dirtyAirFlowOut to + consumerPort ::> fs.dirtyAirFlow; + + interface def cleanAirPorts { + end supplierPort : CleanAirFlow; + end consumerPort : CleanAirFlow; + } + + interface: cleanAirPorts connect + supplierPort ::> fs.cleanAirFlow to + consumerPort ::> cleanAirFlow; + + interface def suctionLevelPorts { + end supplierPort : SuctionLevel; + end consumerPort : SuctionLevel; + } + + interface: suctionLevelPorts connect + supplierPort ::> suctionLevel to + consumerPort ::> sd.suctionLevel; + + interface def fillStatePorts { + end supplierPort : FillState; + end consumerPort : FillState; + } + + interface: fillStatePorts connect + supplierPort ::> fs.fillState to + consumerPort ::> fillState; + } +}package Bumber{ + /* This package implements the Bumber-System + * The Bumber detects collision*/ + + item def collisionDetection; + + port def collision { + out item CollisionDetection : collisionDetection; + } - enum def EeArchitecture { - enum arm; - enum arm64; - enum i386; - enum amd64; + interface def bumberInterface{ + end supplierPort : collision; + end consumerPort : ~collision; + + flow supplierPort.CollisionDetection to consumerPort.CollisionDetection; + } + + part def bumber { + port CollisionOutputPort : collision; + } +}package DriveController{ +/* This package implements the DriveContoller-System + * The DriveController drives the system*/ + + private import Controller::*; + private import Bumber::*; + private import Engine::*; + private import LaserTower::*; + private import InfraredController::*; + private import InfraredController::infraredController; + + + part def stearingController{ + port PwmOutputPort : ~pwmPort; + port driverUnitControlSignalInputPort : ~DriverUnitControlSignal; + } + + part def orienttationController{ + port CollisionInputPort : ~collision; + port LaserTowerInputPort : ~laserTowerPosition; + port ContactChargerInputPort : ~contactCharger; } part def driveController { - attribute architecture : EeArchitecture; + port CollisionInputPort : ~collision; + port LaserTowerInputPort : ~laserTowerPosition; + port PwmOutputPort : ~pwmPort; + port ContactChargerInputPort : ~contactCharger; + port driverUnitControlSignalInputPort : ~DriverUnitControlSignal; + + part StearingController : stearingController; + part OrientationController : orienttationController; - part stearingController; - part orientationController; - } + bind CollisionInputPort = OrientationController.CollisionInputPort; + bind PwmOutputPort = StearingController.PwmOutputPort; + bind LaserTowerInputPort = OrientationController.LaserTowerInputPort; + bind driverUnitControlSignalInputPort = StearingController.driverUnitControlSignalInputPort; + + } +}package Engine{ + /* This package implements the Engine-System + * The engine drives the system*/ + + part def Tire; + item def pwm; - part def dcMotor { - attribute maxTorque :> ISQ::torque; // maximales Drehmoment - attribute rpm0 : Real; // Nenndrehzahl - attribute voltage :> ISQ::voltage; // Voltage; - - action def ConvertEletricalToMechanicalEnergy { - in current; - in voltage; - in rpm0; - out mechanicalEnergy; + port def pwmPort{ + in item PWM : pwm; + } + + interface def pwmControllInterface{ + end supplierPort : pwmPort; + end consumerPort : ~pwmPort; + + flow supplierPort.PWM to consumerPort.PWM; + } - calc Torque; - } + part def engine { - action def ProvideTorque { - in current; - in voltage; - in rpm0; - out torque:>ISQ::torque; - - bind convertEnergy::current = current; - bind convertEnergy::voltage = voltage; - bind convertEnergy::rpm0 = rpm0; - - action convertEnergy:ConvertEletricalToMechanicalEnergy {in current; in voltage; in rpm0; out mechanicalEnergy;} - - bind convertEnergy::mechanicalEnergy = torque; - - } - - port psu :powerSupplyPort; - port Torque : torque; + part motorTire : Tire [2]; - part motorTire : tire [1..2]; + port PwmInputPort : pwmPort; state def motorDirection { entry; then idle; @@ -507,7 +760,7 @@ package 'BLI' { transition idle_to_right first idle then right; - + state left; transition left_to_idle @@ -519,109 +772,50 @@ package 'BLI' { transition right_to_idle first right then idle; + } } - } - - part def Lasertower { - attribute distance : LengthValue; // abstand in meter - attribute distanceAngle : Real; // winkel der zum abstand gemessen wurden - attribute motor; // für das rotieren - port position : LaserTowerPosition; - port psu : powerSupplyPort; - } - - part def Bumber { - attribute isContact : Boolean; +}package InfraredController{ +/*This module implements the InfrarotControler subsystem + * The InfrarotControler is to ensure the position to charging point */ - port Contact : contact; - } + item def contact; - part def infrarotController{ - // berechnet Abbstand - //sendet signal - } - part def timeOfFlightSensor{ - port i2cSlave : i2c; - } - - part def timeofFlightController{ - part timeOfFlightSensor; - port psu : powerSupplyPort; - port i2cMaster : i2c; - - } -}package portDef{ - // global import - import ScalarValues::*; - import ISQ::*; - import SI::*; - import ISQElectromagnetism::*; + port def contactCharger{ + out item Contact : contact; + } + + interface def infraredControllerInterface{ + end supplierPort : contactCharger; + end consumerPort : ~contactCharger; - port def powerSupplyPort{ - inout attribute power :> ISQElectromagnetism::instantaneousPower; // alias of electricPower - } - - port def mountingPort; - - port def externalPowerSupplyPort { - in attribute power :> ISQ::voltage; - in attribute ground :> ISQ::voltage; - } + flow supplierPort.Contact to consumerPort.Contact; + } - port def LaserTowerPosition{ - out attribute angle : Real; - out attribute distance: Real; - } + part def infraredController{ + port ContactChargerOutputPort : contactCharger; + } +}package LaserTower{ + /* This package implements the LaserTower-System + * The LaserTower finds the relative position to other objects*/ + + item def angle; + item def distance; + + port def laserTowerPosition{ + out item Angle : angle; + out item Distance : distance; + } - port def contact; - port def torque; - - port def i2c{ - attribute SDA; - attribute SCL; - attribute vin; - attribute ground; - } - - port def psuSignal{ - attribute isChargingPositioN : Boolean; - } - - port def DriveUnitPowerSupply{ - inout attribute power :> ISQElectromagnetism::instantaneousPower; // alias of electricPower - } - - port def DriverUnitControlSignal{ - // this is an example port, there are other possibilities - in attribute forwards : Boolean; - in attribute left : Boolean; - in attribute right: Boolean; - } - package interfaceDef{ - import portDef::*; - - interface def EnergyInterface{ - end supplierPort { - in item energyIn; - out item energyOut; - } - end consumerPort{ - in item energyIn; - out item energyOut; - } - - flow supplierPort::energyOut to consumerPort::energyIn; - flow consumerPort::energyOut to supplierPort::energyIn; - } - - interface def PowerInterface{ - end supplierPort{ - inout item PowerInOut; - } - end consumerPort{ - inout item PowerInOut; - } - flow supplierPort::PowerInOut to consumerPort::PowerInOut; + interface def laserTowerInterface { + end supplierPort : laserTowerPosition; + end consumerPort : ~laserTowerPosition; + + flow supplierPort.Angle to consumerPort.Angle; + flow supplierPort.Distance to consumerPort.Distance; } - } -} + + + part def laserTower { + port LaserTowerPositionOutputPort : laserTowerPosition; + } +} \ No newline at end of file diff --git a/Functions/Integration/integrate.sh b/Functions/Integration/integrate.sh index 4db8b7b..d902d4d 100644 --- a/Functions/Integration/integrate.sh +++ b/Functions/Integration/integrate.sh @@ -2,8 +2,10 @@ FILENAME="Integration" cat *.sysml > $FILENAME.sysml +# general Signals and Ports +cat ../*.sysml >> $FILENAME.sysml # "VacuumingSystem" mit Errors -for folder in "EnergySupplySystem" "NavigationSystem" ; do - cat ../$folder/*.sysml >> $FILENAME.sysml -done \ No newline at end of file +for folder in "Ports&Signals" "EnergySupplySystem" "NavigationSystem" "ControllerSystem" "VacuumingSystem" "NavigationSystem/Bumber" "NavigationSystem/DriveController" "NavigationSystem/Engine" "NavigationSystem/InfraredController" "NavigationSystem/LaserTower"; do + cat $folder/*.sysml >> $FILENAME.sysml +done