From 7adead25f3c8451a51a3f8fa1d45b0b8f93b3a69 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Sun, 10 May 2020 22:09:17 +0200 Subject: Add satellite case study --- .../domains/satellite/queries/SatelliteQueries.vql | 325 +++++++++++++++++++++ .../satellite/runner/SatelliteGeneratorMain.xtend | 17 ++ 2 files changed, 342 insertions(+) create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/runner/SatelliteGeneratorMain.xtend (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src') diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql new file mode 100644 index 00000000..ba12bbda --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql @@ -0,0 +1,325 @@ +package hu.bme.mit.inf.dslreasoner.domains.satellite.queries + +import "http://www.example.org/satellite" + +@Constraint(severity = "error", key = {Element}, + message = "A communicating element may not have two transmitting communication subsystems.") +pattern communicationLinkDoesNotStartAtContainingElement(Element : CommunicatingElement) { + find transmittingCommSubsystem(Element, Comm1); + find transmittingCommSubsystem(Element, Comm2); + Comm1 != Comm2; +} + +private pattern transmittingCommSubsystem(Element : CommunicatingElement, Comm : CommSubsystem) { + CommunicatingElement.commSubsystem(Element, Comm); + CommSubsystem.target(Comm, _); +} + +@Constraint(severity = "error", key = {Station}, + message = "The ground station network may not have outgoing communication links.") +pattern transmittingGroundStationNetwork(Station : GroundStationNetwork) { + find transmittingCommSubsystem(Station, _); +} + +@Constraint(severity = "error", key = {Station}, + message = "The ground station network may not have UHF communication subsystems.") +pattern roundStationNetworkUHF(Station : GroundStationNetwork) { + CommunicatingElement.commSubsystem(Station, Comm); + UHFCommSubsystem(Comm); +} + +// At least two spacecraft must have the interferometry payload configured + +@Constraint(severity = "error", key = {Mission}, + message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.") +pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) { + InterferometryMission(Mission); + neg find atLeastTwoInterferometryPayloads(Mission); +} + +private pattern atLeastTwoInterferometryPayloads(Mission : InterferometryMission) { + find spacecraftWithInterferometryPayload(Mission, Spacecraft1); + find spacecraftWithInterferometryPayload(Mission, Spacecraft2); + Spacecraft1 != Spacecraft2; +} + +private pattern spacecraftWithInterferometryPayload(Mission : ConstellationMission, Spacecraft : Spacecraft) { + ConstellationMission.spacecraft(Mission, Spacecraft); + Spacecraft.payload(Spacecraft, Payload); + InterferometryPayload(Payload); +} + +// All spacecraft must have some communication path to the ground station + +@Constraint(severity = "error", key = {Spacecraft}, + message = "Spacecraft has no communication path to the ground station.") +pattern noLinkToGroundStation(Spacecraft : Spacecraft) { + ConstellationMission.groundStationNetwork(Mission, GroundStation); + ConstellationMission.spacecraft(Mission, Spacecraft); + neg find indirectCommunicationLink(Spacecraft, GroundStation); +} + +//@Constraint(severity = "error", key = {Spacecraft}, message = "UNSAT") +//pattern unsat_linkToGroundStation(Spacecraft : Spacecraft) { +// ConstellationMission.groundStationNetwork(Mission, GroundStation); +// ConstellationMission.spacecraft(Mission, Spacecraft); +// find indirectCommunicationLink(Spacecraft, GroundStation); +//} + +@Constraint(severity = "error", key = {Mission}, message = "UNSAT") +pattern unsat_linkToGroundStation(Mission : InterferometryMission) { + InterferometryMission(Mission); + neg find noLinkToGroundStation(_); +} + +@Constraint(severity = "error", key = {Spacecraft}, + message = "Spacecraft has no potential communication path to the ground station.") +pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { + ConstellationMission.groundStationNetwork(Mission, GroundStation); + ConstellationMission.spacecraft(Mission, Spacecraft); + neg find indirectLinkAllowed(Spacecraft, GroundStation); +} + +private pattern indirectLinkAllowed(From : Spacecraft, To : CommunicatingElement) { + find linkAllowed+(From, To); +} + +private pattern linkAllowed(From : Spacecraft, To : CommunicatingElement) { + find matchingAntenna(From, To); + neg find cubeSat3U(From); +} or { + find matchingAntenna(From, To); + CubeSat3U(From); +} or { + find matchingAntenna(From, To); + CubeSat3U(From); + GroundStationNetwork(To); +} + +private pattern matchingAntenna(From : Spacecraft, To : CommunicatingElement) { + CommunicatingElement.commSubsystem(From, FromSys); + CommunicatingElement.commSubsystem(To, ToSys); + find matchingCommSubsystem(FromSys, ToSys); +} + +private pattern matchingCommSubsystem(From : CommSubsystem, To : CommSubsystem) { + UHFCommSubsystem(From); + UHFCommSubsystem(To); +} or { + XCommSubsystem(From); + XCommSubsystem(To); +} or { + KaCommSubsystem(From); + KaCommSubsystem(To); +} + +private pattern cubeSat3U(Sat : CubeSat3U) { + CubeSat3U(Sat); +} + +// No communication loops may exist +// No spacecraft may directly communicate with itself + +@Constraint(severity = "error", key = {Element}, + message = "Communication loop.") +pattern communicationLoop(Element : CommunicatingElement) { + find indirectCommunicationLink(Element, Element); +} + +private pattern indirectCommunicationLink(Source : CommunicatingElement, Target : CommunicatingElement) { + find directCommunicationLink+(Source, Target); +} + +private pattern directCommunicationLink(Source : CommunicatingElement, Target : CommunicatingElement) { + CommSubsystem.target(SourceSubsystem, TargetSubsystem); + CommunicatingElement.commSubsystem(Source, SourceSubsystem); + CommunicatingElement.commSubsystem(Target, TargetSubsystem); +} + +// Source and target communication systems must be compatible. + +@Constraint(severity = "error", key = {SourceSubsystem}, + message = "Two ends of a communication link must use the same band.") +pattern incompatibleSourceAndTargetBand(SourceSubsystem : CommSubsystem) { + CommSubsystem.target(SourceSubsystem, TargetSubsystem); + neg find matchingCommSubsystem(SourceSubsystem, TargetSubsystem); +} + +// 3U CubeSats are assumed to only be able to downlink to Earth using an X-band trasmitter, +// but cross-link using UHF + +@Constraint(severity = "error", key = {Sat}, + message = "3U CubeSats can only cross-link using UHF.") +pattern threeUCubeSatWithNonUhfCrossLink(Sat : CubeSat3U) { + CommunicatingElement.commSubsystem(Sat, SourceComm); + neg find commSubsystemBandUhf(SourceComm); + CommSubsystem.target(SourceComm, TargetComm); + CommunicatingElement.commSubsystem(Target, TargetComm); + neg find groundStationNetwork(Target); +} + +private pattern commSubsystemBandUhf(Comm : UHFCommSubsystem) { + UHFCommSubsystem(Comm); +} + +private pattern groundStationNetwork(Network : GroundStationNetwork) { + GroundStationNetwork(Network); +} + +// Only a Small Satellite can be configured with a Ka-band communication system + +@Constraint(severity = "error", key = {Spacecraft}, + message = "Only a Small Satellite can be configured with a Ka-band communication system.") +pattern cubeSatWithKaAntenna(Spacecraft : Spacecraft) { + CommunicatingElement.commSubsystem(Spacecraft, Comm); + KaCommSubsystem(Comm); + neg find smallSat(Spacecraft); +} + +pattern smallSat(Sat : SmallSat) { + SmallSat(Sat); +} + +//// +//// Metrics +//// +// +//// Coverage +// +//pattern coverageMetric(Coverage : java Double) { +// Coverage == sum find missionCoverage(_, #_); +//} +// +//private pattern missionCoverage(Mission : InterferometryMission, Coverage : java Double) { +// InterferometryMission.observationTime(Mission, ObservationTime); +// ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _); +// Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9 * (1.0 / ObservationTime)) + 0.05 * ObservationTime / 3); +//} +// +//// Time +// +//pattern timeMetric(Time : java Double) { +// Time == sum find missionTime(_, #_); +//} +// +//private pattern missionTime(Mission : InterferometryMission, Time : java Double) { +// InterferometryMission.observationTime(Mission, ObservationTime); +// TrasmitTime == sum find transmitTime(Mission, _, #_); +// Time == eval(TrasmitTime + 60.0 * ObservationTime); +//} +// +//private pattern transmitTime(Mission : InterferometryMission, Spacecraft : Spacecraft, TransmitTime : java Double) { +// ConstellationMission.spacecraft(Mission, Spacecraft); +// find scienceData(Spacecraft, ScienceData); +// IncomingData == sum find incomingData(Spacecraft, _, #_); +// find transmitRate(Spacecraft, TransmitRate); +// TransmitTime == eval((ScienceData + IncomingData) / (7.5 * TransmitRate)); +//} +// +//private pattern incomingData(Spacecraft : Spacecraft, Source : Spacecraft, Data : java Double) { +// find indirectCommunicationLink(Source, Spacecraft); +// find scienceData(Source, Data); +//} +// +//private pattern scienceData(Spacecraft : Spacecraft, Data : java Double) { +// ConstellationMission.spacecraft(Mission, Spacecraft); +// InterferometryMission.observationTime(Mission, ObservationTime); +// Data == eval(12.0 * ObservationTime); +//} +// +//private pattern transmitRate(Spacecraft : Spacecraft, TransmitRate : java Double) { +// find spacecraftUplink(Spacecraft, Comm, Target); +// UHFCommSubsystem(Comm); +// Spacecraft(Target); +// TransmitRate == 5.0; +//} or { +// find spacecraftUplink(Spacecraft, Comm, Target); +// XCommSubsystem(Comm); +// Spacecraft(Target); +// TransmitRate == 1.6; +//} or { +// find spacecraftUplink(Spacecraft, Comm, Target); +// XCommSubsystem(Comm); +// GroundStationNetwork(Target); +// TransmitRate == 0.7; +//} or { +// find spacecraftUplink(Spacecraft, Comm, Target); +// KaCommSubsystem(Comm); +// Spacecraft(Target); +// TransmitRate == 220.0; +//} or { +// find spacecraftUplink(Spacecraft, Comm, Target); +// KaCommSubsystem(Comm); +// GroundStationNetwork(Target); +// TransmitRate == 80.0; +//} +// +//private pattern spacecraftUplink(Spacecraft : Spacecraft, TargetSubsystem : CommSubsystem, Target : CommunicatingElement) { +// CommunicatingElement.commSubsystem.target(Spacecraft, TargetSubsystem); +// CommunicatingElement.commSubsystem(Target, TargetSubsystem); +//} +// +//// Cost +// +//pattern costMetric(Cost : java Double) { +// Cost == sum find missionCost(_, #_); +//} +// +//private pattern missionCost(Mission : InterferometryMission, Cost : java Double) { +// InterferometryMission.observationTime(Mission, ObservationTime); +// SpacecraftCost == sum find spacecraftCost(Mission, _, #_); +// Cost == eval(SpacecraftCost + 100000.0 * ObservationTime); +//} +// +//private pattern spacecraftCost(Mission : InterferometryMission, Spacecraft : Spacecraft, Cost : java Double) { +// ConstellationMission.spacecraft(Mission, Spacecraft); +// find spacecraftOfKindCount(Spacecraft, KindCount); +// find basePrice(Spacecraft, BasePrice); +// find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost); +// find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost); +// Cost == eval(BasePrice * Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost); +//} +// +//private pattern spacecraftOfKindCount(Sat : Spacecraft, Count : java Integer) { +// CubeSat3U(Sat); +// Count == count find cubeSat3U(_); +//} or { +// CubeSat6U(Sat); +// Count == count find cubeSat6U(_); +//} or { +// SmallSat(Sat); +// Count == count find smallSat(_); +//} +// +//private pattern basePrice(Spacecraft : Spacecraft, BasePrice : java Double) { +// CubeSat3U(Spacecraft); +// BasePrice == 250000.0; +//} or { +// CubeSat6U(Spacecraft); +// BasePrice == 750000.0; +//} or { +// SmallSat(Spacecraft); +// BasePrice == 3000000.0; +//} +// +//private pattern interferometryPayloadCost(Spacecraft : Spacecraft, Cost : java Double) { +// find spacecraftWithInterferometryPayload(_, Spacecraft); +// Cost == 50000.0; +//} or { +// neg find spacecraftWithInterferometryPayload(_, Spacecraft); +// Cost == 0.0; +//} +// +//private pattern additionalCommSubsystemCost(Spacecraft : Spacecraft, Cost : java Double) { +// find spacecraftWithTwoCommSubsystems(Spacecraft); +// Cost == 100000.0; +//} or { +// neg find spacecraftWithTwoCommSubsystems(Spacecraft); +// Cost == 0.0; +//} +// +//private pattern spacecraftWithTwoCommSubsystems(Spacecraft : Spacecraft) { +// Spacecraft.commSubsystem(Spacecraft, Subsystem1); +// Spacecraft.commSubsystem(Spacecraft, Subsystem2); +// Subsystem1 != Subsystem2; +//} diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/runner/SatelliteGeneratorMain.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/runner/SatelliteGeneratorMain.xtend new file mode 100644 index 00000000..5e4e4ef0 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/runner/SatelliteGeneratorMain.xtend @@ -0,0 +1,17 @@ +package hu.bme.mit.inf.dslreasoner.domains.satellite.runner + +import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor +import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions +import org.eclipse.viatra.query.runtime.rete.matcher.ReteBackendFactory + +final class SatelliteGeneratorMain { + private new() { + throw new IllegalStateException("This is a static utility class and should not be instantiated directly.") + } + + public static def void main(String[] args) { + ViatraQueryEngineOptions.setSystemDefaultBackends(ReteBackendFactory.INSTANCE, ReteBackendFactory.INSTANCE, + ReteBackendFactory.INSTANCE) + println(StandaloneScriptExecutor.executeScript("configs/generation.vsconfig")) + } +} -- cgit v1.2.3-54-g00ecf From 24f172f86601ae255dbfee265155ddc433338914 Mon Sep 17 00:00:00 2001 From: Oszkar Semerath Date: Mon, 11 May 2020 02:22:52 +0200 Subject: Satelite case study update for Models-Attribute paper --- .../configs/generation.vsconfig | 4 +- .../ecore-gen/satellite/CommSubsystem.java | 46 ++ .../ecore-gen/satellite/SatellitePackage.java | 113 ++- .../satellite/impl/CommSubsystemImpl.java | 128 ++++ .../satellite/impl/SatellitePackageImpl.java | 29 + .../model/satellite.aird | 796 +++++++++++++++++++++ .../model/satellite.ecore | 68 +- .../model/satellite.genmodel | 80 ++- .../plugin.xml | 54 +- .../domains/satellite/queries/SatelliteQueries.vql | 147 ++-- .../satellite/runner/SatelliteGeneratorMain.xtend | 3 +- 11 files changed, 1327 insertions(+), 141 deletions(-) create mode 100644 Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.aird (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src') diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/configs/generation.vsconfig b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/configs/generation.vsconfig index 2fb246c9..b95c6b68 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/configs/generation.vsconfig +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/configs/generation.vsconfig @@ -7,7 +7,7 @@ generate { partial-model = { "inputs/SatelliteInstance.xmi"} solver = ViatraSolver scope = { - #node += 32..64 + #node += 64..128 } config = { @@ -16,7 +16,7 @@ generate { } number = 1 - runs = 5 + runs = 3 debug = "outputs/debug" log = "outputs/log.txt" diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/CommSubsystem.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/CommSubsystem.java index 3b9d7ecf..4c5ea937 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/CommSubsystem.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/CommSubsystem.java @@ -14,6 +14,8 @@ import org.eclipse.emf.ecore.EObject; *

* * * @see satellite.SatellitePackage#getCommSubsystem() @@ -44,4 +46,48 @@ public interface CommSubsystem extends EObject { */ void setTarget(CommSubsystem value); + /** + * Returns the value of the 'Frequency' attribute. + * + * + * @return the value of the 'Frequency' attribute. + * @see #setFrequency(int) + * @see satellite.SatellitePackage#getCommSubsystem_Frequency() + * @model required="true" + * @generated + */ + int getFrequency(); + + /** + * Sets the value of the '{@link satellite.CommSubsystem#getFrequency Frequency}' attribute. + * + * + * @param value the new value of the 'Frequency' attribute. + * @see #getFrequency() + * @generated + */ + void setFrequency(int value); + + /** + * Returns the value of the 'Path Length' attribute. + * + * + * @return the value of the 'Path Length' attribute. + * @see #setPathLength(int) + * @see satellite.SatellitePackage#getCommSubsystem_PathLength() + * @model required="true" + * @generated + */ + int getPathLength(); + + /** + * Sets the value of the '{@link satellite.CommSubsystem#getPathLength Path Length}' attribute. + * + * + * @param value the new value of the 'Path Length' attribute. + * @see #getPathLength() + * @generated + */ + void setPathLength(int value); + } // CommSubsystem diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/SatellitePackage.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/SatellitePackage.java index 9ca99311..173e2388 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/SatellitePackage.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/SatellitePackage.java @@ -2,6 +2,7 @@ */ package satellite; +import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; @@ -286,6 +287,24 @@ public interface SatellitePackage extends EPackage { */ int COMM_SUBSYSTEM__TARGET = 0; + /** + * The feature id for the 'Frequency' attribute. + * + * + * @generated + * @ordered + */ + int COMM_SUBSYSTEM__FREQUENCY = 1; + + /** + * The feature id for the 'Path Length' attribute. + * + * + * @generated + * @ordered + */ + int COMM_SUBSYSTEM__PATH_LENGTH = 2; + /** * The number of structural features of the 'Comm Subsystem' class. * @@ -293,7 +312,7 @@ public interface SatellitePackage extends EPackage { * @generated * @ordered */ - int COMM_SUBSYSTEM_FEATURE_COUNT = 1; + int COMM_SUBSYSTEM_FEATURE_COUNT = 3; /** * The number of operations of the 'Comm Subsystem' class. @@ -563,6 +582,24 @@ public interface SatellitePackage extends EPackage { */ int UHF_COMM_SUBSYSTEM__TARGET = COMM_SUBSYSTEM__TARGET; + /** + * The feature id for the 'Frequency' attribute. + * + * + * @generated + * @ordered + */ + int UHF_COMM_SUBSYSTEM__FREQUENCY = COMM_SUBSYSTEM__FREQUENCY; + + /** + * The feature id for the 'Path Length' attribute. + * + * + * @generated + * @ordered + */ + int UHF_COMM_SUBSYSTEM__PATH_LENGTH = COMM_SUBSYSTEM__PATH_LENGTH; + /** * The number of structural features of the 'UHF Comm Subsystem' class. * @@ -600,6 +637,24 @@ public interface SatellitePackage extends EPackage { */ int XCOMM_SUBSYSTEM__TARGET = COMM_SUBSYSTEM__TARGET; + /** + * The feature id for the 'Frequency' attribute. + * + * + * @generated + * @ordered + */ + int XCOMM_SUBSYSTEM__FREQUENCY = COMM_SUBSYSTEM__FREQUENCY; + + /** + * The feature id for the 'Path Length' attribute. + * + * + * @generated + * @ordered + */ + int XCOMM_SUBSYSTEM__PATH_LENGTH = COMM_SUBSYSTEM__PATH_LENGTH; + /** * The number of structural features of the 'XComm Subsystem' class. * @@ -637,6 +692,24 @@ public interface SatellitePackage extends EPackage { */ int KA_COMM_SUBSYSTEM__TARGET = COMM_SUBSYSTEM__TARGET; + /** + * The feature id for the 'Frequency' attribute. + * + * + * @generated + * @ordered + */ + int KA_COMM_SUBSYSTEM__FREQUENCY = COMM_SUBSYSTEM__FREQUENCY; + + /** + * The feature id for the 'Path Length' attribute. + * + * + * @generated + * @ordered + */ + int KA_COMM_SUBSYSTEM__PATH_LENGTH = COMM_SUBSYSTEM__PATH_LENGTH; + /** * The number of structural features of the 'Ka Comm Subsystem' class. * @@ -770,6 +843,28 @@ public interface SatellitePackage extends EPackage { */ EReference getCommSubsystem_Target(); + /** + * Returns the meta object for the attribute '{@link satellite.CommSubsystem#getFrequency Frequency}'. + * + * + * @return the meta object for the attribute 'Frequency'. + * @see satellite.CommSubsystem#getFrequency() + * @see #getCommSubsystem() + * @generated + */ + EAttribute getCommSubsystem_Frequency(); + + /** + * Returns the meta object for the attribute '{@link satellite.CommSubsystem#getPathLength Path Length}'. + * + * + * @return the meta object for the attribute 'Path Length'. + * @see satellite.CommSubsystem#getPathLength() + * @see #getCommSubsystem() + * @generated + */ + EAttribute getCommSubsystem_PathLength(); + /** * Returns the meta object for class '{@link satellite.Payload Payload}'. * @@ -984,6 +1079,22 @@ public interface SatellitePackage extends EPackage { */ EReference COMM_SUBSYSTEM__TARGET = eINSTANCE.getCommSubsystem_Target(); + /** + * The meta object literal for the 'Frequency' attribute feature. + * + * + * @generated + */ + EAttribute COMM_SUBSYSTEM__FREQUENCY = eINSTANCE.getCommSubsystem_Frequency(); + + /** + * The meta object literal for the 'Path Length' attribute feature. + * + * + * @generated + */ + EAttribute COMM_SUBSYSTEM__PATH_LENGTH = eINSTANCE.getCommSubsystem_PathLength(); + /** * The meta object literal for the '{@link satellite.impl.PayloadImpl Payload}' class. * diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/CommSubsystemImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/CommSubsystemImpl.java index d39abd4d..96a25d7c 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/CommSubsystemImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/CommSubsystemImpl.java @@ -19,6 +19,8 @@ import satellite.SatellitePackage; *

* * * @generated @@ -34,6 +36,45 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp */ protected CommSubsystem target; + /** + * The default value of the '{@link #getFrequency() Frequency}' attribute. + * + * + * @see #getFrequency() + * @generated + * @ordered + */ + protected static final int FREQUENCY_EDEFAULT = 0; + /** + * The cached value of the '{@link #getFrequency() Frequency}' attribute. + * + * + * @see #getFrequency() + * @generated + * @ordered + */ + protected int frequency = FREQUENCY_EDEFAULT; + + /** + * The default value of the '{@link #getPathLength() Path Length}' attribute. + * + * + * @see #getPathLength() + * @generated + * @ordered + */ + protected static final int PATH_LENGTH_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getPathLength() Path Length}' attribute. + * + * + * @see #getPathLength() + * @generated + * @ordered + */ + protected int pathLength = PATH_LENGTH_EDEFAULT; + /** * * @@ -95,6 +136,54 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp target)); } + /** + * + * + * @generated + */ + @Override + public int getFrequency() { + return frequency; + } + + /** + * + * + * @generated + */ + @Override + public void setFrequency(int newFrequency) { + int oldFrequency = frequency; + frequency = newFrequency; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SatellitePackage.COMM_SUBSYSTEM__FREQUENCY, + oldFrequency, frequency)); + } + + /** + * + * + * @generated + */ + @Override + public int getPathLength() { + return pathLength; + } + + /** + * + * + * @generated + */ + @Override + public void setPathLength(int newPathLength) { + int oldPathLength = pathLength; + pathLength = newPathLength; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, SatellitePackage.COMM_SUBSYSTEM__PATH_LENGTH, + oldPathLength, pathLength)); + } + /** * * @@ -107,6 +196,10 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp if (resolve) return getTarget(); return basicGetTarget(); + case SatellitePackage.COMM_SUBSYSTEM__FREQUENCY: + return getFrequency(); + case SatellitePackage.COMM_SUBSYSTEM__PATH_LENGTH: + return getPathLength(); } return super.eGet(featureID, resolve, coreType); } @@ -123,6 +216,12 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp case SatellitePackage.COMM_SUBSYSTEM__TARGET: setTarget((CommSubsystem) newValue); return; + case SatellitePackage.COMM_SUBSYSTEM__FREQUENCY: + setFrequency((Integer) newValue); + return; + case SatellitePackage.COMM_SUBSYSTEM__PATH_LENGTH: + setPathLength((Integer) newValue); + return; } super.eSet(featureID, newValue); } @@ -138,6 +237,12 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp case SatellitePackage.COMM_SUBSYSTEM__TARGET: setTarget((CommSubsystem) null); return; + case SatellitePackage.COMM_SUBSYSTEM__FREQUENCY: + setFrequency(FREQUENCY_EDEFAULT); + return; + case SatellitePackage.COMM_SUBSYSTEM__PATH_LENGTH: + setPathLength(PATH_LENGTH_EDEFAULT); + return; } super.eUnset(featureID); } @@ -152,8 +257,31 @@ public abstract class CommSubsystemImpl extends MinimalEObjectImpl.Container imp switch (featureID) { case SatellitePackage.COMM_SUBSYSTEM__TARGET: return target != null; + case SatellitePackage.COMM_SUBSYSTEM__FREQUENCY: + return frequency != FREQUENCY_EDEFAULT; + case SatellitePackage.COMM_SUBSYSTEM__PATH_LENGTH: + return pathLength != PATH_LENGTH_EDEFAULT; } return super.eIsSet(featureID); } + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) + return super.toString(); + + StringBuilder result = new StringBuilder(super.toString()); + result.append(" (frequency: "); + result.append(frequency); + result.append(", pathLength: "); + result.append(pathLength); + result.append(')'); + return result.toString(); + } + } //CommSubsystemImpl diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/SatellitePackageImpl.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/SatellitePackageImpl.java index f6dc1e30..39a6075f 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/SatellitePackageImpl.java +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/ecore-gen/satellite/impl/SatellitePackageImpl.java @@ -2,6 +2,7 @@ */ package satellite.impl; +import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; @@ -311,6 +312,26 @@ public class SatellitePackageImpl extends EPackageImpl implements SatellitePacka return (EReference) commSubsystemEClass.getEStructuralFeatures().get(0); } + /** + * + * + * @generated + */ + @Override + public EAttribute getCommSubsystem_Frequency() { + return (EAttribute) commSubsystemEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + @Override + public EAttribute getCommSubsystem_PathLength() { + return (EAttribute) commSubsystemEClass.getEStructuralFeatures().get(2); + } + /** * * @@ -447,6 +468,8 @@ public class SatellitePackageImpl extends EPackageImpl implements SatellitePacka commSubsystemEClass = createEClass(COMM_SUBSYSTEM); createEReference(commSubsystemEClass, COMM_SUBSYSTEM__TARGET); + createEAttribute(commSubsystemEClass, COMM_SUBSYSTEM__FREQUENCY); + createEAttribute(commSubsystemEClass, COMM_SUBSYSTEM__PATH_LENGTH); payloadEClass = createEClass(PAYLOAD); @@ -541,6 +564,12 @@ public class SatellitePackageImpl extends EPackageImpl implements SatellitePacka initEReference(getCommSubsystem_Target(), this.getCommSubsystem(), null, "target", null, 0, 1, CommSubsystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCommSubsystem_Frequency(), ecorePackage.getEInt(), "frequency", null, 1, 1, + CommSubsystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, + !IS_DERIVED, IS_ORDERED); + initEAttribute(getCommSubsystem_PathLength(), ecorePackage.getEInt(), "pathLength", null, 1, 1, + CommSubsystem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, + !IS_DERIVED, IS_ORDERED); initEClass(payloadEClass, Payload.class, "Payload", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.aird b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.aird new file mode 100644 index 00000000..23e8b463 --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.aird @@ -0,0 +1,796 @@ + + + + satellite.ecore + satellite.genmodel + + + + + + + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + bold + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + italic + + + + + + + + + + + + + + + + + italic + + + + + + + + + + + + + + + + + italic + + + + + + + + + italic + + + + + + + + bold + + + + + + + + + italic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + italic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + labelSize + bold + + + labelSize + + + + + + + + + + labelSize + bold + + + labelSize + + + + + + + + + + labelSize + bold + + + labelSize + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + labelSize + + + labelSize + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + italic + + + + + + + + + + + + + + diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.ecore b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.ecore index 9f17d43c..362df382 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.ecore +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.ecore @@ -1,32 +1,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.genmodel b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.genmodel index bc98abd6..4d04fed0 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.genmodel +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/model/satellite.genmodel @@ -1,39 +1,41 @@ - - - satellite.ecore - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + satellite.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml index fe1af62e..1f192d67 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/plugin.xml @@ -1,26 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - +--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql index ba12bbda..57b5933a 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql @@ -51,13 +51,13 @@ private pattern spacecraftWithInterferometryPayload(Mission : ConstellationMissi // All spacecraft must have some communication path to the ground station -@Constraint(severity = "error", key = {Spacecraft}, - message = "Spacecraft has no communication path to the ground station.") -pattern noLinkToGroundStation(Spacecraft : Spacecraft) { - ConstellationMission.groundStationNetwork(Mission, GroundStation); - ConstellationMission.spacecraft(Mission, Spacecraft); - neg find indirectCommunicationLink(Spacecraft, GroundStation); -} +//@Constraint(severity = "error", key = {Spacecraft}, +// message = "Spacecraft has no communication path to the ground station.") +//pattern noLinkToGroundStation(Spacecraft : Spacecraft) { +// ConstellationMission.groundStationNetwork(Mission, GroundStation); +// ConstellationMission.spacecraft(Mission, Spacecraft); +// neg find indirectCommunicationLink(Spacecraft, GroundStation); +//} //@Constraint(severity = "error", key = {Spacecraft}, message = "UNSAT") //pattern unsat_linkToGroundStation(Spacecraft : Spacecraft) { @@ -66,41 +66,41 @@ pattern noLinkToGroundStation(Spacecraft : Spacecraft) { // find indirectCommunicationLink(Spacecraft, GroundStation); //} -@Constraint(severity = "error", key = {Mission}, message = "UNSAT") -pattern unsat_linkToGroundStation(Mission : InterferometryMission) { - InterferometryMission(Mission); - neg find noLinkToGroundStation(_); -} +//@Constraint(severity = "error", key = {Mission}, message = "UNSAT") +//pattern unsat_linkToGroundStation(Mission : InterferometryMission) { +// InterferometryMission(Mission); +// neg find noLinkToGroundStation(_); +//} -@Constraint(severity = "error", key = {Spacecraft}, - message = "Spacecraft has no potential communication path to the ground station.") -pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { - ConstellationMission.groundStationNetwork(Mission, GroundStation); - ConstellationMission.spacecraft(Mission, Spacecraft); - neg find indirectLinkAllowed(Spacecraft, GroundStation); -} +//@Constraint(severity = "error", key = {Spacecraft}, +// message = "Spacecraft has no potential communication path to the ground station.") +//pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { +// ConstellationMission.groundStationNetwork(Mission, GroundStation); +// ConstellationMission.spacecraft(Mission, Spacecraft); +// neg find indirectLinkAllowed(Spacecraft, GroundStation); +//} -private pattern indirectLinkAllowed(From : Spacecraft, To : CommunicatingElement) { - find linkAllowed+(From, To); -} +//private pattern indirectLinkAllowed(From : Spacecraft, To : CommunicatingElement) { +// find linkAllowed+(From, To); +//} -private pattern linkAllowed(From : Spacecraft, To : CommunicatingElement) { - find matchingAntenna(From, To); - neg find cubeSat3U(From); -} or { - find matchingAntenna(From, To); - CubeSat3U(From); -} or { - find matchingAntenna(From, To); - CubeSat3U(From); - GroundStationNetwork(To); -} +//private pattern linkAllowed(From : Spacecraft, To : CommunicatingElement) { +// find matchingAntenna(From, To); +// neg find cubeSat3U(From); +//} or { +// find matchingAntenna(From, To); +// CubeSat3U(From); +//} or { +// find matchingAntenna(From, To); +// CubeSat3U(From); +// GroundStationNetwork(To); +//} -private pattern matchingAntenna(From : Spacecraft, To : CommunicatingElement) { - CommunicatingElement.commSubsystem(From, FromSys); - CommunicatingElement.commSubsystem(To, ToSys); - find matchingCommSubsystem(FromSys, ToSys); -} +//private pattern matchingAntenna(From : Spacecraft, To : CommunicatingElement) { +// CommunicatingElement.commSubsystem(From, FromSys); +// CommunicatingElement.commSubsystem(To, ToSys); +// find matchingCommSubsystem(FromSys, ToSys); +//} private pattern matchingCommSubsystem(From : CommSubsystem, To : CommSubsystem) { UHFCommSubsystem(From); @@ -113,9 +113,9 @@ private pattern matchingCommSubsystem(From : CommSubsystem, To : CommSubsystem) KaCommSubsystem(To); } -private pattern cubeSat3U(Sat : CubeSat3U) { - CubeSat3U(Sat); -} +//private pattern cubeSat3U(Sat : CubeSat3U) { +// CubeSat3U(Sat); +//} // No communication loops may exist // No spacecraft may directly communicate with itself @@ -180,6 +180,71 @@ pattern smallSat(Sat : SmallSat) { SmallSat(Sat); } +@Constraint(severity = "error", key = {c1,c2}, message = "error") +pattern differentFrequency(c1 : CommSubsystem, c2 : CommSubsystem) { + CommSubsystem.target(c1,c2); + CommSubsystem.frequency(c1,f1); + CommSubsystem.frequency(c2,f2); + check(f1!=f2); +} + +@Constraint(severity = "error", key = {s,s}, message = "error") +pattern tooHighFrequencyForUHF(s : UHFCommSubsystem) { + UHFCommSubsystem(s); + CommSubsystem.frequency(s,f); + check(f>1000);//1GHz +} +@Constraint(severity = "error", key = {s,s}, message = "error") +pattern tooLowFrequencyForUHF(s : UHFCommSubsystem) { + UHFCommSubsystem(s); + CommSubsystem.frequency(s,f); + check(f<300);//300MHz +} +@Constraint(severity = "error", key = {s,s}, message = "error") +pattern tooHighFrequencyForKaComm(s : KaCommSubsystem) { + KaCommSubsystem(s); + CommSubsystem.frequency(s,f); + check(f>40000);//40GHz +} +@Constraint(severity = "error", key = {s,s}, message = "error") +pattern tooLowFrequencyForKaComm(s : KaCommSubsystem) { + KaCommSubsystem(s); + CommSubsystem.frequency(s,f); + check(f<26500);//26.5GHz +} +@Constraint(severity = "error", key = {s,s}, message = "error") +pattern tooHighFrequencyForXComm(s : XCommSubsystem) { + XCommSubsystem(s); + CommSubsystem.frequency(s,f); + check(f>12000);//12GHz +} +@Constraint(severity = "error", key = {s,s}, message = "error") +pattern tooLowFrequencyForXComm(s : XCommSubsystem) { + XCommSubsystem(s); + CommSubsystem.frequency(s,f); + check(f<8000);//8GHz +} +@Constraint(severity = "error", key = {s,s}, message = "error") +pattern tooHighPathLengthForSatelite(s:CommSubsystem) { + CommSubsystem.pathLength(s,l); + CommSubsystem.target(s,ts); + Spacecraft.commSubsystem(_,ts); + check(l>250);//250km +} +@Constraint(severity = "error", key = {s,s}, message = "error") +pattern tooLowPathLengthForSatelite(s:CommSubsystem) { + CommSubsystem.pathLength(s,l); + CommSubsystem.target(s,ts); + Spacecraft.commSubsystem(_,ts); + check(l<150);//150km +} +@Constraint(severity = "error", key = {s,s}, message = "error") +pattern tooLowPathLengthForGroundStation(s:CommSubsystem) { + CommSubsystem.pathLength(s,l); + CommSubsystem.target(s,ts); + GroundStationNetwork.commSubsystem(_,ts); + check(l!=385000);//385.000km +} //// //// Metrics //// diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/runner/SatelliteGeneratorMain.xtend b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/runner/SatelliteGeneratorMain.xtend index 5e4e4ef0..0ac66ce9 100644 --- a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/runner/SatelliteGeneratorMain.xtend +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/runner/SatelliteGeneratorMain.xtend @@ -12,6 +12,7 @@ final class SatelliteGeneratorMain { public static def void main(String[] args) { ViatraQueryEngineOptions.setSystemDefaultBackends(ReteBackendFactory.INSTANCE, ReteBackendFactory.INSTANCE, ReteBackendFactory.INSTANCE) - println(StandaloneScriptExecutor.executeScript("configs/generation.vsconfig")) + val res = StandaloneScriptExecutor.executeScript("configs/generation.vsconfig") + if(res!==null) println(res) } } -- cgit v1.2.3-54-g00ecf