diff options
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme')
2 files changed, 408 insertions, 0 deletions
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..57b5933a --- /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,390 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.queries | ||
2 | |||
3 | import "http://www.example.org/satellite" | ||
4 | |||
5 | @Constraint(severity = "error", key = {Element}, | ||
6 | message = "A communicating element may not have two transmitting communication subsystems.") | ||
7 | pattern communicationLinkDoesNotStartAtContainingElement(Element : CommunicatingElement) { | ||
8 | find transmittingCommSubsystem(Element, Comm1); | ||
9 | find transmittingCommSubsystem(Element, Comm2); | ||
10 | Comm1 != Comm2; | ||
11 | } | ||
12 | |||
13 | private pattern transmittingCommSubsystem(Element : CommunicatingElement, Comm : CommSubsystem) { | ||
14 | CommunicatingElement.commSubsystem(Element, Comm); | ||
15 | CommSubsystem.target(Comm, _); | ||
16 | } | ||
17 | |||
18 | @Constraint(severity = "error", key = {Station}, | ||
19 | message = "The ground station network may not have outgoing communication links.") | ||
20 | pattern transmittingGroundStationNetwork(Station : GroundStationNetwork) { | ||
21 | find transmittingCommSubsystem(Station, _); | ||
22 | } | ||
23 | |||
24 | @Constraint(severity = "error", key = {Station}, | ||
25 | message = "The ground station network may not have UHF communication subsystems.") | ||
26 | pattern roundStationNetworkUHF(Station : GroundStationNetwork) { | ||
27 | CommunicatingElement.commSubsystem(Station, Comm); | ||
28 | UHFCommSubsystem(Comm); | ||
29 | } | ||
30 | |||
31 | // At least two spacecraft must have the interferometry payload configured | ||
32 | |||
33 | @Constraint(severity = "error", key = {Mission}, | ||
34 | message = "Interferometry mission needs at least two spacecraft configured with the interferometry payload.") | ||
35 | pattern notEnoughInterferometryPayloads(Mission : InterferometryMission) { | ||
36 | InterferometryMission(Mission); | ||
37 | neg find atLeastTwoInterferometryPayloads(Mission); | ||
38 | } | ||
39 | |||
40 | private pattern atLeastTwoInterferometryPayloads(Mission : InterferometryMission) { | ||
41 | find spacecraftWithInterferometryPayload(Mission, Spacecraft1); | ||
42 | find spacecraftWithInterferometryPayload(Mission, Spacecraft2); | ||
43 | Spacecraft1 != Spacecraft2; | ||
44 | } | ||
45 | |||
46 | private pattern spacecraftWithInterferometryPayload(Mission : ConstellationMission, Spacecraft : Spacecraft) { | ||
47 | ConstellationMission.spacecraft(Mission, Spacecraft); | ||
48 | Spacecraft.payload(Spacecraft, Payload); | ||
49 | InterferometryPayload(Payload); | ||
50 | } | ||
51 | |||
52 | // All spacecraft must have some communication path to the ground station | ||
53 | |||
54 | //@Constraint(severity = "error", key = {Spacecraft}, | ||
55 | // message = "Spacecraft has no communication path to the ground station.") | ||
56 | //pattern noLinkToGroundStation(Spacecraft : Spacecraft) { | ||
57 | // ConstellationMission.groundStationNetwork(Mission, GroundStation); | ||
58 | // ConstellationMission.spacecraft(Mission, Spacecraft); | ||
59 | // neg find indirectCommunicationLink(Spacecraft, GroundStation); | ||
60 | //} | ||
61 | |||
62 | //@Constraint(severity = "error", key = {Spacecraft}, message = "UNSAT") | ||
63 | //pattern unsat_linkToGroundStation(Spacecraft : Spacecraft) { | ||
64 | // ConstellationMission.groundStationNetwork(Mission, GroundStation); | ||
65 | // ConstellationMission.spacecraft(Mission, Spacecraft); | ||
66 | // find indirectCommunicationLink(Spacecraft, GroundStation); | ||
67 | //} | ||
68 | |||
69 | //@Constraint(severity = "error", key = {Mission}, message = "UNSAT") | ||
70 | //pattern unsat_linkToGroundStation(Mission : InterferometryMission) { | ||
71 | // InterferometryMission(Mission); | ||
72 | // neg find noLinkToGroundStation(_); | ||
73 | //} | ||
74 | |||
75 | //@Constraint(severity = "error", key = {Spacecraft}, | ||
76 | // message = "Spacecraft has no potential communication path to the ground station.") | ||
77 | //pattern noPotentialLinkToGroundStation(Spacecraft : Spacecraft) { | ||
78 | // ConstellationMission.groundStationNetwork(Mission, GroundStation); | ||
79 | // ConstellationMission.spacecraft(Mission, Spacecraft); | ||
80 | // neg find indirectLinkAllowed(Spacecraft, GroundStation); | ||
81 | //} | ||
82 | |||
83 | //private pattern indirectLinkAllowed(From : Spacecraft, To : CommunicatingElement) { | ||
84 | // find linkAllowed+(From, To); | ||
85 | //} | ||
86 | |||
87 | //private pattern linkAllowed(From : Spacecraft, To : CommunicatingElement) { | ||
88 | // find matchingAntenna(From, To); | ||
89 | // neg find cubeSat3U(From); | ||
90 | //} or { | ||
91 | // find matchingAntenna(From, To); | ||
92 | // CubeSat3U(From); | ||
93 | //} or { | ||
94 | // find matchingAntenna(From, To); | ||
95 | // CubeSat3U(From); | ||
96 | // GroundStationNetwork(To); | ||
97 | //} | ||
98 | |||
99 | //private pattern matchingAntenna(From : Spacecraft, To : CommunicatingElement) { | ||
100 | // CommunicatingElement.commSubsystem(From, FromSys); | ||
101 | // CommunicatingElement.commSubsystem(To, ToSys); | ||
102 | // find matchingCommSubsystem(FromSys, ToSys); | ||
103 | //} | ||
104 | |||
105 | private pattern matchingCommSubsystem(From : CommSubsystem, To : CommSubsystem) { | ||
106 | UHFCommSubsystem(From); | ||
107 | UHFCommSubsystem(To); | ||
108 | } or { | ||
109 | XCommSubsystem(From); | ||
110 | XCommSubsystem(To); | ||
111 | } or { | ||
112 | KaCommSubsystem(From); | ||
113 | KaCommSubsystem(To); | ||
114 | } | ||
115 | |||
116 | //private pattern cubeSat3U(Sat : CubeSat3U) { | ||
117 | // CubeSat3U(Sat); | ||
118 | //} | ||
119 | |||
120 | // No communication loops may exist | ||
121 | // No spacecraft may directly communicate with itself | ||
122 | |||
123 | @Constraint(severity = "error", key = {Element}, | ||
124 | message = "Communication loop.") | ||
125 | pattern communicationLoop(Element : CommunicatingElement) { | ||
126 | find indirectCommunicationLink(Element, Element); | ||
127 | } | ||
128 | |||
129 | private pattern indirectCommunicationLink(Source : CommunicatingElement, Target : CommunicatingElement) { | ||
130 | find directCommunicationLink+(Source, Target); | ||
131 | } | ||
132 | |||
133 | private pattern directCommunicationLink(Source : CommunicatingElement, Target : CommunicatingElement) { | ||
134 | CommSubsystem.target(SourceSubsystem, TargetSubsystem); | ||
135 | CommunicatingElement.commSubsystem(Source, SourceSubsystem); | ||
136 | CommunicatingElement.commSubsystem(Target, TargetSubsystem); | ||
137 | } | ||
138 | |||
139 | // Source and target communication systems must be compatible. | ||
140 | |||
141 | @Constraint(severity = "error", key = {SourceSubsystem}, | ||
142 | message = "Two ends of a communication link must use the same band.") | ||
143 | pattern incompatibleSourceAndTargetBand(SourceSubsystem : CommSubsystem) { | ||
144 | CommSubsystem.target(SourceSubsystem, TargetSubsystem); | ||
145 | neg find matchingCommSubsystem(SourceSubsystem, TargetSubsystem); | ||
146 | } | ||
147 | |||
148 | // 3U CubeSats are assumed to only be able to downlink to Earth using an X-band trasmitter, | ||
149 | // but cross-link using UHF | ||
150 | |||
151 | @Constraint(severity = "error", key = {Sat}, | ||
152 | message = "3U CubeSats can only cross-link using UHF.") | ||
153 | pattern threeUCubeSatWithNonUhfCrossLink(Sat : CubeSat3U) { | ||
154 | CommunicatingElement.commSubsystem(Sat, SourceComm); | ||
155 | neg find commSubsystemBandUhf(SourceComm); | ||
156 | CommSubsystem.target(SourceComm, TargetComm); | ||
157 | CommunicatingElement.commSubsystem(Target, TargetComm); | ||
158 | neg find groundStationNetwork(Target); | ||
159 | } | ||
160 | |||
161 | private pattern commSubsystemBandUhf(Comm : UHFCommSubsystem) { | ||
162 | UHFCommSubsystem(Comm); | ||
163 | } | ||
164 | |||
165 | private pattern groundStationNetwork(Network : GroundStationNetwork) { | ||
166 | GroundStationNetwork(Network); | ||
167 | } | ||
168 | |||
169 | // Only a Small Satellite can be configured with a Ka-band communication system | ||
170 | |||
171 | @Constraint(severity = "error", key = {Spacecraft}, | ||
172 | message = "Only a Small Satellite can be configured with a Ka-band communication system.") | ||
173 | pattern cubeSatWithKaAntenna(Spacecraft : Spacecraft) { | ||
174 | CommunicatingElement.commSubsystem(Spacecraft, Comm); | ||
175 | KaCommSubsystem(Comm); | ||
176 | neg find smallSat(Spacecraft); | ||
177 | } | ||
178 | |||
179 | pattern smallSat(Sat : SmallSat) { | ||
180 | SmallSat(Sat); | ||
181 | } | ||
182 | |||
183 | @Constraint(severity = "error", key = {c1,c2}, message = "error") | ||
184 | pattern differentFrequency(c1 : CommSubsystem, c2 : CommSubsystem) { | ||
185 | CommSubsystem.target(c1,c2); | ||
186 | CommSubsystem.frequency(c1,f1); | ||
187 | CommSubsystem.frequency(c2,f2); | ||
188 | check(f1!=f2); | ||
189 | } | ||
190 | |||
191 | @Constraint(severity = "error", key = {s,s}, message = "error") | ||
192 | pattern tooHighFrequencyForUHF(s : UHFCommSubsystem) { | ||
193 | UHFCommSubsystem(s); | ||
194 | CommSubsystem.frequency(s,f); | ||
195 | check(f>1000);//1GHz | ||
196 | } | ||
197 | @Constraint(severity = "error", key = {s,s}, message = "error") | ||
198 | pattern tooLowFrequencyForUHF(s : UHFCommSubsystem) { | ||
199 | UHFCommSubsystem(s); | ||
200 | CommSubsystem.frequency(s,f); | ||
201 | check(f<300);//300MHz | ||
202 | } | ||
203 | @Constraint(severity = "error", key = {s,s}, message = "error") | ||
204 | pattern tooHighFrequencyForKaComm(s : KaCommSubsystem) { | ||
205 | KaCommSubsystem(s); | ||
206 | CommSubsystem.frequency(s,f); | ||
207 | check(f>40000);//40GHz | ||
208 | } | ||
209 | @Constraint(severity = "error", key = {s,s}, message = "error") | ||
210 | pattern tooLowFrequencyForKaComm(s : KaCommSubsystem) { | ||
211 | KaCommSubsystem(s); | ||
212 | CommSubsystem.frequency(s,f); | ||
213 | check(f<26500);//26.5GHz | ||
214 | } | ||
215 | @Constraint(severity = "error", key = {s,s}, message = "error") | ||
216 | pattern tooHighFrequencyForXComm(s : XCommSubsystem) { | ||
217 | XCommSubsystem(s); | ||
218 | CommSubsystem.frequency(s,f); | ||
219 | check(f>12000);//12GHz | ||
220 | } | ||
221 | @Constraint(severity = "error", key = {s,s}, message = "error") | ||
222 | pattern tooLowFrequencyForXComm(s : XCommSubsystem) { | ||
223 | XCommSubsystem(s); | ||
224 | CommSubsystem.frequency(s,f); | ||
225 | check(f<8000);//8GHz | ||
226 | } | ||
227 | @Constraint(severity = "error", key = {s,s}, message = "error") | ||
228 | pattern tooHighPathLengthForSatelite(s:CommSubsystem) { | ||
229 | CommSubsystem.pathLength(s,l); | ||
230 | CommSubsystem.target(s,ts); | ||
231 | Spacecraft.commSubsystem(_,ts); | ||
232 | check(l>250);//250km | ||
233 | } | ||
234 | @Constraint(severity = "error", key = {s,s}, message = "error") | ||
235 | pattern tooLowPathLengthForSatelite(s:CommSubsystem) { | ||
236 | CommSubsystem.pathLength(s,l); | ||
237 | CommSubsystem.target(s,ts); | ||
238 | Spacecraft.commSubsystem(_,ts); | ||
239 | check(l<150);//150km | ||
240 | } | ||
241 | @Constraint(severity = "error", key = {s,s}, message = "error") | ||
242 | pattern tooLowPathLengthForGroundStation(s:CommSubsystem) { | ||
243 | CommSubsystem.pathLength(s,l); | ||
244 | CommSubsystem.target(s,ts); | ||
245 | GroundStationNetwork.commSubsystem(_,ts); | ||
246 | check(l!=385000);//385.000km | ||
247 | } | ||
248 | //// | ||
249 | //// Metrics | ||
250 | //// | ||
251 | // | ||
252 | //// Coverage | ||
253 | // | ||
254 | //pattern coverageMetric(Coverage : java Double) { | ||
255 | // Coverage == sum find missionCoverage(_, #_); | ||
256 | //} | ||
257 | // | ||
258 | //private pattern missionCoverage(Mission : InterferometryMission, Coverage : java Double) { | ||
259 | // InterferometryMission.observationTime(Mission, ObservationTime); | ||
260 | // ObserverCount == count find spacecraftWithInterferometryPayload(Mission, _); | ||
261 | // Coverage == eval(Math.pow(1 - 2.0 / ObserverCount, 1 + 9 * (1.0 / ObservationTime)) + 0.05 * ObservationTime / 3); | ||
262 | //} | ||
263 | // | ||
264 | //// Time | ||
265 | // | ||
266 | //pattern timeMetric(Time : java Double) { | ||
267 | // Time == sum find missionTime(_, #_); | ||
268 | //} | ||
269 | // | ||
270 | //private pattern missionTime(Mission : InterferometryMission, Time : java Double) { | ||
271 | // InterferometryMission.observationTime(Mission, ObservationTime); | ||
272 | // TrasmitTime == sum find transmitTime(Mission, _, #_); | ||
273 | // Time == eval(TrasmitTime + 60.0 * ObservationTime); | ||
274 | //} | ||
275 | // | ||
276 | //private pattern transmitTime(Mission : InterferometryMission, Spacecraft : Spacecraft, TransmitTime : java Double) { | ||
277 | // ConstellationMission.spacecraft(Mission, Spacecraft); | ||
278 | // find scienceData(Spacecraft, ScienceData); | ||
279 | // IncomingData == sum find incomingData(Spacecraft, _, #_); | ||
280 | // find transmitRate(Spacecraft, TransmitRate); | ||
281 | // TransmitTime == eval((ScienceData + IncomingData) / (7.5 * TransmitRate)); | ||
282 | //} | ||
283 | // | ||
284 | //private pattern incomingData(Spacecraft : Spacecraft, Source : Spacecraft, Data : java Double) { | ||
285 | // find indirectCommunicationLink(Source, Spacecraft); | ||
286 | // find scienceData(Source, Data); | ||
287 | //} | ||
288 | // | ||
289 | //private pattern scienceData(Spacecraft : Spacecraft, Data : java Double) { | ||
290 | // ConstellationMission.spacecraft(Mission, Spacecraft); | ||
291 | // InterferometryMission.observationTime(Mission, ObservationTime); | ||
292 | // Data == eval(12.0 * ObservationTime); | ||
293 | //} | ||
294 | // | ||
295 | //private pattern transmitRate(Spacecraft : Spacecraft, TransmitRate : java Double) { | ||
296 | // find spacecraftUplink(Spacecraft, Comm, Target); | ||
297 | // UHFCommSubsystem(Comm); | ||
298 | // Spacecraft(Target); | ||
299 | // TransmitRate == 5.0; | ||
300 | //} or { | ||
301 | // find spacecraftUplink(Spacecraft, Comm, Target); | ||
302 | // XCommSubsystem(Comm); | ||
303 | // Spacecraft(Target); | ||
304 | // TransmitRate == 1.6; | ||
305 | //} or { | ||
306 | // find spacecraftUplink(Spacecraft, Comm, Target); | ||
307 | // XCommSubsystem(Comm); | ||
308 | // GroundStationNetwork(Target); | ||
309 | // TransmitRate == 0.7; | ||
310 | //} or { | ||
311 | // find spacecraftUplink(Spacecraft, Comm, Target); | ||
312 | // KaCommSubsystem(Comm); | ||
313 | // Spacecraft(Target); | ||
314 | // TransmitRate == 220.0; | ||
315 | //} or { | ||
316 | // find spacecraftUplink(Spacecraft, Comm, Target); | ||
317 | // KaCommSubsystem(Comm); | ||
318 | // GroundStationNetwork(Target); | ||
319 | // TransmitRate == 80.0; | ||
320 | //} | ||
321 | // | ||
322 | //private pattern spacecraftUplink(Spacecraft : Spacecraft, TargetSubsystem : CommSubsystem, Target : CommunicatingElement) { | ||
323 | // CommunicatingElement.commSubsystem.target(Spacecraft, TargetSubsystem); | ||
324 | // CommunicatingElement.commSubsystem(Target, TargetSubsystem); | ||
325 | //} | ||
326 | // | ||
327 | //// Cost | ||
328 | // | ||
329 | //pattern costMetric(Cost : java Double) { | ||
330 | // Cost == sum find missionCost(_, #_); | ||
331 | //} | ||
332 | // | ||
333 | //private pattern missionCost(Mission : InterferometryMission, Cost : java Double) { | ||
334 | // InterferometryMission.observationTime(Mission, ObservationTime); | ||
335 | // SpacecraftCost == sum find spacecraftCost(Mission, _, #_); | ||
336 | // Cost == eval(SpacecraftCost + 100000.0 * ObservationTime); | ||
337 | //} | ||
338 | // | ||
339 | //private pattern spacecraftCost(Mission : InterferometryMission, Spacecraft : Spacecraft, Cost : java Double) { | ||
340 | // ConstellationMission.spacecraft(Mission, Spacecraft); | ||
341 | // find spacecraftOfKindCount(Spacecraft, KindCount); | ||
342 | // find basePrice(Spacecraft, BasePrice); | ||
343 | // find interferometryPayloadCost(Spacecraft, InterferometryPayloadCost); | ||
344 | // find additionalCommSubsystemCost(Spacecraft, AdditionalCommSubsystemCost); | ||
345 | // Cost == eval(BasePrice * Math.pow(KindCount, -0.25) + InterferometryPayloadCost + AdditionalCommSubsystemCost); | ||
346 | //} | ||
347 | // | ||
348 | //private pattern spacecraftOfKindCount(Sat : Spacecraft, Count : java Integer) { | ||
349 | // CubeSat3U(Sat); | ||
350 | // Count == count find cubeSat3U(_); | ||
351 | //} or { | ||
352 | // CubeSat6U(Sat); | ||
353 | // Count == count find cubeSat6U(_); | ||
354 | //} or { | ||
355 | // SmallSat(Sat); | ||
356 | // Count == count find smallSat(_); | ||
357 | //} | ||
358 | // | ||
359 | //private pattern basePrice(Spacecraft : Spacecraft, BasePrice : java Double) { | ||
360 | // CubeSat3U(Spacecraft); | ||
361 | // BasePrice == 250000.0; | ||
362 | //} or { | ||
363 | // CubeSat6U(Spacecraft); | ||
364 | // BasePrice == 750000.0; | ||
365 | //} or { | ||
366 | // SmallSat(Spacecraft); | ||
367 | // BasePrice == 3000000.0; | ||
368 | //} | ||
369 | // | ||
370 | //private pattern interferometryPayloadCost(Spacecraft : Spacecraft, Cost : java Double) { | ||
371 | // find spacecraftWithInterferometryPayload(_, Spacecraft); | ||
372 | // Cost == 50000.0; | ||
373 | //} or { | ||
374 | // neg find spacecraftWithInterferometryPayload(_, Spacecraft); | ||
375 | // Cost == 0.0; | ||
376 | //} | ||
377 | // | ||
378 | //private pattern additionalCommSubsystemCost(Spacecraft : Spacecraft, Cost : java Double) { | ||
379 | // find spacecraftWithTwoCommSubsystems(Spacecraft); | ||
380 | // Cost == 100000.0; | ||
381 | //} or { | ||
382 | // neg find spacecraftWithTwoCommSubsystems(Spacecraft); | ||
383 | // Cost == 0.0; | ||
384 | //} | ||
385 | // | ||
386 | //private pattern spacecraftWithTwoCommSubsystems(Spacecraft : Spacecraft) { | ||
387 | // Spacecraft.commSubsystem(Spacecraft, Subsystem1); | ||
388 | // Spacecraft.commSubsystem(Spacecraft, Subsystem2); | ||
389 | // Subsystem1 != Subsystem2; | ||
390 | //} | ||
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..0ac66ce9 --- /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,18 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.runner | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.application.execution.StandaloneScriptExecutor | ||
4 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineOptions | ||
5 | import org.eclipse.viatra.query.runtime.rete.matcher.ReteBackendFactory | ||
6 | |||
7 | final class SatelliteGeneratorMain { | ||
8 | private new() { | ||
9 | throw new IllegalStateException("This is a static utility class and should not be instantiated directly.") | ||
10 | } | ||
11 | |||
12 | public static def void main(String[] args) { | ||
13 | ViatraQueryEngineOptions.setSystemDefaultBackends(ReteBackendFactory.INSTANCE, ReteBackendFactory.INSTANCE, | ||
14 | ReteBackendFactory.INSTANCE) | ||
15 | val res = StandaloneScriptExecutor.executeScript("configs/generation.vsconfig") | ||
16 | if(res!==null) println(res) | ||
17 | } | ||
18 | } | ||