Harald Mackamul | aa64db0 | 2019-07-26 14:03:01 +0200 | [diff] [blame] | 1 | /** |
| 2 | ******************************************************************************** |
| 3 | * Copyright (c) 2015-2019 Robert Bosch GmbH and others. |
| 4 | * |
| 5 | * This program and the accompanying materials are made |
| 6 | * available under the terms of the Eclipse Public License 2.0 |
| 7 | * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| 8 | * |
| 9 | * SPDX-License-Identifier: EPL-2.0 |
| 10 | * ******************************************************************************* |
| 11 | */ |
| 12 | |
| 13 | @GenModel( |
| 14 | modelName="Amalthea", prefix="Amalthea", |
| 15 | editDirectory="/org.eclipse.app4mc.amalthea.model.edit/src-gen", |
| 16 | editorDirectory="/org.eclipse.app4mc.amalthea.model.editor/src-gen", |
| 17 | rootExtendsClass="org.eclipse.app4mc.amalthea.sphinx.AmaltheaExtendedEObjectImpl", |
| 18 | providerRootExtendsClass="org.eclipse.app4mc.amalthea.sphinx.AmaltheaExtendedItemProviderAdapter", |
| 19 | creationIcons="false", |
| 20 | forceOverwrite="true", |
| 21 | creationSubmenus="true", |
| 22 | // *** create XML instance of the Amalthea meta model |
| 23 | publicationLocation="org.eclipse.app4mc.amalthea.model/model-gen/xml/amalthea.xml", |
| 24 | loadInitialization="false", // can be removed with Neon.3 ?? |
| 25 | // dynamicTemplates="true", |
| 26 | // templateDirectory="org.eclipse.app4mc.amalthea.model/templates", |
| 27 | copyrightText="*******************************************************************************\r\n Copyright (c) 2015-2019 Robert Bosch GmbH and others.\r\n\r\n This program and the accompanying materials are made\r\n available under the terms of the Eclipse Public License 2.0\r\n which is available at https://www.eclipse.org/legal/epl-2.0/\r\n\r\n SPDX-License-Identifier: EPL-2.0\r\n\r\n Generated using Eclipse EMF\r\n\r\n*******************************************************************************", |
| 28 | decoration="Live", |
| 29 | collapseAllAction="true", |
| 30 | expandAllAction="true", |
| 31 | autoExpandProperties="1", |
| 32 | eclipsePlatformVersion="Photon" |
| 33 | ) |
| 34 | |
| 35 | @Ecore( |
| 36 | nsPrefix="am", |
| 37 | nsURI="http://app4mc.eclipse.org/amalthea/0.9.5" |
| 38 | ) |
| 39 | |
| 40 | package org.eclipse.app4mc.amalthea.model |
| 41 | |
| 42 | import java.net.URLEncoder |
| 43 | import java.nio.charset.StandardCharsets |
| 44 | import org.eclipse.emf.ecore.EDiagnosticChain |
| 45 | import org.eclipse.emf.ecore.EMap |
| 46 | import org.eclipse.emf.ecore.InternalEObject |
| 47 | import org.eclipse.emf.ecore.util.EcoreEList$UnmodifiableEList |
| 48 | |
| 49 | |
| 50 | // =============================================================================== |
| 51 | // =============================================================================== |
| 52 | // |
| 53 | // Central Model |
| 54 | // |
| 55 | // =============================================================================== |
| 56 | // =============================================================================== |
| 57 | |
| 58 | |
| 59 | class Amalthea extends BaseObject |
| 60 | { |
| 61 | derived readonly String version get { |
| 62 | return "0.9.5" |
| 63 | } |
| 64 | |
| 65 | contains CommonElements commonElements |
| 66 | contains SWModel swModel |
| 67 | contains HWModel hwModel |
| 68 | contains OSModel osModel |
| 69 | contains StimuliModel stimuliModel |
| 70 | contains EventModel eventModel |
| 71 | contains ConstraintsModel constraintsModel |
| 72 | contains PropertyConstraintsModel propertyConstraintsModel |
| 73 | contains MappingModel mappingModel |
| 74 | contains ComponentsModel componentsModel |
| 75 | contains ConfigModel configModel |
| 76 | contains MeasurementModel measurementModel |
| 77 | } |
| 78 | |
| 79 | |
| 80 | // =============================================================================== |
| 81 | // =============================================================================== |
| 82 | // |
| 83 | // Common Model |
| 84 | // |
| 85 | // =============================================================================== |
| 86 | // =============================================================================== |
| 87 | |
| 88 | |
| 89 | class CommonElements extends BaseObject |
| 90 | { |
| 91 | contains Tag[] tags |
| 92 | contains CoreClassifier[] coreClassifiers |
| 93 | contains MemoryClassifier[] memoryClassifiers |
| 94 | } |
| 95 | |
| 96 | /* |
| 97 | * Base classes to be used to provide common functionality for all objects. |
| 98 | * Needs to be extended by other classes. |
| 99 | */ |
| 100 | abstract class BaseObject extends IAnnotatable {} |
| 101 | |
| 102 | abstract class ReferableObject extends IReferable {} |
| 103 | |
| 104 | abstract class ReferableBaseObject extends IAnnotatable, IReferable {} |
| 105 | |
| 106 | /* |
| 107 | * IAnnotatable: Possibility to store custom properties on elements |
| 108 | */ |
| 109 | interface IAnnotatable |
| 110 | { |
| 111 | contains CustomProperty[] customProperties |
| 112 | } |
| 113 | |
| 114 | /* |
| 115 | * ITaggable: Possibility to add tags to an elements |
| 116 | */ |
| 117 | interface ITaggable |
| 118 | { |
| 119 | refers Tag[] tags |
| 120 | } |
| 121 | |
| 122 | /* |
| 123 | * INamed: Name attribute |
| 124 | */ |
| 125 | interface INamed |
| 126 | { |
| 127 | @GenModel(propertyCategory="Main") |
| 128 | String name = "" |
| 129 | } |
| 130 | |
| 131 | /* |
| 132 | * IReferable: Computed ID for name based references |
| 133 | */ |
| 134 | interface IReferable extends INamed |
| 135 | { |
| 136 | // use IPropertySheetEntry.FILTER_ID_EXPERT ("org.eclipse.ui.views.properties.expert") |
| 137 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 138 | id derived readonly String uniqueName get { |
| 139 | return (if (namePrefix.nullOrEmpty) "" else encode(namePrefix) + "/") + encode(name) + "?type=" + eClass.name |
| 140 | } |
| 141 | |
| 142 | @GenModel(documentation="Overwrite this method to define a specific prefix (used by name-based references).") |
| 143 | op String getNamePrefix() { "" } |
| 144 | |
| 145 | op String encode(String str) { |
| 146 | return (if (str.nullOrEmpty) "no-name" else URLEncoder.encode(str, StandardCharsets.UTF_8.toString)) |
| 147 | } |
| 148 | |
| 149 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 150 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | interface IDisplayName |
| 155 | { |
| 156 | String displayName |
| 157 | } |
| 158 | |
| 159 | /* |
| 160 | * A tag for processes, runnables, events and labels |
| 161 | */ |
| 162 | class Tag extends ReferableBaseObject |
| 163 | { |
| 164 | String tagType |
| 165 | |
| 166 | // back pointer (readonly) |
| 167 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of objects (ITaggable) referring to the this tag.</b></p>") |
| 168 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 169 | refers transient readonly volatile derived ITaggable[] taggedObjects get { |
| 170 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.tag_TaggedObjects, |
| 171 | #{AmaltheaPackage.eINSTANCE.ITaggable_Tags} |
| 172 | ) |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | enum RelationalOperator |
| 177 | { |
| 178 | _undefined_ // Display: "<relation>" |
| 179 | EQUAL |
| 180 | NOT_EQUAL |
| 181 | LESS_THAN |
| 182 | GREATER_THAN |
| 183 | } |
| 184 | |
| 185 | /* |
| 186 | * Classifiers for hardware properties |
| 187 | */ |
| 188 | abstract class Classifier extends ReferableBaseObject |
| 189 | { |
| 190 | String description |
| 191 | } |
| 192 | |
| 193 | class CoreClassifier extends Classifier |
| 194 | { |
| 195 | } |
| 196 | |
| 197 | class MemoryClassifier extends Classifier |
| 198 | { |
| 199 | } |
| 200 | |
| 201 | /* |
| 202 | * Data transmission details for communication (e.g. LabelAccesses) |
| 203 | */ |
| 204 | class TransmissionPolicy |
| 205 | { |
| 206 | contains DataSize chunkSize |
| 207 | int chunkProcessingTicks = "0" |
| 208 | double transmitRatio = "1.0" |
| 209 | } |
| 210 | |
| 211 | // ------------------------------------------------------------------------------- |
| 212 | // |
| 213 | // Quantities |
| 214 | // |
| 215 | // ------------------------------------------------------------------------------- |
| 216 | |
| 217 | /* |
| 218 | * Abstract class for Quantities (value + unit) |
| 219 | */ |
| 220 | abstract class Quantity {} |
| 221 | |
| 222 | /* |
| 223 | * Time units (enumeration of available units) |
| 224 | */ |
| 225 | enum TimeUnit |
| 226 | { |
| 227 | _undefined_ // Display: "<unit>" |
| 228 | s |
| 229 | ms |
| 230 | us |
| 231 | ns |
| 232 | ps |
| 233 | } |
| 234 | |
| 235 | interface TimeComparable wraps java.lang.Comparable<Time> {} |
| 236 | |
| 237 | /* |
| 238 | * General time class to define time value and unit. |
| 239 | */ |
| 240 | class Time extends Quantity, Value, TimeComparable |
| 241 | { |
| 242 | BigInteger value = "0" |
| 243 | TimeUnit unit |
| 244 | |
| 245 | op String toString() { |
| 246 | return value + " " + if (unit == TimeUnit::_UNDEFINED_) "<unit>" else unit.literal |
| 247 | } |
| 248 | |
| 249 | op int compareTo(Time t) { return AmaltheaServices.compareTimes(this, t) } |
| 250 | |
| 251 | op Time adjustUnit() { return AmaltheaServices.adjustTimeUnit(this) } |
| 252 | op Time add(Time t) { return AmaltheaServices.addTime(this, t) } |
| 253 | op Time subtract(Time t) { return AmaltheaServices.subtractTime(this, t) } |
| 254 | op Time multiply(long v) { return AmaltheaServices.multiply(this, v) } |
| 255 | op Time multiply(double v) { return AmaltheaServices.multiply(this, v) } |
| 256 | op double divide(Time t) { return AmaltheaServices.divideTime(this, t) } |
| 257 | } |
| 258 | |
| 259 | |
| 260 | /* |
| 261 | * Frequency units (enumeration of available units) |
| 262 | */ |
| 263 | enum FrequencyUnit |
| 264 | { |
| 265 | _undefined_ // Display: "<unit>" |
| 266 | Hz |
| 267 | kHz |
| 268 | MHz |
| 269 | GHz |
| 270 | // rpm ??? |
| 271 | } |
| 272 | |
| 273 | /* |
| 274 | * General frequency class to define frequency value and unit |
| 275 | */ |
| 276 | class Frequency extends Quantity |
| 277 | { |
| 278 | NonNegativeDouble value = "0.0" |
| 279 | FrequencyUnit unit |
| 280 | |
| 281 | op String toString() { |
| 282 | return value + " " + if (unit == FrequencyUnit::_UNDEFINED_) "<unit>" else unit.literal |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | /* |
| 287 | * Voltage units (enumeration of available units) |
| 288 | */ |
| 289 | enum VoltageUnit |
| 290 | { |
| 291 | _undefined_ // Display: "<unit>" |
| 292 | uV |
| 293 | mV |
| 294 | V |
| 295 | } |
| 296 | |
| 297 | /* |
| 298 | * General voltage class to define voltage value and unit |
| 299 | */ |
| 300 | class Voltage extends Quantity |
| 301 | { |
| 302 | double value = "0.0" |
| 303 | VoltageUnit unit |
| 304 | |
| 305 | op String toString() { |
| 306 | return value + " " + if (unit == VoltageUnit::_UNDEFINED_) "<unit>" else unit.literal |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | /* |
| 311 | * Data size units (enumeration of available units) |
| 312 | */ |
| 313 | enum DataSizeUnit |
| 314 | { |
| 315 | _undefined_ // Display: "<unit>" |
| 316 | bit |
| 317 | kbit |
| 318 | Mbit |
| 319 | Gbit |
| 320 | Tbit |
| 321 | |
| 322 | Kibit |
| 323 | Mibit |
| 324 | Gibit |
| 325 | Tibit |
| 326 | |
| 327 | B |
| 328 | kB |
| 329 | MB |
| 330 | GB |
| 331 | TB |
| 332 | |
| 333 | KiB |
| 334 | MiB |
| 335 | GiB |
| 336 | TiB |
| 337 | } |
| 338 | |
| 339 | /* |
| 340 | * General data size class to define size (value and unit) |
| 341 | */ |
| 342 | class DataSize extends Quantity |
| 343 | { |
| 344 | BigInteger value = "0" |
| 345 | DataSizeUnit unit |
| 346 | |
| 347 | op String toString() { |
| 348 | return value + " " + if (unit == DataSizeUnit::_UNDEFINED_) "<unit>" else unit.literal |
| 349 | } |
| 350 | |
| 351 | /* |
| 352 | * Convenience methods to retrieve the size in Bits and Bytes |
| 353 | */ |
| 354 | op long getNumberBits() { |
| 355 | if (unit === DataSizeUnit::BIT) return value.longValue |
| 356 | |
| 357 | val bits = AmaltheaServices.convertToBit(this) |
| 358 | if (bits === null) -1L else bits.longValue |
| 359 | } |
| 360 | op long getNumberBytes() { |
| 361 | if (unit === DataSizeUnit::B) return value.longValue |
| 362 | |
| 363 | val bits = AmaltheaServices.convertToBit(this) |
| 364 | if (bits === null) -1L else Math::ceil(bits.longValue / 8).longValue |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | /* |
| 369 | * Data rate units (enumeration of available units) |
| 370 | */ |
| 371 | enum DataRateUnit |
| 372 | { |
| 373 | _undefined_ // Display: "<unit>" |
| 374 | bitPerSecond // Display: "bit/s" |
| 375 | kbitPerSecond |
| 376 | MbitPerSecond |
| 377 | GbitPerSecond |
| 378 | TbitPerSecond |
| 379 | |
| 380 | KibitPerSecond |
| 381 | MibitPerSecond |
| 382 | GibitPerSecond |
| 383 | TibitPerSecond |
| 384 | |
| 385 | BPerSecond |
| 386 | kBPerSecond |
| 387 | MBPerSecond |
| 388 | GBPerSecond |
| 389 | TBPerSecond |
| 390 | |
| 391 | KiBPerSecond |
| 392 | MiBPerSecond |
| 393 | GiBPerSecond |
| 394 | TiBPerSecond |
| 395 | } |
| 396 | |
| 397 | interface DataRateComparable wraps java.lang.Comparable<DataRate> {} |
| 398 | |
| 399 | /* |
| 400 | * General data rate class to define rate (value and unit) |
| 401 | */ |
| 402 | class DataRate extends Quantity, DataRateComparable |
| 403 | { |
| 404 | BigInteger value = "0" |
| 405 | DataRateUnit unit |
| 406 | |
| 407 | op String toString() { |
| 408 | return value + " " + if (unit == DataRateUnit::_UNDEFINED_) "<unit>" else unit.literal.replace("PerSecond", "/s") |
| 409 | } |
| 410 | op int compareTo(DataRate rate) { |
| 411 | return AmaltheaServices.compareDataRates(this, rate) |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | // ------------------------------------------------------------------------------- |
| 416 | // |
| 417 | // Custom Properties and Values |
| 418 | // |
| 419 | // ------------------------------------------------------------------------------- |
| 420 | |
| 421 | /* |
| 422 | * custom property container for map |
| 423 | */ |
| 424 | class CustomProperty wraps java.util.Map$Entry |
| 425 | { |
| 426 | String[1] key |
| 427 | contains Value value |
| 428 | } |
| 429 | |
| 430 | /* |
| 431 | * Abstract generalization of a value entry. |
| 432 | */ |
| 433 | abstract class Value {} |
| 434 | |
| 435 | class ListObject extends Value |
| 436 | { |
| 437 | contains Value[] values |
| 438 | } |
| 439 | |
| 440 | /* |
| 441 | * Object for using the elementary datatype String as generic parameter |
| 442 | */ |
| 443 | class StringObject extends Value |
| 444 | { |
| 445 | String[1] value |
| 446 | } |
| 447 | |
| 448 | /* |
| 449 | * Object for using the elementary datatype String as generic parameter |
| 450 | */ |
| 451 | class BigIntegerObject extends Value |
| 452 | { |
| 453 | BigInteger[1] value = "0" |
| 454 | } |
| 455 | |
| 456 | /* |
| 457 | * Object for using object reference as generic parameter |
| 458 | */ |
| 459 | class ReferenceObject extends Value |
| 460 | { |
| 461 | refers IReferable value |
| 462 | } |
| 463 | |
| 464 | /* |
| 465 | * Object for using the elementary datatype integer as generic parameter |
| 466 | */ |
| 467 | class IntegerObject extends Value |
| 468 | { |
| 469 | int[1] value = "0" |
| 470 | } |
| 471 | |
| 472 | /* |
| 473 | * Object for using the elementary datatype long as generic parameter |
| 474 | */ |
| 475 | class LongObject extends Value |
| 476 | { |
| 477 | long[1] value = "0" |
| 478 | } |
| 479 | |
| 480 | /* |
| 481 | * Object for using the elementary datatype float as generic parameter |
| 482 | */ |
| 483 | class FloatObject extends Value |
| 484 | { |
| 485 | float[1] value = "0.0" |
| 486 | } |
| 487 | |
| 488 | /* |
| 489 | * Object for using the elementary datatype double as generic parameter |
| 490 | */ |
| 491 | class DoubleObject extends Value |
| 492 | { |
| 493 | double[1] value = "0.0" |
| 494 | } |
| 495 | |
| 496 | /* |
| 497 | * Object for using the elementary datatype boolean as generic parameter |
| 498 | */ |
| 499 | class BooleanObject extends Value |
| 500 | { |
| 501 | boolean[1] value = "false" |
| 502 | } |
| 503 | |
| 504 | // ------------------------------------------------------------------------------- |
| 505 | // |
| 506 | // Statistics / Deviations (general) |
| 507 | // |
| 508 | // ------------------------------------------------------------------------------- |
| 509 | |
| 510 | interface NumericStatistic {} |
| 511 | |
| 512 | /* |
| 513 | * Statistic to provide capabilities for min, max and avg |
| 514 | */ |
| 515 | class MinAvgMaxStatistic extends NumericStatistic |
| 516 | { |
| 517 | int min = "0" |
| 518 | float avg = "0f" |
| 519 | int max = "0" |
| 520 | |
| 521 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 522 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | class SingleValueStatistic extends NumericStatistic |
| 527 | { |
| 528 | float value = "0f" |
| 529 | } |
| 530 | |
| 531 | /* |
| 532 | * The types of sampling |
| 533 | */ |
| 534 | enum SamplingType |
| 535 | { |
| 536 | ^default // Display: "<sampling>" |
| 537 | BestCase |
| 538 | WorstCase |
| 539 | AverageCase |
| 540 | CornerCase |
| 541 | Uniform |
| 542 | } |
| 543 | |
| 544 | // ------------------------------------------------------------------------------- |
| 545 | // |
| 546 | // Deviation of Time |
| 547 | // |
| 548 | // ------------------------------------------------------------------------------- |
| 549 | |
| 550 | interface ITimeDeviation { |
| 551 | op Time getLowerBound() |
| 552 | op Time getUpperBound() |
| 553 | op Time getAverage() |
| 554 | } |
| 555 | |
| 556 | abstract class TimeInterval { |
| 557 | contains Time[1] lowerBound |
| 558 | contains Time[1] upperBound |
| 559 | |
| 560 | op Time getAverage() { |
| 561 | lowerBound.add( upperBound.subtract(lowerBound).multiply(0.5) ) |
| 562 | } |
| 563 | |
| 564 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 565 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 566 | } |
| 567 | } |
| 568 | |
| 569 | class TimeConstant extends ITimeDeviation { |
| 570 | contains Time[1] value |
| 571 | |
| 572 | op Time getLowerBound() { value } |
| 573 | op Time getUpperBound() { value } |
| 574 | op Time getAverage() { value } |
| 575 | } |
| 576 | |
| 577 | class TimeHistogram extends ITimeDeviation { |
| 578 | contains TimeHistogramEntry[+] entries |
| 579 | |
| 580 | op Time getLowerBound() { entries.map[lowerBound].min } |
| 581 | op Time getUpperBound() { entries.map[upperBound].max } |
| 582 | op Time getAverage() { |
| 583 | val sum = entries.map[average.multiply(occurrences)].reduce[p1, p2 | p1.add(p2)] |
| 584 | val count = entries.map[occurrences].reduce[p1, p2 | p1 + p2] |
| 585 | sum.multiply(1.0 / count) |
| 586 | } |
| 587 | } |
| 588 | |
| 589 | class TimeHistogramEntry extends TimeInterval { |
| 590 | PositiveLong[1] occurrences = "1" |
| 591 | } |
| 592 | |
| 593 | abstract class BoundedTimeDistribution extends TimeInterval, ITimeDeviation {} |
| 594 | |
| 595 | abstract class TruncatedTimeDistribution extends ITimeDeviation { |
| 596 | contains Time lowerBound |
| 597 | contains Time upperBound |
| 598 | |
| 599 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 600 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | /* |
| 605 | * Defines the upper and lower bounds of a value interval without defining the distribution |
| 606 | */ |
| 607 | class TimeBoundaries extends BoundedTimeDistribution { |
| 608 | SamplingType samplingType |
| 609 | } |
| 610 | |
| 611 | /* |
| 612 | * Defines the upper bound, lower bound and mean of a value interval without defining the distribution |
| 613 | */ |
| 614 | class TimeStatistics extends BoundedTimeDistribution { |
| 615 | contains Time[1] average |
| 616 | } |
| 617 | |
| 618 | /* |
| 619 | * Uniform distribution |
| 620 | */ |
| 621 | class TimeUniformDistribution extends BoundedTimeDistribution {} |
| 622 | |
| 623 | /* |
| 624 | * Gauss distribution |
| 625 | */ |
| 626 | class TimeGaussDistribution extends TruncatedTimeDistribution { |
| 627 | contains Time[1] mean |
| 628 | contains Time[1] sd |
| 629 | |
| 630 | op Time getAverage() { |
| 631 | if (lowerBound === null && upperBound === null) return mean |
| 632 | return AmaltheaServices.getAverageOfTruncatedNormalDistribution(lowerBound, upperBound, mean, sd) |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | /* |
| 637 | * Weibull Distribution |
| 638 | * The parameter of a Weibull distribution (kappa, lambda...) are calculated from the estimators minimum, maximum and average. |
| 639 | */ |
| 640 | class TimeWeibullEstimatorsDistribution extends BoundedTimeDistribution { |
| 641 | contains Time[1] average |
| 642 | PositiveDouble[1] pRemainPromille = "1.0" |
| 643 | } |
| 644 | |
| 645 | /* |
| 646 | * Beta distribution |
| 647 | */ |
| 648 | class TimeBetaDistribution extends BoundedTimeDistribution { |
| 649 | PositiveDouble[1] alpha = "1.0" |
| 650 | PositiveDouble[1] beta = "1.0" |
| 651 | |
| 652 | op Time getAverage() { |
| 653 | val ratio = 1.0 / (1.0 + (beta / alpha)); // mean in interval [0,1] is 1 / (1 + (beta/alpha)) |
| 654 | lowerBound.add( upperBound.subtract(lowerBound).multiply(ratio) ) |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | // ------------------------------------------------------------------------------- |
| 659 | // |
| 660 | // Deviation of Long |
| 661 | // |
| 662 | // ------------------------------------------------------------------------------- |
| 663 | |
| 664 | interface IDiscreteValueDeviation { |
| 665 | op Long getLowerBound() |
| 666 | op Long getUpperBound() |
| 667 | op double getAverage() |
| 668 | } |
| 669 | |
| 670 | abstract class DiscreteValueInterval { |
| 671 | Long[1] lowerBound = "0" |
| 672 | Long[1] upperBound = "0" |
| 673 | |
| 674 | op double getAverage() { |
| 675 | lowerBound + (upperBound - lowerBound) / 2.0 |
| 676 | } |
| 677 | |
| 678 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 679 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | class DiscreteValueConstant extends IDiscreteValueDeviation { |
| 684 | long[1] value = "0" |
| 685 | |
| 686 | op Long getLowerBound() { value } |
| 687 | op Long getUpperBound() { value } |
| 688 | op double getAverage() { value.doubleValue } |
| 689 | } |
| 690 | |
| 691 | class DiscreteValueHistogram extends IDiscreteValueDeviation { |
| 692 | contains DiscreteValueHistogramEntry[+] entries |
| 693 | |
| 694 | op Long getLowerBound() { entries.map[lowerBound].min } |
| 695 | op Long getUpperBound() { entries.map[upperBound].max } |
| 696 | op double getAverage() { |
| 697 | val sum = entries.map[average * occurrences].reduce[p1, p2 | p1 + p2] |
| 698 | val count = entries.map[occurrences].reduce[p1, p2 | p1 + p2] |
| 699 | sum / count |
| 700 | } |
| 701 | } |
| 702 | |
| 703 | class DiscreteValueHistogramEntry extends DiscreteValueInterval { |
| 704 | PositiveLong[1] occurrences = "1" |
| 705 | } |
| 706 | |
| 707 | abstract class BoundedDiscreteValueDistribution extends DiscreteValueInterval, IDiscreteValueDeviation {} |
| 708 | |
| 709 | abstract class TruncatedDiscreteValueDistribution extends IDiscreteValueDeviation { |
| 710 | Long lowerBound // initial value is null |
| 711 | Long upperBound // initial value is null |
| 712 | |
| 713 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 714 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | /* |
| 719 | * Defines the upper and lower bounds of a value interval without defining the distribution |
| 720 | */ |
| 721 | class DiscreteValueBoundaries extends BoundedDiscreteValueDistribution { |
| 722 | SamplingType samplingType |
| 723 | } |
| 724 | |
| 725 | /* |
| 726 | * Defines the upper bound, lower bound and mean of a value interval without defining the distribution |
| 727 | */ |
| 728 | class DiscreteValueStatistics extends BoundedDiscreteValueDistribution { |
| 729 | double[1] average = "0.0" |
| 730 | } |
| 731 | |
| 732 | /* |
| 733 | * Uniform distribution |
| 734 | */ |
| 735 | class DiscreteValueUniformDistribution extends BoundedDiscreteValueDistribution {} |
| 736 | |
| 737 | /* |
| 738 | * Gauss distribution |
| 739 | */ |
| 740 | class DiscreteValueGaussDistribution extends TruncatedDiscreteValueDistribution { |
| 741 | double[1] mean = "0.0" |
| 742 | PositiveDouble[1] sd = "1.0" |
| 743 | |
| 744 | op double getAverage() { |
| 745 | if (lowerBound === null && upperBound === null) return mean |
| 746 | return AmaltheaServices.getAverageOfTruncatedNormalDistribution(lowerBound, upperBound, mean, sd) |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | /* |
| 751 | * Weibull Distribution |
| 752 | * The parameter of a Weibull distribution (kappa, lambda...) are calculated from the estimators minimum, maximum and average. |
| 753 | */ |
| 754 | class DiscreteValueWeibullEstimatorsDistribution extends BoundedDiscreteValueDistribution { |
| 755 | double[1] average = "0.0" |
| 756 | PositiveDouble[1] pRemainPromille = "1.0" |
| 757 | } |
| 758 | |
| 759 | /* |
| 760 | * Beta distribution |
| 761 | */ |
| 762 | class DiscreteValueBetaDistribution extends BoundedDiscreteValueDistribution { |
| 763 | PositiveDouble[1] alpha = "1.0" |
| 764 | PositiveDouble[1] beta = "1.0" |
| 765 | |
| 766 | op double getAverage() { |
| 767 | val ratio = 1.0 / (1.0 + (beta / alpha)); // mean in interval [0,1] is 1 / (1 + (beta/alpha)) |
| 768 | lowerBound + (upperBound - lowerBound) * ratio |
| 769 | } |
| 770 | } |
| 771 | |
| 772 | // ------------------------------------------------------------------------------- |
| 773 | // |
| 774 | // Deviation of Double |
| 775 | // |
| 776 | // ------------------------------------------------------------------------------- |
| 777 | |
| 778 | interface IContinuousValueDeviation { |
| 779 | op Double getLowerBound() |
| 780 | op Double getUpperBound() |
| 781 | op double getAverage() |
| 782 | } |
| 783 | |
| 784 | abstract class ContinuousValueInterval { |
| 785 | Double[1] lowerBound = "0.0" |
| 786 | Double[1] upperBound = "0.0" |
| 787 | |
| 788 | op double getAverage() { |
| 789 | lowerBound + (upperBound - lowerBound) / 2.0 |
| 790 | } |
| 791 | |
| 792 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 793 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | class ContinuousValueConstant extends IContinuousValueDeviation { |
| 798 | double[1] value = "0.0" |
| 799 | |
| 800 | op Double getLowerBound() { value } |
| 801 | op Double getUpperBound() { value } |
| 802 | op double getAverage() { value } |
| 803 | } |
| 804 | |
| 805 | class ContinuousValueHistogram extends IContinuousValueDeviation { |
| 806 | contains ContinuousValueHistogramEntry[+] entries |
| 807 | |
| 808 | op Double getLowerBound() { entries.map[lowerBound].min } |
| 809 | op Double getUpperBound() { entries.map[upperBound].max } |
| 810 | op double getAverage() { |
| 811 | val sum = entries.map[average * occurrences].reduce[p1, p2 | p1 + p2] |
| 812 | val count = entries.map[occurrences].reduce[p1, p2 | p1 + p2] |
| 813 | sum / count |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | class ContinuousValueHistogramEntry extends ContinuousValueInterval { |
| 818 | PositiveLong[1] occurrences = "1" |
| 819 | } |
| 820 | |
| 821 | abstract class BoundedContinuousValueDistribution extends ContinuousValueInterval, IContinuousValueDeviation {} |
| 822 | |
| 823 | abstract class TruncatedContinuousValueDistribution extends IContinuousValueDeviation { |
| 824 | Double lowerBound // initial value is null |
| 825 | Double upperBound // initial value is null |
| 826 | |
| 827 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 828 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 829 | } |
| 830 | } |
| 831 | |
| 832 | /* |
| 833 | * Defines the upper and lower bounds of a value interval without defining the distribution |
| 834 | */ |
| 835 | class ContinuousValueBoundaries extends BoundedContinuousValueDistribution { |
| 836 | SamplingType samplingType |
| 837 | } |
| 838 | |
| 839 | /* |
| 840 | * Defines the upper bound, lower bound and mean of a value interval without defining the distribution |
| 841 | */ |
| 842 | class ContinuousValueStatistics extends BoundedContinuousValueDistribution { |
| 843 | double[1] average = "0.0" |
| 844 | } |
| 845 | |
| 846 | /* |
| 847 | * Uniform distribution |
| 848 | */ |
| 849 | class ContinuousValueUniformDistribution extends BoundedContinuousValueDistribution {} |
| 850 | |
| 851 | /* |
| 852 | * Gauss distribution |
| 853 | */ |
| 854 | class ContinuousValueGaussDistribution extends TruncatedContinuousValueDistribution { |
| 855 | double[1] mean = "0.0" |
| 856 | PositiveDouble[1] sd = "1.0" |
| 857 | |
| 858 | op double getAverage() { |
| 859 | if (lowerBound === null && upperBound === null) return mean |
| 860 | return AmaltheaServices.getAverageOfTruncatedNormalDistribution(lowerBound, upperBound, mean, sd) |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | /* |
| 865 | * Weibull Distribution |
| 866 | * The parameter of a Weibull distribution (kappa, lambda...) are calculated from the estimators minimum, maximum and average. |
| 867 | */ |
| 868 | class ContinuousValueWeibullEstimatorsDistribution extends BoundedContinuousValueDistribution { |
| 869 | double[1] average = "0.0" |
| 870 | PositiveDouble[1] pRemainPromille = "1.0" |
| 871 | } |
| 872 | |
| 873 | /* |
| 874 | * Beta distribution |
| 875 | */ |
| 876 | class ContinuousValueBetaDistribution extends BoundedContinuousValueDistribution { |
| 877 | PositiveDouble[1] alpha = "1.0" |
| 878 | PositiveDouble[1] beta = "1.0" |
| 879 | |
| 880 | op double getAverage() { |
| 881 | val ratio = 1.0 / (1.0 + (beta / alpha)); // mean in interval [0,1] is 1 / (1 + (beta/alpha)) |
| 882 | lowerBound + (upperBound - lowerBound) * ratio |
| 883 | } |
| 884 | } |
| 885 | |
| 886 | // ------------------------------------------------------------------------------- |
| 887 | // |
| 888 | // Modes |
| 889 | // |
| 890 | // ------------------------------------------------------------------------------- |
| 891 | |
| 892 | abstract class Mode extends ReferableBaseObject {} |
| 893 | |
| 894 | class NumericMode extends Mode |
| 895 | { |
| 896 | // future extensions (restrictions) possible, e.g. range |
| 897 | } |
| 898 | |
| 899 | class EnumMode extends Mode |
| 900 | { |
| 901 | contains ModeLiteral[] literals opposite containingMode |
| 902 | |
| 903 | op ModeLiteral getLiteral(String literal) { |
| 904 | literals.findFirst[it.name == literal] |
| 905 | } |
| 906 | } |
| 907 | |
| 908 | class ModeLiteral extends ReferableBaseObject |
| 909 | { |
| 910 | @GenModel(propertyCategory="Read only") |
| 911 | container readonly EnumMode containingMode opposite literals |
| 912 | |
| 913 | op String getNamePrefix() { containingMode?.name } |
| 914 | |
| 915 | op String toString() { |
| 916 | if (name.nullOrEmpty) "<literal>" else name |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | // ------------------------------------------------------------------------------- |
| 921 | // |
| 922 | // Datatypes |
| 923 | // |
| 924 | // ------------------------------------------------------------------------------- |
| 925 | |
| 926 | /* |
| 927 | * Hardware Address (long; specified as hexadecimal value) |
| 928 | */ |
| 929 | @ExtendedMetaData(minInclusive="0") |
| 930 | type Address wraps long |
| 931 | create { |
| 932 | if (it !== null) { |
| 933 | if (it.startsWith("-") || it.startsWith("+")) |
| 934 | throw new NumberFormatException("Sign character") |
| 935 | else |
| 936 | Long.decode(it) |
| 937 | } |
| 938 | } |
| 939 | convert { |
| 940 | "0x" + Long.toHexString(it) |
| 941 | } |
| 942 | |
| 943 | // |
| 944 | // Positive Numbers (value > 0): Integer (int), Long (long), Double (double) |
| 945 | // |
| 946 | |
| 947 | @ExtendedMetaData(minExclusive="0") |
| 948 | type PositiveInt wraps int |
| 949 | |
| 950 | @ExtendedMetaData(minExclusive="0") |
| 951 | type PositiveLong wraps long |
| 952 | |
| 953 | @ExtendedMetaData(minExclusive="0") |
| 954 | type PositiveDouble wraps double |
| 955 | |
| 956 | // |
| 957 | // Non Negative Numbers(value >= 0): Integer (int), Long (long), Double (double) |
| 958 | // |
| 959 | |
| 960 | @ExtendedMetaData(minInclusive="0") |
| 961 | type NonNegativeInt wraps int |
| 962 | |
| 963 | @ExtendedMetaData(minInclusive="0") |
| 964 | type NonNegativeLong wraps long |
| 965 | |
| 966 | @ExtendedMetaData(minInclusive="0") |
| 967 | type NonNegativeDouble wraps double |
| 968 | |
| 969 | |
| 970 | // =============================================================================== |
| 971 | // =============================================================================== |
| 972 | // |
| 973 | // Components Model |
| 974 | // |
| 975 | // =============================================================================== |
| 976 | // =============================================================================== |
| 977 | |
| 978 | |
| 979 | class ComponentsModel extends BaseObject |
| 980 | { |
| 981 | contains Component[] components |
| 982 | contains System[] systems |
| 983 | } |
| 984 | |
| 985 | interface ISystem |
| 986 | { |
| 987 | contains ComponentInstance[] componentInstances |
| 988 | contains Connector[] connectors |
| 989 | contains QualifiedPort[] groundedPorts |
| 990 | |
| 991 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 992 | refers derived readonly QualifiedPort[] innerPorts get { |
| 993 | AmaltheaServices.getInnerPorts(this); |
| 994 | } |
| 995 | } |
| 996 | |
| 997 | abstract class Port extends ReferableBaseObject, ITaggable |
| 998 | { |
| 999 | @GenModel(propertyCategory="Read only") |
| 1000 | container readonly Component containingComponent opposite ports |
| 1001 | |
| 1002 | op String getNamePrefix() { containingComponent?.name } |
| 1003 | } |
| 1004 | |
| 1005 | class Component extends ReferableBaseObject, ITaggable |
| 1006 | { |
| 1007 | contains Port[] ports opposite containingComponent |
| 1008 | refers AbstractProcess[] tasks |
| 1009 | refers Runnable[] runnables |
| 1010 | refers Label[] labels |
| 1011 | refers Semaphore[] semaphores |
| 1012 | refers OsEvent[] osEvents |
| 1013 | } |
| 1014 | |
| 1015 | class Composite extends Component, ISystem {} |
| 1016 | |
| 1017 | class System extends ReferableBaseObject, ITaggable, ISystem {} |
| 1018 | |
| 1019 | class ComponentInstance extends ReferableBaseObject, ITaggable |
| 1020 | { |
| 1021 | refers Component ^type |
| 1022 | } |
| 1023 | |
| 1024 | class Connector extends BaseObject, INamed, ITaggable |
| 1025 | { |
| 1026 | contains QualifiedPort sourcePort |
| 1027 | contains QualifiedPort targetPort |
| 1028 | } |
| 1029 | |
| 1030 | class QualifiedPort extends BaseObject |
| 1031 | { |
| 1032 | refers ComponentInstance instance |
| 1033 | refers Port port |
| 1034 | } |
| 1035 | |
| 1036 | class InterfacePort extends Port |
| 1037 | { |
| 1038 | String interfaceName |
| 1039 | InterfaceKind kind |
| 1040 | } |
| 1041 | |
| 1042 | enum InterfaceKind |
| 1043 | { |
| 1044 | _undefined_ // Display: "<kind>" |
| 1045 | provides // Display: "PROVIDES" |
| 1046 | requires // Display: "REQUIRES" |
| 1047 | provides_requires // Display: "PROVIDES+REQUIRES" |
| 1048 | } |
| 1049 | |
| 1050 | |
| 1051 | // =============================================================================== |
| 1052 | // =============================================================================== |
| 1053 | // |
| 1054 | // Config Model |
| 1055 | // |
| 1056 | // =============================================================================== |
| 1057 | // =============================================================================== |
| 1058 | |
| 1059 | |
| 1060 | class ConfigModel extends BaseObject |
| 1061 | { |
| 1062 | contains EventConfig[] eventsToTrace |
| 1063 | } |
| 1064 | |
| 1065 | class EventConfig extends BaseObject, INamed |
| 1066 | { |
| 1067 | refers EntityEvent[1] event |
| 1068 | } |
| 1069 | |
| 1070 | |
| 1071 | // =============================================================================== |
| 1072 | // =============================================================================== |
| 1073 | // |
| 1074 | // Constraints Model |
| 1075 | // |
| 1076 | // =============================================================================== |
| 1077 | // =============================================================================== |
| 1078 | |
| 1079 | |
| 1080 | class ConstraintsModel extends BaseObject |
| 1081 | { |
| 1082 | contains EventChain[] eventChains |
| 1083 | contains TimingConstraint[] timingConstraints |
| 1084 | contains AffinityConstraint[] affinityConstraints |
| 1085 | contains RunnableSequencingConstraint[] runnableSequencingConstraints |
| 1086 | contains DataAgeConstraint[] dataAgeConstraints |
| 1087 | contains Requirement[] requirements |
| 1088 | contains DataCoherencyGroup[] dataCoherencyGroups |
| 1089 | contains DataStabilityGroup[] dataStabilityGroups |
| 1090 | contains PhysicalSectionConstraint[] physicalSectionConstraints |
| 1091 | } |
| 1092 | |
| 1093 | enum RunnableOrderType{ |
| 1094 | _undefined_ // Display: "<order>" |
| 1095 | successor |
| 1096 | immediateSuccessorStartSequence |
| 1097 | immediateSuccessorAnySequence |
| 1098 | immediateSuccessorEndSequence |
| 1099 | } |
| 1100 | |
| 1101 | class RunnableSequencingConstraint extends ReferableBaseObject |
| 1102 | { |
| 1103 | RunnableOrderType orderType |
| 1104 | contains RunnableEntityGroup[2..*] runnableGroups |
| 1105 | refers AbstractProcess[] processScope |
| 1106 | } |
| 1107 | |
| 1108 | abstract class AffinityConstraint extends ReferableBaseObject {} |
| 1109 | |
| 1110 | /* |
| 1111 | * An abstract superclass for all separation constraints |
| 1112 | */ |
| 1113 | abstract class SeparationConstraint extends AffinityConstraint {} |
| 1114 | |
| 1115 | /* |
| 1116 | * An abstract superclass for all pairing constraints |
| 1117 | */ |
| 1118 | abstract class PairingConstraint extends AffinityConstraint {} |
| 1119 | |
| 1120 | /* |
| 1121 | * An abstract superclass for all process related constraint |
| 1122 | * The target describes the entity on which the processes can be mapped |
| 1123 | */ |
| 1124 | abstract class ProcessConstraint |
| 1125 | { |
| 1126 | contains ProcessConstraintTarget target |
| 1127 | } |
| 1128 | |
| 1129 | /* |
| 1130 | * An abstract superclass for all runnable related constraint |
| 1131 | * The target describes the entity on which the runnables can be mapped |
| 1132 | */ |
| 1133 | abstract class RunnableConstraint |
| 1134 | { |
| 1135 | contains RunnableConstraintTarget target |
| 1136 | } |
| 1137 | |
| 1138 | /* |
| 1139 | * An abstract superclass for all data related constraint |
| 1140 | * The target describes the entity on which the data can be mapped |
| 1141 | */ |
| 1142 | abstract class DataConstraint |
| 1143 | { |
| 1144 | contains DataConstraintTarget target |
| 1145 | } |
| 1146 | |
| 1147 | /* |
| 1148 | * A runnable-separation-constraint |
| 1149 | * groups describes the runnable-groups that should be separated from each other on the target |
| 1150 | * if there is only one group then this means that the runnables of this group are not allowed to be executed on the target |
| 1151 | */ |
| 1152 | class RunnableSeparationConstraint extends SeparationConstraint, RunnableConstraint, BaseObject |
| 1153 | { |
| 1154 | contains RunnableGroup[1..2] groups |
| 1155 | } |
| 1156 | |
| 1157 | /* |
| 1158 | * A process-separation-constraint |
| 1159 | * groups describes the process-groups that should be separated from each other on the target |
| 1160 | * if there is only one group then this means that the processes of this group are not allowed to be executed on the target |
| 1161 | */ |
| 1162 | class ProcessSeparationConstraint extends SeparationConstraint, ProcessConstraint, BaseObject |
| 1163 | { |
| 1164 | contains ProcessGroup[1..2] groups |
| 1165 | } |
| 1166 | |
| 1167 | /* |
| 1168 | * A data-separation-constraint |
| 1169 | * groups describes the label-groups that should be separated from each other on the target |
| 1170 | * if there is only one group then this means that the label of this group is not allowed to be executed on the target |
| 1171 | */ |
| 1172 | class DataSeparationConstraint extends SeparationConstraint, DataConstraint, BaseObject |
| 1173 | { |
| 1174 | contains LabelEntityGroup[1..2] groups |
| 1175 | } |
| 1176 | |
| 1177 | /* |
| 1178 | * A runnable-pairing-constraint |
| 1179 | * runnables describes the group of runnables that should be paired on the target |
| 1180 | */ |
| 1181 | class RunnablePairingConstraint extends PairingConstraint, RunnableConstraint, BaseObject |
| 1182 | { |
| 1183 | contains RunnableGroup[1] group |
| 1184 | } |
| 1185 | |
| 1186 | /* |
| 1187 | * A process-pairing-constraint |
| 1188 | * processes describes the group of processes that should be paired on the target |
| 1189 | */ |
| 1190 | class ProcessPairingConstraint extends PairingConstraint, ProcessConstraint, BaseObject |
| 1191 | { |
| 1192 | contains ProcessGroup[1] group |
| 1193 | } |
| 1194 | |
| 1195 | /* |
| 1196 | * A data-pairing-constraint |
| 1197 | * labels describes the group of labels that should be paired on the target |
| 1198 | */ |
| 1199 | class DataPairingConstraint extends PairingConstraint, DataConstraint, BaseObject |
| 1200 | { |
| 1201 | contains LabelGroup[1] group |
| 1202 | } |
| 1203 | |
| 1204 | /* |
| 1205 | * An abstract superclass for all possible targets for runnable-constraints |
| 1206 | */ |
| 1207 | abstract class RunnableConstraintTarget {} |
| 1208 | |
| 1209 | /* |
| 1210 | * An abstract superclass for all possible targets for process-constraints |
| 1211 | */ |
| 1212 | abstract class ProcessConstraintTarget {} |
| 1213 | |
| 1214 | /* |
| 1215 | * An abstract superclass for all possible targets for data-constraints |
| 1216 | */ |
| 1217 | abstract class DataConstraintTarget {} |
| 1218 | |
| 1219 | /* |
| 1220 | * A memory target description |
| 1221 | * A memory can be a target for data-constraints |
| 1222 | * memories: the reference to zero or more Memories. If this list is empty, the target stands for all memories! |
| 1223 | */ |
| 1224 | class TargetMemory extends DataConstraintTarget, BaseObject |
| 1225 | { |
| 1226 | refers Memory[] memories |
| 1227 | } |
| 1228 | |
| 1229 | /* |
| 1230 | * A core target description |
| 1231 | * A core can be a target for runnable-constraints, process-constraints and scheduler-constraints |
| 1232 | * cores: the reference to zero or more Cores. If this list is empty, the target stands for all cores! |
| 1233 | */ |
| 1234 | class TargetCore extends RunnableConstraintTarget, ProcessConstraintTarget, BaseObject |
| 1235 | { |
| 1236 | refers ProcessingUnit[] cores |
| 1237 | } |
| 1238 | |
| 1239 | /* |
| 1240 | * A scheduler target description |
| 1241 | * A scheduler can be a target for runnable-constraints and process-constraints |
| 1242 | * schedulers: the reference to zero or more Schedulers. If this list is empty, the target stands for all schedulers! |
| 1243 | */ |
| 1244 | class TargetScheduler extends RunnableConstraintTarget, ProcessConstraintTarget, BaseObject |
| 1245 | { |
| 1246 | refers Scheduler[] schedulers |
| 1247 | } |
| 1248 | |
| 1249 | /* |
| 1250 | * An abstract description for a group of labels that can be paired or separated by a runnable-constraint |
| 1251 | */ |
| 1252 | abstract class LabelGroup {} |
| 1253 | |
| 1254 | /* |
| 1255 | * An abstract description for a group of runnables that can be paired or separated by a runnable-constraint |
| 1256 | */ |
| 1257 | abstract class RunnableGroup {} |
| 1258 | |
| 1259 | /* |
| 1260 | * An abstract description for a group of processes that can be paired or separated by a process-constraint |
| 1261 | */ |
| 1262 | abstract class ProcessGroup {} |
| 1263 | |
| 1264 | /* |
| 1265 | * A group of labels that can be paired or separated by a data-constraint |
| 1266 | */ |
| 1267 | class LabelEntityGroup extends LabelGroup, BaseObject |
| 1268 | { |
| 1269 | refers Label[1..*] labels |
| 1270 | } |
| 1271 | |
| 1272 | /* |
| 1273 | * A group of runnables that can be paired or separated by a runnable-constraint |
| 1274 | */ |
| 1275 | class RunnableEntityGroup extends RunnableGroup, BaseObject |
| 1276 | { |
| 1277 | refers Runnable[1..*] runnables |
| 1278 | } |
| 1279 | |
| 1280 | /* |
| 1281 | * A group of processes that can be paired or separated by a process-constraint |
| 1282 | */ |
| 1283 | class ProcessEntityGroup extends ProcessGroup, BaseObject |
| 1284 | { |
| 1285 | refers Process[1..*] processes |
| 1286 | } |
| 1287 | |
| 1288 | /* |
| 1289 | * A group that contains only a tag and groups all objects that are marked with this tag |
| 1290 | * This can be runnables or processes |
| 1291 | */ |
| 1292 | class TagGroup extends RunnableGroup, ProcessGroup, BaseObject |
| 1293 | { |
| 1294 | refers Tag[1] tag |
| 1295 | } |
| 1296 | |
| 1297 | //////////////////////////Event chains & Timing constraints: |
| 1298 | /* |
| 1299 | * Describes an event chain which must have a minimum of two events (stimulus and response) |
| 1300 | * If there are more events the event chain have to be divided into segments. Each segment is another event chain. |
| 1301 | * Alternative event paths are contained in strands. |
| 1302 | * stimulus: Beginning of chain |
| 1303 | * response: End of chain |
| 1304 | * segments: Sub event chains |
| 1305 | * strands: alternative event paths |
| 1306 | */ |
| 1307 | abstract class AbstractEventChain extends BaseObject, INamed |
| 1308 | { |
| 1309 | refers Event[1] stimulus |
| 1310 | refers Event[1] response |
| 1311 | contains EventChainItem[] segments |
| 1312 | contains EventChainItem[] strands |
| 1313 | } |
| 1314 | |
| 1315 | class EventChain extends AbstractEventChain, IReferable {} |
| 1316 | |
| 1317 | class SubEventChain extends AbstractEventChain {} |
| 1318 | |
| 1319 | interface EventChainItem |
| 1320 | { |
| 1321 | op AbstractEventChain getEventChain() |
| 1322 | } |
| 1323 | |
| 1324 | class EventChainReference extends BaseObject, EventChainItem |
| 1325 | { |
| 1326 | refers EventChain[1] eventChain |
| 1327 | } |
| 1328 | |
| 1329 | class EventChainContainer extends BaseObject, EventChainItem |
| 1330 | { |
| 1331 | contains SubEventChain[1] eventChain |
| 1332 | } |
| 1333 | |
| 1334 | abstract class TimingConstraint extends ReferableBaseObject {} |
| 1335 | |
| 1336 | /* |
| 1337 | * This contraints is used to limit a section in Memories |
| 1338 | */ |
| 1339 | class PhysicalSectionConstraint extends ReferableBaseObject |
| 1340 | { |
| 1341 | refers Section[1] section |
| 1342 | refers Memory[+] memories |
| 1343 | } |
| 1344 | |
| 1345 | /* |
| 1346 | * Base class for synchronization constraints, which limit the distance between events |
| 1347 | * multipleOccurrencesAllowed: Defines whether multiple event occurrences are allowed for analysis |
| 1348 | * tolerance: Maximum allowed tolerance |
| 1349 | */ |
| 1350 | abstract class SynchronizationConstraint extends TimingConstraint |
| 1351 | { |
| 1352 | boolean multipleOccurrencesAllowed = "false" |
| 1353 | contains Time[1] tolerance |
| 1354 | } |
| 1355 | |
| 1356 | /* |
| 1357 | * The synchronization constraint considers a group of events and limits the distance of the events within this group. |
| 1358 | */ |
| 1359 | class EventSynchronizationConstraint extends SynchronizationConstraint |
| 1360 | { |
| 1361 | refers EntityEvent[+] events |
| 1362 | } |
| 1363 | |
| 1364 | enum SynchronizationType |
| 1365 | { |
| 1366 | _undefined_ // Display: "<synchronization>" |
| 1367 | Stimulus |
| 1368 | Response |
| 1369 | } |
| 1370 | |
| 1371 | /* |
| 1372 | * A synchronization constraint describes the allowed tolerance in synchronization between two event chains |
| 1373 | * scope: Considered event chains that have to by in sync |
| 1374 | * type: Defines which parts of the event chains have to be in sync |
| 1375 | */ |
| 1376 | class EventChainSynchronizationConstraint extends SynchronizationConstraint |
| 1377 | { |
| 1378 | refers EventChain[2] scope |
| 1379 | SynchronizationType ^type |
| 1380 | } |
| 1381 | |
| 1382 | enum MappingType |
| 1383 | { |
| 1384 | _undefined_ // Display: "<mapping>" |
| 1385 | OneToOne |
| 1386 | Reaction |
| 1387 | UniqueReaction |
| 1388 | } |
| 1389 | |
| 1390 | /* |
| 1391 | * This constraint describes how a source and a target event are placed relative to each other |
| 1392 | */ |
| 1393 | class DelayConstraint extends TimingConstraint |
| 1394 | { |
| 1395 | MappingType mappingType |
| 1396 | refers EntityEvent[1] source |
| 1397 | refers EntityEvent[1] target |
| 1398 | contains Time upper |
| 1399 | contains Time lower |
| 1400 | } |
| 1401 | |
| 1402 | enum LatencyType |
| 1403 | { |
| 1404 | _undefined_ // Display: "<latency>" |
| 1405 | Age |
| 1406 | Reaction |
| 1407 | } |
| 1408 | |
| 1409 | /* |
| 1410 | * A latency constraint describes the allowed range in latency between a stimulus and its response. |
| 1411 | * scope: Considered event chain that defines the stimulus and response relation |
| 1412 | * type: Defines the point of view (forward or backward) |
| 1413 | * minimum: Minimum allowed latency |
| 1414 | * maximum: Maximum allowed latency |
| 1415 | */ |
| 1416 | class EventChainLatencyConstraint extends TimingConstraint |
| 1417 | { |
| 1418 | refers EventChain[1] scope |
| 1419 | LatencyType ^type |
| 1420 | contains Time minimum |
| 1421 | contains Time maximum |
| 1422 | } |
| 1423 | |
| 1424 | /* |
| 1425 | * A repetition constraint prescribes the distribution of a single event during runtime. |
| 1426 | */ |
| 1427 | class RepetitionConstraint extends TimingConstraint |
| 1428 | { |
| 1429 | refers EntityEvent[1] event |
| 1430 | int span = "0" |
| 1431 | contains Time lower |
| 1432 | contains Time upper |
| 1433 | contains Time jitter |
| 1434 | contains Time period |
| 1435 | } |
| 1436 | |
| 1437 | //////////////////////////Data Age Constraint |
| 1438 | class DataAgeConstraint extends ReferableBaseObject |
| 1439 | { |
| 1440 | refers Runnable[1] runnable |
| 1441 | refers Label[1] label |
| 1442 | contains DataAge[1] dataAge |
| 1443 | } |
| 1444 | |
| 1445 | abstract class DataAge {} |
| 1446 | |
| 1447 | class DataAgeCycle extends DataAge |
| 1448 | { |
| 1449 | int minimumCycle = "0" |
| 1450 | int maximumCycle = "0" |
| 1451 | } |
| 1452 | |
| 1453 | class DataAgeTime extends DataAge |
| 1454 | { |
| 1455 | contains Time minimumTime |
| 1456 | contains Time maximumTime |
| 1457 | } |
| 1458 | |
| 1459 | ////////////////////////// Requirements |
| 1460 | abstract class Requirement extends BaseObject, INamed |
| 1461 | { |
| 1462 | Severity severity |
| 1463 | contains RequirementLimit[1] limit |
| 1464 | } |
| 1465 | |
| 1466 | class ProcessRequirement extends Requirement |
| 1467 | { |
| 1468 | refers AbstractProcess[1] process |
| 1469 | } |
| 1470 | |
| 1471 | class RunnableRequirement extends Requirement |
| 1472 | { |
| 1473 | refers Runnable[1] runnable |
| 1474 | } |
| 1475 | |
| 1476 | class ArchitectureRequirement extends Requirement |
| 1477 | { |
| 1478 | refers Component[1] component |
| 1479 | } |
| 1480 | |
| 1481 | class ProcessChainRequirement extends Requirement |
| 1482 | { |
| 1483 | refers ProcessChain[1] processChain |
| 1484 | } |
| 1485 | |
| 1486 | abstract class RequirementLimit |
| 1487 | { |
| 1488 | LimitType limitType |
| 1489 | } |
| 1490 | |
| 1491 | class CPUPercentageRequirementLimit extends RequirementLimit |
| 1492 | { |
| 1493 | CPUPercentageMetric metric |
| 1494 | double limitValue = "0.0" |
| 1495 | // can be ECU, Processor or Core |
| 1496 | refers ProcessingUnit hardwareContext |
| 1497 | } |
| 1498 | |
| 1499 | class FrequencyRequirementLimit extends RequirementLimit |
| 1500 | { |
| 1501 | FrequencyMetric metric |
| 1502 | contains Frequency[1] limitValue |
| 1503 | } |
| 1504 | |
| 1505 | class PercentageRequirementLimit extends RequirementLimit |
| 1506 | { |
| 1507 | PercentageMetric metric |
| 1508 | double limitValue = "0.0" |
| 1509 | } |
| 1510 | |
| 1511 | class CountRequirementLimit extends RequirementLimit |
| 1512 | { |
| 1513 | CountMetric metric |
| 1514 | int limitValue = "0" |
| 1515 | } |
| 1516 | |
| 1517 | class TimeRequirementLimit extends RequirementLimit |
| 1518 | { |
| 1519 | TimeMetric metric |
| 1520 | // signed time is allowed because the requirement to lateness can be negative |
| 1521 | contains Time[1] limitValue |
| 1522 | } |
| 1523 | |
| 1524 | enum Severity |
| 1525 | { |
| 1526 | _undefined_ // Display: "<severity>" |
| 1527 | Cosmetic |
| 1528 | Minor |
| 1529 | Major |
| 1530 | Critical |
| 1531 | } |
| 1532 | |
| 1533 | enum LimitType |
| 1534 | { |
| 1535 | _undefined_ // Display: "<limit>" |
| 1536 | UpperLimit |
| 1537 | LowerLimit |
| 1538 | } |
| 1539 | |
| 1540 | enum TimeMetric |
| 1541 | { |
| 1542 | _undefined_ // Display: "<time metric>" |
| 1543 | ActivateToActivate |
| 1544 | CoreExecutionTime |
| 1545 | EndToEnd |
| 1546 | EndToStart |
| 1547 | GrossExecutionTime |
| 1548 | Lateness |
| 1549 | MemoryAccessTime |
| 1550 | NetExecutionTime |
| 1551 | OsOverhead |
| 1552 | ParkingTime |
| 1553 | PollingTime |
| 1554 | ReadyTime |
| 1555 | ResponseTime |
| 1556 | RunningTime |
| 1557 | StartDelay |
| 1558 | StartToStart |
| 1559 | WaitingTime |
| 1560 | } |
| 1561 | |
| 1562 | enum CountMetric |
| 1563 | { |
| 1564 | _undefined_ // Display: "<count metric>" |
| 1565 | Activations |
| 1566 | BoundedMigrations |
| 1567 | CacheHit |
| 1568 | CacheMiss |
| 1569 | FullMigrations |
| 1570 | MtaLimitExceeding |
| 1571 | Preemptions |
| 1572 | } |
| 1573 | |
| 1574 | enum PercentageMetric |
| 1575 | { |
| 1576 | _undefined_ // Display: "<% metric>" |
| 1577 | CacheHitRatio |
| 1578 | CacheMissRatio |
| 1579 | CoreExecutionTimeRelative |
| 1580 | MemoryAccessTimeRelative |
| 1581 | NormalizedLateness |
| 1582 | NormalizedResponseTime |
| 1583 | OsOverheadRelative |
| 1584 | } |
| 1585 | |
| 1586 | enum CPUPercentageMetric |
| 1587 | { |
| 1588 | _undefined_ // Display: "<CPU % metric>" |
| 1589 | CPUBuffering |
| 1590 | CPULoad |
| 1591 | CPUParking |
| 1592 | CPUPolling |
| 1593 | CPUReady |
| 1594 | CPURunning |
| 1595 | CPUWaiting |
| 1596 | } |
| 1597 | |
| 1598 | enum FrequencyMetric |
| 1599 | { |
| 1600 | _undefined_ // Display: "<frequency metric>" |
| 1601 | CacheHitFrequency |
| 1602 | CacheMissFrequency |
| 1603 | } |
| 1604 | |
| 1605 | //////////////////////////// Data Groups (Coherency and Stability) |
| 1606 | class DataCoherencyGroup extends ReferableBaseObject |
| 1607 | { |
| 1608 | refers Label[+] labels |
| 1609 | contains DataGroupScope scope |
| 1610 | CoherencyDirection direction |
| 1611 | } |
| 1612 | |
| 1613 | enum CoherencyDirection |
| 1614 | { |
| 1615 | _undefined_ // Display: "<direction>" |
| 1616 | input |
| 1617 | output |
| 1618 | } |
| 1619 | |
| 1620 | class DataStabilityGroup extends ReferableBaseObject |
| 1621 | { |
| 1622 | refers Label[+] labels |
| 1623 | contains DataGroupScope scope |
| 1624 | } |
| 1625 | |
| 1626 | abstract class DataGroupScope {} |
| 1627 | |
| 1628 | class ProcessScope extends DataGroupScope |
| 1629 | { |
| 1630 | refers AbstractProcess process |
| 1631 | } |
| 1632 | |
| 1633 | class RunnableScope extends DataGroupScope |
| 1634 | { |
| 1635 | refers Runnable runnable |
| 1636 | } |
| 1637 | |
| 1638 | class ComponentScope extends DataGroupScope |
| 1639 | { |
| 1640 | refers Component component |
| 1641 | } |
| 1642 | |
| 1643 | |
| 1644 | // =============================================================================== |
| 1645 | // =============================================================================== |
| 1646 | // |
| 1647 | // Events Model |
| 1648 | // |
| 1649 | // =============================================================================== |
| 1650 | // =============================================================================== |
| 1651 | |
| 1652 | |
| 1653 | class EventModel extends BaseObject |
| 1654 | { |
| 1655 | contains Event[] events |
| 1656 | } |
| 1657 | |
| 1658 | /* |
| 1659 | * An abstract event |
| 1660 | */ |
| 1661 | abstract class Event extends ReferableBaseObject, ITaggable |
| 1662 | { |
| 1663 | String description |
| 1664 | } |
| 1665 | |
| 1666 | /* |
| 1667 | * A set of entity-events |
| 1668 | */ |
| 1669 | class EventSet extends Event |
| 1670 | { |
| 1671 | refers EntityEvent[+] events |
| 1672 | } |
| 1673 | |
| 1674 | /* |
| 1675 | * An abstract event that describes the notification of a changed state of an entity |
| 1676 | */ |
| 1677 | abstract class EntityEvent extends Event {} |
| 1678 | |
| 1679 | /* |
| 1680 | * Defines Events to be used in Stimuli as trigger. |
| 1681 | */ |
| 1682 | abstract class TriggerEvent extends EntityEvent |
| 1683 | { |
| 1684 | } |
| 1685 | |
| 1686 | class CustomEvent extends TriggerEvent |
| 1687 | { |
| 1688 | String eventType |
| 1689 | |
| 1690 | // back pointer (readonly) |
| 1691 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of triggers (CustomEventTrigger).</b></p>") |
| 1692 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 1693 | refers transient readonly volatile derived CustomEventTrigger[] explicitTriggers get { |
| 1694 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.customEvent_ExplicitTriggers, |
| 1695 | #{AmaltheaPackage.eINSTANCE.customEventTrigger_Event} ) |
| 1696 | } |
| 1697 | } |
| 1698 | |
| 1699 | /* |
| 1700 | * Describes the event of a stimulus. |
| 1701 | * It contains only the stimulus but no event type because a stimulus has only one event type. |
| 1702 | */ |
| 1703 | class StimulusEvent extends EntityEvent |
| 1704 | { |
| 1705 | refers Stimulus entity |
| 1706 | } |
| 1707 | |
| 1708 | /* |
| 1709 | * Describes the event of a process |
| 1710 | * eventType: The type of the Event |
| 1711 | * entity: The process that fires the event (optional) |
| 1712 | * processingUnit: The processing unit that executes the process when the event is fired (optional) |
| 1713 | */ |
| 1714 | class ProcessEvent extends EntityEvent |
| 1715 | { |
| 1716 | ProcessEventType eventType |
| 1717 | refers Process entity |
| 1718 | refers ProcessingUnit processingUnit |
| 1719 | } |
| 1720 | |
| 1721 | /* |
| 1722 | * Describes the event of some process within a process chain |
| 1723 | * eventType: The type of the Event |
| 1724 | * entity: The process that fires the event (optional) |
| 1725 | * processingUnit: The processing unit that executes the process when the event is fired (optional) |
| 1726 | */ |
| 1727 | class ProcessChainEvent extends EntityEvent |
| 1728 | { |
| 1729 | ProcessEventType eventType |
| 1730 | refers ProcessChain entity |
| 1731 | refers ProcessingUnit processingUnit |
| 1732 | } |
| 1733 | |
| 1734 | /* |
| 1735 | * Describes the event of a runnable |
| 1736 | * eventType: The type of event |
| 1737 | * entity: The runnable that fires the event (optional) |
| 1738 | * process: The process that executes the runnable (optional) |
| 1739 | * processingUnit: The processing unit that executes the runnable (executes the process that calls the runnable) (optional) |
| 1740 | */ |
| 1741 | class RunnableEvent extends TriggerEvent |
| 1742 | { |
| 1743 | RunnableEventType eventType |
| 1744 | refers Runnable entity |
| 1745 | refers Process process |
| 1746 | refers ProcessingUnit processingUnit |
| 1747 | } |
| 1748 | |
| 1749 | /* |
| 1750 | * Describes the event of a label access |
| 1751 | * eventType: The type of event |
| 1752 | * entity: The accessed label that fires the event (optional) |
| 1753 | * runnable: The runnable that accesses the label (optional) |
| 1754 | * process: The process that accesses the label (optional) |
| 1755 | */ |
| 1756 | class LabelEvent extends TriggerEvent |
| 1757 | { |
| 1758 | LabelEventType eventType |
| 1759 | refers Label entity |
| 1760 | refers Runnable runnable |
| 1761 | refers Process process |
| 1762 | } |
| 1763 | |
| 1764 | /* |
| 1765 | * Describes the event of a channel access |
| 1766 | * eventType: The type of event |
| 1767 | * entity: The accessed channel that fires the event (optional) |
| 1768 | * runnable: The runnable that accesses the label (optional) |
| 1769 | * process: The process that accesses the label (optional) |
| 1770 | */ |
| 1771 | class ChannelEvent extends TriggerEvent |
| 1772 | { |
| 1773 | ChannelEventType eventType |
| 1774 | refers Channel entity |
| 1775 | refers Runnable runnable |
| 1776 | refers Process process |
| 1777 | } |
| 1778 | |
| 1779 | /* |
| 1780 | * Describes the event of a semaphore access |
| 1781 | * eventType: The type of event |
| 1782 | * entity: The accessed semaphore that fires the event (optional) |
| 1783 | * runnable: The runnable that accesses the semaphore (optional) |
| 1784 | * process: The process that accesses the semaphore (optional) |
| 1785 | * processingUnit: The processing unit that executes the process/runnable that accesses the semaphore (optional) |
| 1786 | */ |
| 1787 | class SemaphoreEvent extends EntityEvent |
| 1788 | { |
| 1789 | SemaphoreEventType eventType |
| 1790 | refers Semaphore entity |
| 1791 | refers Runnable runnable |
| 1792 | refers Process process |
| 1793 | refers ProcessingUnit processingUnit |
| 1794 | } |
| 1795 | |
| 1796 | /* |
| 1797 | * Describes the event of a component |
| 1798 | * eventType: The type of event |
| 1799 | * entity: The component that fires the event (optional) |
| 1800 | */ |
| 1801 | class ComponentEvent extends EntityEvent |
| 1802 | { |
| 1803 | ComponentEventType eventType |
| 1804 | refers Component entity |
| 1805 | } |
| 1806 | |
| 1807 | /* |
| 1808 | * The types of a process event |
| 1809 | */ |
| 1810 | enum ProcessEventType |
| 1811 | { |
| 1812 | _all_ |
| 1813 | activate |
| 1814 | deadline |
| 1815 | start |
| 1816 | resume |
| 1817 | preempt |
| 1818 | poll |
| 1819 | run |
| 1820 | wait |
| 1821 | poll_parking |
| 1822 | park |
| 1823 | release_parking |
| 1824 | release |
| 1825 | terminate |
| 1826 | } |
| 1827 | |
| 1828 | /* |
| 1829 | * The types of a runnable event |
| 1830 | */ |
| 1831 | enum RunnableEventType |
| 1832 | { |
| 1833 | _all_ |
| 1834 | start |
| 1835 | suspend |
| 1836 | resume |
| 1837 | terminate |
| 1838 | } |
| 1839 | |
| 1840 | /* |
| 1841 | * The types of a label event |
| 1842 | */ |
| 1843 | enum LabelEventType |
| 1844 | { |
| 1845 | _all_ |
| 1846 | read |
| 1847 | write |
| 1848 | } |
| 1849 | |
| 1850 | /* |
| 1851 | * The types of a label event |
| 1852 | */ |
| 1853 | enum ChannelEventType |
| 1854 | { |
| 1855 | _all_ |
| 1856 | send |
| 1857 | receive |
| 1858 | } |
| 1859 | |
| 1860 | /* |
| 1861 | * The types of a semaphore event |
| 1862 | */ |
| 1863 | enum SemaphoreEventType |
| 1864 | { |
| 1865 | _all_ |
| 1866 | lock |
| 1867 | unlock |
| 1868 | } |
| 1869 | |
| 1870 | /* |
| 1871 | * The types of a component event |
| 1872 | */ |
| 1873 | enum ComponentEventType |
| 1874 | { |
| 1875 | _all_ |
| 1876 | start |
| 1877 | end |
| 1878 | } |
| 1879 | |
| 1880 | |
| 1881 | // =============================================================================== |
| 1882 | // =============================================================================== |
| 1883 | // |
| 1884 | // HW Model |
| 1885 | // |
| 1886 | // =============================================================================== |
| 1887 | // =============================================================================== |
| 1888 | |
| 1889 | |
| 1890 | class HWModel extends BaseObject |
| 1891 | { |
| 1892 | contains HwDefinition[] definitions |
| 1893 | contains HwFeatureCategory[] featureCategories |
| 1894 | contains HwStructure[] structures |
| 1895 | contains HwDomain[] domains |
| 1896 | } |
| 1897 | |
| 1898 | class HwStructure extends ReferableBaseObject, ITaggable |
| 1899 | { |
| 1900 | StructureType structureType |
| 1901 | contains HwPort[] ports |
| 1902 | contains HwStructure[] structures |
| 1903 | contains HwModule[] modules |
| 1904 | contains HwConnection[] connections |
| 1905 | |
| 1906 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 1907 | refers derived readonly HwPort[] innerPorts get { |
| 1908 | AmaltheaServices.getInnerPorts(this); |
| 1909 | } |
| 1910 | } |
| 1911 | |
| 1912 | abstract class HwModule extends ReferableBaseObject, ITaggable |
| 1913 | { |
| 1914 | contains HwPort[] ports |
| 1915 | refers PowerDomain powerDomain |
| 1916 | refers FrequencyDomain frequencyDomain |
| 1917 | } |
| 1918 | |
| 1919 | abstract class HwDomain extends ReferableBaseObject, ITaggable {} |
| 1920 | |
| 1921 | class FrequencyDomain extends HwDomain |
| 1922 | { |
| 1923 | // contains Frequency[] possibleValues |
| 1924 | contains Frequency defaultValue |
| 1925 | boolean clockGating = "false" |
| 1926 | } |
| 1927 | |
| 1928 | class PowerDomain extends HwDomain |
| 1929 | { |
| 1930 | // contains Voltage[] possibleValues |
| 1931 | contains Voltage defaultValue |
| 1932 | boolean powerGating = "false" |
| 1933 | } |
| 1934 | |
| 1935 | class ProcessingUnit extends HwModule, HwDestination, HwPathElement |
| 1936 | { |
| 1937 | refers ProcessingUnitDefinition definition |
| 1938 | contains HwAccessElement[] accessElements opposite source |
| 1939 | contains Cache[] caches |
| 1940 | } |
| 1941 | |
| 1942 | class Memory extends HwModule, HwDestination |
| 1943 | { |
| 1944 | refers MemoryDefinition definition |
| 1945 | |
| 1946 | // back pointer (readonly) |
| 1947 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of mappings (MemoryMapping).</b></p>") |
| 1948 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 1949 | refers transient readonly volatile derived MemoryMapping[] mappings get { |
| 1950 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.memory_Mappings, |
| 1951 | #{AmaltheaPackage.eINSTANCE.memoryMapping_Memory} ) |
| 1952 | } |
| 1953 | } |
| 1954 | |
| 1955 | enum MemoryType |
| 1956 | { |
| 1957 | _undefined_ |
| 1958 | DRAM |
| 1959 | SRAM |
| 1960 | FLASH |
| 1961 | PCM |
| 1962 | } |
| 1963 | |
| 1964 | class Cache extends HwModule, HwPathElement |
| 1965 | { |
| 1966 | refers CacheDefinition definition |
| 1967 | } |
| 1968 | |
| 1969 | class HwFeatureCategory extends ReferableBaseObject |
| 1970 | { |
| 1971 | HwFeatureType featureType |
| 1972 | String description |
| 1973 | contains HwFeature[] features opposite containingCategory |
| 1974 | } |
| 1975 | |
| 1976 | class HwFeature extends ReferableBaseObject |
| 1977 | { |
| 1978 | @GenModel(propertyCategory="Read only") |
| 1979 | container readonly HwFeatureCategory containingCategory opposite features |
| 1980 | |
| 1981 | op String getNamePrefix() { containingCategory?.name } |
| 1982 | |
| 1983 | op String toString() { |
| 1984 | val featureName = containingCategory?.name |
| 1985 | return (if (featureName.nullOrEmpty) "<category>" else featureName) + "::" + (if (name.nullOrEmpty) "<feature>" else name) |
| 1986 | } |
| 1987 | |
| 1988 | double value = "0.0" |
| 1989 | } |
| 1990 | |
| 1991 | class HwPort extends ReferableBaseObject, ITaggable |
| 1992 | { |
| 1993 | op String getNamePrefix() { (eContainer as INamed)?.name } |
| 1994 | |
| 1995 | int bitWidth = "0" |
| 1996 | int priority = "0" |
| 1997 | PortType portType |
| 1998 | PortInterface portInterface |
| 1999 | |
| 2000 | @GenModel(propertyCategory="Read only") |
| 2001 | derived readonly boolean delegated get { |
| 2002 | eContainer instanceof HwStructure |
| 2003 | } |
| 2004 | |
| 2005 | // back pointer (readonly) |
| 2006 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of connections (HwConnection).</b></p>") |
| 2007 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 2008 | refers transient readonly volatile derived HwConnection[] connections get { |
| 2009 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.hwPort_Connections, |
| 2010 | #{AmaltheaPackage.eINSTANCE.hwConnection_Port1, AmaltheaPackage.eINSTANCE.hwConnection_Port2} |
| 2011 | ) |
| 2012 | } |
| 2013 | |
| 2014 | } |
| 2015 | |
| 2016 | class ConnectionHandler extends HwModule, HwPathElement |
| 2017 | { |
| 2018 | refers ConnectionHandlerDefinition definition |
| 2019 | contains HwConnection[] internalConnections |
| 2020 | } |
| 2021 | |
| 2022 | class HwConnection extends ReferableBaseObject, HwPathElement, ITaggable |
| 2023 | { |
| 2024 | op String getNamePrefix() { (eContainer as INamed)?.name } |
| 2025 | |
| 2026 | @GenModel(documentation="<p><b>Read latency [cycles]</b></p>") |
| 2027 | contains IDiscreteValueDeviation readLatency |
| 2028 | @GenModel(documentation="<p><b>Write latency [cycles]</b></p>") |
| 2029 | contains IDiscreteValueDeviation writeLatency |
| 2030 | contains DataRate dataRate |
| 2031 | refers HwPort port1 |
| 2032 | refers HwPort port2 |
| 2033 | |
| 2034 | @GenModel(propertyCategory="Read only") |
| 2035 | derived readonly boolean internal get { |
| 2036 | eContainer instanceof ConnectionHandler |
| 2037 | } |
| 2038 | |
| 2039 | op HwPort[] getPorts() { |
| 2040 | return newArrayList(port1, port2).filterNull.toEList.unmodifiableEList |
| 2041 | } |
| 2042 | } |
| 2043 | |
| 2044 | class HwAccessElement extends ITaggable, INamed |
| 2045 | { |
| 2046 | // container (read only) |
| 2047 | @GenModel(propertyCategory="Read only") |
| 2048 | container readonly ProcessingUnit source opposite accessElements |
| 2049 | |
| 2050 | refers HwDestination[1] destination |
| 2051 | contains HwAccessPath accessPath opposite containingAccessElement |
| 2052 | @GenModel(documentation="<p><b>Read latency [cycles]</b></p>") |
| 2053 | contains IDiscreteValueDeviation readLatency |
| 2054 | @GenModel(documentation="<p><b>Write latency [cycles]</b></p>") |
| 2055 | contains IDiscreteValueDeviation writeLatency |
| 2056 | contains DataRate dataRate |
| 2057 | } |
| 2058 | |
| 2059 | enum StructureType |
| 2060 | { |
| 2061 | _undefined_ |
| 2062 | System |
| 2063 | ECU |
| 2064 | Microcontroller |
| 2065 | SoC |
| 2066 | Cluster |
| 2067 | Group |
| 2068 | Array |
| 2069 | Area |
| 2070 | Region |
| 2071 | } |
| 2072 | |
| 2073 | enum CacheType |
| 2074 | { |
| 2075 | _undefined_ |
| 2076 | instruction |
| 2077 | data |
| 2078 | unified |
| 2079 | } |
| 2080 | |
| 2081 | enum PortType |
| 2082 | { |
| 2083 | _undefined_ |
| 2084 | initiator // master |
| 2085 | responder // slave |
| 2086 | } |
| 2087 | |
| 2088 | enum SchedPolicy |
| 2089 | { |
| 2090 | _undefined_ |
| 2091 | RoundRobin |
| 2092 | FCFS |
| 2093 | PriorityBased |
| 2094 | } |
| 2095 | |
| 2096 | enum WriteStrategy |
| 2097 | { |
| 2098 | _undefined_ |
| 2099 | none |
| 2100 | writeback |
| 2101 | writethrough |
| 2102 | } |
| 2103 | |
| 2104 | abstract class HwDefinition extends ReferableBaseObject, ITaggable {} |
| 2105 | |
| 2106 | class ProcessingUnitDefinition extends HwDefinition |
| 2107 | { |
| 2108 | PuType puType |
| 2109 | refers HwFeature[] features |
| 2110 | refers CoreClassifier[] classifiers // backward compatibility |
| 2111 | } |
| 2112 | |
| 2113 | class ConnectionHandlerDefinition extends HwDefinition |
| 2114 | { |
| 2115 | SchedPolicy policy |
| 2116 | @GenModel(documentation="<p><b>Read latency [cycles]</b></p>") |
| 2117 | contains IDiscreteValueDeviation readLatency |
| 2118 | @GenModel(documentation="<p><b>Write latency [cycles]</b></p>") |
| 2119 | contains IDiscreteValueDeviation writeLatency |
| 2120 | contains DataRate dataRate |
| 2121 | PositiveInt maxBurstSize = "1" |
| 2122 | PositiveInt maxConcurrentTransfers = "1" |
| 2123 | } |
| 2124 | |
| 2125 | class MemoryDefinition extends HwDefinition |
| 2126 | { |
| 2127 | contains DataSize size |
| 2128 | @GenModel(documentation="<p><b>Access latency [cycles]</b></p>") |
| 2129 | contains IDiscreteValueDeviation accessLatency |
| 2130 | contains DataRate dataRate |
| 2131 | MemoryType memoryType |
| 2132 | refers MemoryClassifier[] classifiers // backward compatibility |
| 2133 | } |
| 2134 | |
| 2135 | class CacheDefinition extends HwDefinition |
| 2136 | { |
| 2137 | contains DataSize size |
| 2138 | contains DataSize lineSize |
| 2139 | @GenModel(documentation="<p><b>Access latency [cycles]</b></p>") |
| 2140 | contains IDiscreteValueDeviation accessLatency |
| 2141 | CacheType cacheType |
| 2142 | WriteStrategy writeStrategy |
| 2143 | int nWays = "0" |
| 2144 | boolean coherency = "false" |
| 2145 | boolean exclusive = "false" |
| 2146 | double hitRate = "0.0" |
| 2147 | } |
| 2148 | |
| 2149 | abstract class HwPath |
| 2150 | { |
| 2151 | op HwAccessElement getContainingAccessElement() {} |
| 2152 | |
| 2153 | @GenModel(propertyCategory="Read only") |
| 2154 | refers derived readonly ProcessingUnit source get { |
| 2155 | return containingAccessElement.source |
| 2156 | } |
| 2157 | @GenModel(propertyCategory="Read only") |
| 2158 | refers derived readonly HwDestination destination get { |
| 2159 | return containingAccessElement.destination |
| 2160 | } |
| 2161 | } |
| 2162 | |
| 2163 | class HwAccessPath extends HwPath, INamed |
| 2164 | { |
| 2165 | @GenModel(propertyCategory="Read only") |
| 2166 | container readonly HwAccessElement containingAccessElement opposite accessPath |
| 2167 | |
| 2168 | refers HwPathElement[+] pathElements |
| 2169 | Address startAddress = "0" |
| 2170 | Address endAddress = "0" |
| 2171 | Address memOffset = "0" |
| 2172 | } |
| 2173 | |
| 2174 | interface HwPathElement extends IReferable |
| 2175 | { |
| 2176 | op HwPort[] getPorts() |
| 2177 | } |
| 2178 | |
| 2179 | interface HwDestination extends IReferable |
| 2180 | { |
| 2181 | op HwPort[] getPorts() |
| 2182 | } |
| 2183 | |
| 2184 | enum PuType |
| 2185 | { |
| 2186 | _undefined_ |
| 2187 | GPU |
| 2188 | CPU |
| 2189 | Accelerator |
| 2190 | } |
| 2191 | |
| 2192 | enum PortInterface |
| 2193 | { |
| 2194 | _undefined_ |
| 2195 | custom |
| 2196 | CAN |
| 2197 | Flexray |
| 2198 | LIN |
| 2199 | MOST |
| 2200 | Ethernet |
| 2201 | SPI // Serial Peripheral Interface |
| 2202 | I2C // Inter-Integrated Circuit |
| 2203 | AXI // Advanced eXtensible Interface |
| 2204 | AHB // Advanced High-performance Bus |
| 2205 | APB // Advanced Peripheral Bus |
| 2206 | SWR // Serial WireRing |
| 2207 | } |
| 2208 | |
| 2209 | enum HwFeatureType |
| 2210 | { |
| 2211 | _undefined_ |
| 2212 | performance |
| 2213 | power |
| 2214 | performance_and_power |
| 2215 | } |
| 2216 | |
| 2217 | |
| 2218 | // =============================================================================== |
| 2219 | // =============================================================================== |
| 2220 | // |
| 2221 | // Mapping Model |
| 2222 | // |
| 2223 | // =============================================================================== |
| 2224 | // =============================================================================== |
| 2225 | |
| 2226 | |
| 2227 | class MappingModel extends BaseObject |
| 2228 | { |
| 2229 | contains SchedulerAllocation[] schedulerAllocation |
| 2230 | contains RunnableAllocation[] runnableAllocation |
| 2231 | contains TaskAllocation[] taskAllocation |
| 2232 | contains ISRAllocation[] isrAllocation |
| 2233 | contains MemoryMapping[] memoryMapping |
| 2234 | contains PhysicalSectionMapping[] physicalSectionMapping |
| 2235 | MemoryAddressMappingType addressMappingType |
| 2236 | } |
| 2237 | |
| 2238 | /* |
| 2239 | * Defines how to interpret the memory addresses in this mapping model |
| 2240 | */ |
| 2241 | enum MemoryAddressMappingType |
| 2242 | { |
| 2243 | _undefined_ // Display: "<address type>" |
| 2244 | // no addresses required |
| 2245 | none |
| 2246 | // absolute memory address |
| 2247 | address |
| 2248 | // offset from first address of memory |
| 2249 | offset |
| 2250 | } |
| 2251 | |
| 2252 | //////////////// Generalizations for the Allocations (assignment to cores) |
| 2253 | /* |
| 2254 | * Allocation of Schedulers |
| 2255 | */ |
| 2256 | class SchedulerAllocation extends BaseObject |
| 2257 | { |
| 2258 | refers Scheduler[1] scheduler |
| 2259 | refers ProcessingUnit[+] responsibility |
| 2260 | refers ProcessingUnit executingPU |
| 2261 | } |
| 2262 | |
| 2263 | //////////////// Specializations of Allocations |
| 2264 | class TaskAllocation extends BaseObject |
| 2265 | { |
| 2266 | refers Task[1] task |
| 2267 | refers TaskScheduler[1] scheduler |
| 2268 | refers ProcessingUnit[] affinity |
| 2269 | contains SchedulingParameters schedulingParameters |
| 2270 | contains ParameterExtension[] parameterExtensions |
| 2271 | } |
| 2272 | |
| 2273 | class ISRAllocation extends BaseObject |
| 2274 | { |
| 2275 | refers ISR[1] isr |
| 2276 | refers InterruptController[1] controller |
| 2277 | Integer priority |
| 2278 | } |
| 2279 | |
| 2280 | class RunnableAllocation extends BaseObject |
| 2281 | { |
| 2282 | refers Scheduler[1] scheduler |
| 2283 | refers Runnable[1] entity |
| 2284 | } |
| 2285 | |
| 2286 | //////////////// Specializations of Mappings |
| 2287 | /* |
| 2288 | * Mapping of AbstractMemoryElement (Label, Runnable, ISR, Task, ...) |
| 2289 | * to a specific memory. |
| 2290 | */ |
| 2291 | class MemoryMapping extends BaseObject |
| 2292 | { |
| 2293 | refers AbstractMemoryElement[1] abstractElement |
| 2294 | refers Memory memory |
| 2295 | /* |
| 2296 | * The position of the element in the mapped memory |
| 2297 | */ |
| 2298 | Address memoryPositionAddress = "0" |
| 2299 | } |
| 2300 | |
| 2301 | class PhysicalSectionMapping extends ReferableBaseObject |
| 2302 | { |
| 2303 | @GenModel(propertyCategory="Main") |
| 2304 | refers Section[+] origin |
| 2305 | @GenModel(propertyCategory="Memory") |
| 2306 | refers Memory[1] memory |
| 2307 | @GenModel(propertyCategory="Memory") |
| 2308 | Address startAddress = "0" |
| 2309 | @GenModel(propertyCategory="Memory") |
| 2310 | Address endAddress = "0" |
| 2311 | refers Label[] labels |
| 2312 | refers Runnable[] runEntities |
| 2313 | } |
| 2314 | |
| 2315 | |
| 2316 | // =============================================================================== |
| 2317 | // =============================================================================== |
| 2318 | // |
| 2319 | // OS Model |
| 2320 | // |
| 2321 | // =============================================================================== |
| 2322 | // =============================================================================== |
| 2323 | |
| 2324 | |
| 2325 | class OSModel extends BaseObject |
| 2326 | { |
| 2327 | contains Semaphore[] semaphores |
| 2328 | contains OperatingSystem[] operatingSystems |
| 2329 | contains OsOverhead[] osOverheads |
| 2330 | } |
| 2331 | |
| 2332 | class OsDataConsistency extends BaseObject |
| 2333 | { |
| 2334 | OsDataConsistencyMode mode |
| 2335 | contains DataStability dataStability |
| 2336 | contains NonAtomicDataCoherency nonAtomicDataCoherency |
| 2337 | } |
| 2338 | |
| 2339 | class DataStability |
| 2340 | { |
| 2341 | boolean enabled = "false" |
| 2342 | String algorithm |
| 2343 | AccessMultiplicity accessMultiplicity |
| 2344 | DataStabilityLevel level |
| 2345 | } |
| 2346 | |
| 2347 | class NonAtomicDataCoherency |
| 2348 | { |
| 2349 | boolean enabled = "false" |
| 2350 | String algorithm |
| 2351 | AccessMultiplicity accessMultiplicity |
| 2352 | } |
| 2353 | |
| 2354 | enum OsDataConsistencyMode |
| 2355 | { |
| 2356 | _undefined_ // Display: "<data consistency mode>" |
| 2357 | noProtection |
| 2358 | automaticProtection |
| 2359 | customProtection |
| 2360 | handledByModelElements |
| 2361 | } |
| 2362 | |
| 2363 | enum AccessMultiplicity |
| 2364 | { |
| 2365 | _undefined_ // Display: "<access multiplicity>" |
| 2366 | singleAccess |
| 2367 | multipleAccesses |
| 2368 | } |
| 2369 | |
| 2370 | enum DataStabilityLevel |
| 2371 | { |
| 2372 | _undefined_ // Display: "<data stability level>" |
| 2373 | period // between consecutive occurrences |
| 2374 | process // within a Task or ISR |
| 2375 | scheduleSection // between Schedule points (explicit schedule points, begin and end of process) |
| 2376 | runnable // within a Runnable |
| 2377 | } |
| 2378 | |
| 2379 | /* |
| 2380 | * name: Name of semaphore |
| 2381 | * maxValue: maximum number of users which can access the semaphore simultaneously |
| 2382 | * initialValue: number of users which access semaphore at system startup |
| 2383 | * priorityCeilingProtocol: enables priority ceiling for this resource |
| 2384 | |
| 2385 | */ |
| 2386 | class Semaphore extends ReferableBaseObject |
| 2387 | { |
| 2388 | SemaphoreType semaphoreType |
| 2389 | int initialValue = "0" |
| 2390 | int maxValue = "0" |
| 2391 | boolean priorityCeilingProtocol = "false" |
| 2392 | |
| 2393 | // back pointer (readonly) |
| 2394 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of accesses (SemaphoreAccess).</b></p>") |
| 2395 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 2396 | refers transient readonly volatile derived SemaphoreAccess[] semaphoreAccesses get { |
| 2397 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.semaphore_SemaphoreAccesses, |
| 2398 | #{AmaltheaPackage.eINSTANCE.semaphoreAccess_Semaphore} ) |
| 2399 | } |
| 2400 | // back pointer (readonly) |
| 2401 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of components the semaphore belongs to.</b></p>") |
| 2402 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 2403 | refers transient readonly volatile derived Component[] referringComponents get { |
| 2404 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.semaphore_ReferringComponents, |
| 2405 | #{AmaltheaPackage.eINSTANCE.component_Semaphores} ) |
| 2406 | } |
| 2407 | } |
| 2408 | |
| 2409 | enum SemaphoreType |
| 2410 | { |
| 2411 | _undefined_ // Display: "<semaphore type>" |
| 2412 | CountingSemaphore |
| 2413 | Resource |
| 2414 | Spinlock |
| 2415 | } |
| 2416 | |
| 2417 | /* |
| 2418 | * scheduling algorithm: The used algorithm for scheduling |
| 2419 | * computation items: steps to perform the scheduling algorithm |
| 2420 | */ |
| 2421 | abstract class Scheduler extends ReferableBaseObject |
| 2422 | { |
| 2423 | contains ComputationItem[] computationItems |
| 2424 | op Algorithm getSchedulingAlgorithm() {} |
| 2425 | |
| 2426 | // back pointer (readonly) |
| 2427 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of scheduler allocations (SchedulerAllocation).</b></p>") |
| 2428 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 2429 | refers transient readonly volatile derived SchedulerAllocation[] schedulerAllocations get { |
| 2430 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.scheduler_SchedulerAllocations, |
| 2431 | #{AmaltheaPackage.eINSTANCE.schedulerAllocation_Scheduler} ) |
| 2432 | } |
| 2433 | |
| 2434 | // back pointer (readonly) |
| 2435 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of runnable allocations (RunnableAllocation).</b></p>") |
| 2436 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 2437 | refers transient readonly volatile derived RunnableAllocation[] runnableAllocations get { |
| 2438 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.scheduler_RunnableAllocations, |
| 2439 | #{AmaltheaPackage.eINSTANCE.runnableAllocation_Scheduler} ) |
| 2440 | } |
| 2441 | } |
| 2442 | |
| 2443 | class TaskScheduler extends Scheduler |
| 2444 | { |
| 2445 | contains TaskSchedulingAlgorithm schedulingAlgorithm |
| 2446 | contains SchedulerAssociation parentAssociation opposite child |
| 2447 | |
| 2448 | // back pointer (readonly) |
| 2449 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of child associations (SchedulerAssociation).</b></p>") |
| 2450 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 2451 | refers transient readonly volatile derived SchedulerAssociation[] childAssociations get { |
| 2452 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.taskScheduler_ChildAssociations, |
| 2453 | #{AmaltheaPackage.eINSTANCE.schedulerAssociation_Parent} ) |
| 2454 | } |
| 2455 | |
| 2456 | // back pointer (readonly) |
| 2457 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of task allocations (TaskAllocation).</b></p>") |
| 2458 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 2459 | refers transient readonly volatile derived TaskAllocation[] taskAllocations get { |
| 2460 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.taskScheduler_TaskAllocations, |
| 2461 | #{AmaltheaPackage.eINSTANCE.taskAllocation_Scheduler} ) |
| 2462 | } |
| 2463 | |
| 2464 | @GenModel(propertyCategory="Read only") |
| 2465 | refers derived readonly TaskScheduler parentScheduler get { |
| 2466 | return parentAssociation?.parent |
| 2467 | } |
| 2468 | |
| 2469 | @GenModel(propertyCategory="Read only") |
| 2470 | refers derived readonly TaskScheduler[] childSchedulers get { |
| 2471 | val result = childAssociations.map[child].filterNull |
| 2472 | return new UnmodifiableEList(this as InternalEObject, AmaltheaPackage.eINSTANCE.taskScheduler_ChildSchedulers, |
| 2473 | result.size, result.toList.toArray) |
| 2474 | } |
| 2475 | } |
| 2476 | |
| 2477 | class SchedulerAssociation |
| 2478 | { |
| 2479 | // container (read only) |
| 2480 | @GenModel(propertyCategory="Read only") |
| 2481 | container readonly TaskScheduler child opposite parentAssociation |
| 2482 | |
| 2483 | refers TaskScheduler parent |
| 2484 | contains SchedulingParameters schedulingParameters |
| 2485 | contains ParameterExtension[] parameterExtensions |
| 2486 | } |
| 2487 | |
| 2488 | class InterruptController extends Scheduler |
| 2489 | { |
| 2490 | contains InterruptSchedulingAlgorithm schedulingAlgorithm |
| 2491 | |
| 2492 | // back pointer (readonly) |
| 2493 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of ISR allocations (ISRAllocation).</b></p>") |
| 2494 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 2495 | refers transient readonly volatile derived ISRAllocation[] isrAllocations get { |
| 2496 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.interruptController_IsrAllocations, |
| 2497 | #{AmaltheaPackage.eINSTANCE.ISRAllocation_Controller} ) |
| 2498 | } |
| 2499 | } |
| 2500 | |
| 2501 | /* |
| 2502 | * Common scheduling parameters |
| 2503 | */ |
| 2504 | class SchedulingParameters |
| 2505 | { |
| 2506 | Integer priority |
| 2507 | contains Time minBudget |
| 2508 | contains Time maxBudget |
| 2509 | contains Time replenishment |
| 2510 | } |
| 2511 | |
| 2512 | /* |
| 2513 | * Parameter extensions (used for scheduling algorithms) |
| 2514 | */ |
| 2515 | class ParameterExtension wraps java.util.Map$Entry |
| 2516 | { |
| 2517 | String[1] key |
| 2518 | String[1] value |
| 2519 | } |
| 2520 | |
| 2521 | abstract class Algorithm extends BaseObject {} |
| 2522 | |
| 2523 | /* |
| 2524 | * Interrupt Scheduling Algorithm |
| 2525 | */ |
| 2526 | abstract class InterruptSchedulingAlgorithm extends Algorithm {} |
| 2527 | |
| 2528 | /* |
| 2529 | * Task Scheduling Algorithm |
| 2530 | */ |
| 2531 | abstract class TaskSchedulingAlgorithm extends Algorithm {} |
| 2532 | |
| 2533 | /* |
| 2534 | * Fixed Priority Scheduling |
| 2535 | */ |
| 2536 | abstract class FixedPriority extends TaskSchedulingAlgorithm {} |
| 2537 | |
| 2538 | /* |
| 2539 | * Fixed Priority Preemptive scheduling algorithm |
| 2540 | */ |
| 2541 | class FixedPriorityPreemptive extends FixedPriority {} |
| 2542 | |
| 2543 | /* |
| 2544 | * Fixed Priority Preemptive scheduling algorithm (with budget enforcement) |
| 2545 | */ |
| 2546 | class FixedPriorityPreemptiveWithBudgetEnforcement extends FixedPriority {} |
| 2547 | |
| 2548 | /* |
| 2549 | * OSEK scheduling algorithm |
| 2550 | */ |
| 2551 | class OSEK extends FixedPriority {} |
| 2552 | |
| 2553 | /* |
| 2554 | * task with shortest deadline has highest priority |
| 2555 | */ |
| 2556 | class DeadlineMonotonic extends FixedPriority {} |
| 2557 | |
| 2558 | /* |
| 2559 | * task with shortest recurrence (i.e. period) has highest priority |
| 2560 | */ |
| 2561 | class RateMonotonic extends FixedPriority {} |
| 2562 | |
| 2563 | /* |
| 2564 | * Proportionate Fair (Pfair) Scheduling |
| 2565 | * (global scheduling algorithm) |
| 2566 | */ |
| 2567 | abstract class Pfair extends TaskSchedulingAlgorithm |
| 2568 | { |
| 2569 | int quantSizeNs = "0" |
| 2570 | } |
| 2571 | |
| 2572 | /* |
| 2573 | * Proportionate Fair PD2 Scheduling |
| 2574 | * (global scheduling algorithm) |
| 2575 | */ |
| 2576 | class PfairPD2 extends Pfair {} |
| 2577 | |
| 2578 | /* |
| 2579 | * Partly Proportionate Fair PD2 Scheduling |
| 2580 | * (global scheduling algorithm) |
| 2581 | */ |
| 2582 | class PartlyPFairPD2 extends Pfair {} |
| 2583 | |
| 2584 | /* |
| 2585 | * Early Release Fair PD2 Scheduling |
| 2586 | * (global scheduling algorithm) |
| 2587 | */ |
| 2588 | class EarlyReleaseFairPD2 extends Pfair {} |
| 2589 | |
| 2590 | /* |
| 2591 | * Partly Early Release Fair PD2 Scheduling |
| 2592 | * (global scheduling algorithm) |
| 2593 | */ |
| 2594 | class PartlyEarlyReleaseFairPD2 extends Pfair {} |
| 2595 | |
| 2596 | /* |
| 2597 | * Dynamic Priority Scheduling |
| 2598 | */ |
| 2599 | abstract class DynamicPriority extends TaskSchedulingAlgorithm {} |
| 2600 | |
| 2601 | /* |
| 2602 | * global scheduling algorithm |
| 2603 | */ |
| 2604 | class LeastLocalRemainingExecutionTimeFirst extends DynamicPriority {} |
| 2605 | |
| 2606 | /* |
| 2607 | * earliest absolute deadline first |
| 2608 | */ |
| 2609 | class EarliestDeadlineFirst extends DynamicPriority {} |
| 2610 | |
| 2611 | /* |
| 2612 | * all tasks with equal priority executed for certain time slice |
| 2613 | */ |
| 2614 | class PriorityBasedRoundRobin extends DynamicPriority {} |
| 2615 | |
| 2616 | /* |
| 2617 | * Reservation Based Server |
| 2618 | */ |
| 2619 | abstract class ReservationBasedServer extends TaskSchedulingAlgorithm {} |
| 2620 | |
| 2621 | /* |
| 2622 | * Deferrable Server |
| 2623 | */ |
| 2624 | class DeferrableServer extends ReservationBasedServer {} |
| 2625 | |
| 2626 | /* |
| 2627 | * Polling Periodic Server |
| 2628 | */ |
| 2629 | class PollingPeriodicServer extends ReservationBasedServer {} |
| 2630 | |
| 2631 | /* |
| 2632 | * Sporadic Server |
| 2633 | */ |
| 2634 | class SporadicServer extends ReservationBasedServer {} |
| 2635 | |
| 2636 | /* |
| 2637 | * Constant Bandwidth Server |
| 2638 | */ |
| 2639 | class ConstantBandwidthServer extends ReservationBasedServer {} |
| 2640 | |
| 2641 | /* |
| 2642 | * Constant Bandwidth Server With CASH |
| 2643 | */ |
| 2644 | class ConstantBandwidthServerWithCASH extends ReservationBasedServer {} |
| 2645 | |
| 2646 | /* |
| 2647 | * logical grouping of tasks/child-schedulers |
| 2648 | */ |
| 2649 | class Grouping extends TaskSchedulingAlgorithm {} |
| 2650 | |
| 2651 | /* |
| 2652 | * allows the user to define own scheduling algorithm (TA-Toolsuite feature) |
| 2653 | */ |
| 2654 | class UserSpecificSchedulingAlgorithm extends TaskSchedulingAlgorithm, InterruptSchedulingAlgorithm |
| 2655 | { |
| 2656 | contains ParameterExtension[] parameterExtensions |
| 2657 | } |
| 2658 | |
| 2659 | /* |
| 2660 | * Priority based Scheduling Algorithm for Interrupts |
| 2661 | */ |
| 2662 | class PriorityBased extends InterruptSchedulingAlgorithm {} |
| 2663 | |
| 2664 | class OperatingSystem extends BaseObject, INamed |
| 2665 | { |
| 2666 | refers OsOverhead overhead |
| 2667 | contains TaskScheduler[] taskSchedulers |
| 2668 | contains InterruptController[] interruptControllers |
| 2669 | contains OsDataConsistency osDataConsistency |
| 2670 | } |
| 2671 | |
| 2672 | class VendorOperatingSystem extends OperatingSystem |
| 2673 | { |
| 2674 | String osName |
| 2675 | String vendor |
| 2676 | String version |
| 2677 | } |
| 2678 | |
| 2679 | class OsOverhead extends ReferableBaseObject |
| 2680 | { |
| 2681 | contains OsAPIOverhead apiOverhead |
| 2682 | contains OsISROverhead isrCategory1Overhead |
| 2683 | contains OsISROverhead isrCategory2Overhead |
| 2684 | } |
| 2685 | |
| 2686 | class OsAPIOverhead extends BaseObject |
| 2687 | { |
| 2688 | contains Ticks apiSendMessage |
| 2689 | contains Ticks apiTerminateTask |
| 2690 | contains Ticks apiSchedule |
| 2691 | contains Ticks apiRequestResource |
| 2692 | contains Ticks apiReleaseResource |
| 2693 | contains Ticks apiSetEvent |
| 2694 | contains Ticks apiWaitEvent |
| 2695 | contains Ticks apiClearEvent |
| 2696 | contains Ticks apiActivateTask |
| 2697 | contains Ticks apiEnforcedMigration |
| 2698 | contains Ticks apiSuspendOsInterrupts |
| 2699 | contains Ticks apiResumeOsInterrupts |
| 2700 | contains Ticks apiRequestSpinlock |
| 2701 | contains Ticks apiReleaseSpinlock |
| 2702 | contains Ticks apiSenderReceiverRead |
| 2703 | contains Ticks apiSenderReceiverWrite |
| 2704 | contains Ticks apiSynchronousServerCallPoint |
| 2705 | contains Ticks apiIocRead |
| 2706 | contains Ticks apiIocWrite |
| 2707 | } |
| 2708 | |
| 2709 | class OsISROverhead extends BaseObject |
| 2710 | { |
| 2711 | contains Ticks preExecutionOverhead |
| 2712 | contains Ticks postExecutionOverhead |
| 2713 | } |
| 2714 | |
| 2715 | |
| 2716 | // =============================================================================== |
| 2717 | // =============================================================================== |
| 2718 | // |
| 2719 | // Property Constraints Model |
| 2720 | // |
| 2721 | // =============================================================================== |
| 2722 | // =============================================================================== |
| 2723 | |
| 2724 | |
| 2725 | class PropertyConstraintsModel extends BaseObject |
| 2726 | { |
| 2727 | contains CoreAllocationConstraint[] allocationConstraints |
| 2728 | contains MemoryMappingConstraint[] mappingConstraints |
| 2729 | } |
| 2730 | |
| 2731 | /* |
| 2732 | * Abstract Class, used to describe Constraints for Allocations |
| 2733 | * (these usually target Cores and their features/attributes) |
| 2734 | */ |
| 2735 | abstract class CoreAllocationConstraint extends BaseObject |
| 2736 | { |
| 2737 | contains CoreClassification coreClassification |
| 2738 | } |
| 2739 | |
| 2740 | /* |
| 2741 | * Abstract Class, used to describe Constraints for Mapping |
| 2742 | * (these usually target Memories and their features/attributes) |
| 2743 | */ |
| 2744 | abstract class MemoryMappingConstraint extends BaseObject |
| 2745 | { |
| 2746 | contains MemoryClassification memoryClassification |
| 2747 | } |
| 2748 | |
| 2749 | /* |
| 2750 | * ProcessAllocationConstraints describe the constraints for |
| 2751 | * Process-to-Core allocations |
| 2752 | */ |
| 2753 | class ProcessAllocationConstraint extends CoreAllocationConstraint |
| 2754 | { |
| 2755 | refers Process process |
| 2756 | } |
| 2757 | |
| 2758 | /* |
| 2759 | * ProcessPrototypeAllocationConstraints describe the constraints for |
| 2760 | * ProcessPrototype-to-Core allocations |
| 2761 | */ |
| 2762 | class ProcessPrototypeAllocationConstraint extends CoreAllocationConstraint |
| 2763 | { |
| 2764 | refers ProcessPrototype processPrototype |
| 2765 | } |
| 2766 | |
| 2767 | /* |
| 2768 | * RunnableAllocationConstraints describe the constraints for |
| 2769 | * Runnable-to-Core allocations |
| 2770 | */ |
| 2771 | class RunnableAllocationConstraint extends CoreAllocationConstraint |
| 2772 | { |
| 2773 | refers Runnable runnable |
| 2774 | } |
| 2775 | |
| 2776 | /* |
| 2777 | * AbstractElementMappingConstraints describe the constraints for |
| 2778 | * AbstractMemoryElement-to-Memory Mapping |
| 2779 | */ |
| 2780 | class AbstractElementMappingConstraint extends MemoryMappingConstraint |
| 2781 | { |
| 2782 | refers AbstractMemoryElement abstractElement |
| 2783 | } |
| 2784 | |
| 2785 | /* |
| 2786 | * Generalization for all Hardware related constraints |
| 2787 | */ |
| 2788 | abstract class Classification extends BaseObject |
| 2789 | { |
| 2790 | Condition condition |
| 2791 | GroupingType grouping |
| 2792 | } |
| 2793 | |
| 2794 | enum Condition |
| 2795 | { |
| 2796 | _undefined_ // Display: "<condition>" |
| 2797 | requires |
| 2798 | excludes |
| 2799 | } |
| 2800 | |
| 2801 | enum GroupingType{ |
| 2802 | _undefined_ // Display: "<grouping>" |
| 2803 | allOfThem |
| 2804 | atLeastOneOfThem |
| 2805 | } |
| 2806 | |
| 2807 | class CoreClassification extends Classification |
| 2808 | { |
| 2809 | refers CoreClassifier[] classifiers |
| 2810 | } |
| 2811 | |
| 2812 | class MemoryClassification extends Classification |
| 2813 | { |
| 2814 | refers MemoryClassifier[] classifiers |
| 2815 | } |
| 2816 | |
| 2817 | |
| 2818 | |
| 2819 | // =============================================================================== |
| 2820 | // =============================================================================== |
| 2821 | // |
| 2822 | // Stimuli Model |
| 2823 | // |
| 2824 | // =============================================================================== |
| 2825 | // =============================================================================== |
| 2826 | |
| 2827 | |
| 2828 | class StimuliModel extends BaseObject |
| 2829 | { |
| 2830 | contains Stimulus[] stimuli |
| 2831 | contains Clock[] clocks |
| 2832 | } |
| 2833 | |
| 2834 | /* |
| 2835 | * Every process/task can have one or more stimuli. |
| 2836 | * A stimulus activates the process |
| 2837 | */ |
| 2838 | abstract class Stimulus extends ReferableBaseObject, ITaggable |
| 2839 | { |
| 2840 | contains ModeValueList setModeValueList |
| 2841 | contains ModeConditionDisjunction executionCondition |
| 2842 | |
| 2843 | // back pointer (readonly) |
| 2844 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of affected processes (Process).</b></p>") |
| 2845 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 2846 | refers transient readonly volatile derived Process[] affectedProcesses get { |
| 2847 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.stimulus_AffectedProcesses, |
| 2848 | #{AmaltheaPackage.eINSTANCE.process_Stimuli} ) |
| 2849 | } |
| 2850 | } |
| 2851 | |
| 2852 | class ModeValueList extends BaseObject |
| 2853 | { |
| 2854 | contains ModeAssignment[] entries |
| 2855 | } |
| 2856 | |
| 2857 | class ModeValueMapEntry wraps java.util.Map$Entry |
| 2858 | { |
| 2859 | refers ModeLabel[1] key |
| 2860 | String[1] value |
| 2861 | } |
| 2862 | |
| 2863 | abstract class ModeValue extends BaseObject { |
| 2864 | refers ModeLabel[1] label |
| 2865 | String[1] value |
| 2866 | |
| 2867 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 2868 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 2869 | } |
| 2870 | |
| 2871 | op ModeLiteral getLiteral() { |
| 2872 | if (value === null) return null |
| 2873 | val mode = label?.mode |
| 2874 | if (mode instanceof EnumMode) {mode.literals.findFirst[name == value]} else {null} |
| 2875 | } |
| 2876 | |
| 2877 | op Integer getInteger() { |
| 2878 | if (value === null) return null |
| 2879 | val mode = label?.mode |
| 2880 | if (mode instanceof NumericMode && value.matches("-?\\d+")) {Integer.parseInt(value)} else {null} |
| 2881 | } |
| 2882 | } |
| 2883 | |
| 2884 | class ModeAssignment extends ModeValue { |
| 2885 | } |
| 2886 | |
| 2887 | class ModeConditionDisjunction extends BaseObject |
| 2888 | { |
| 2889 | contains ModeConditionDisjunctionEntry[+] entries |
| 2890 | |
| 2891 | op boolean isSatisfiedBy(ModeValueMapEntry[] context) { |
| 2892 | for (ModeConditionDisjunctionEntry entry : entries) { |
| 2893 | if (entry.isSatisfiedBy(context)) return true; |
| 2894 | } |
| 2895 | return false; |
| 2896 | } |
| 2897 | } |
| 2898 | |
| 2899 | interface ModeConditionDisjunctionEntry extends BaseObject |
| 2900 | { |
| 2901 | op boolean isSatisfiedBy(ModeValueMapEntry[] assignment) |
| 2902 | } |
| 2903 | |
| 2904 | class ModeCondition extends ModeValue, ModeConditionDisjunctionEntry { |
| 2905 | RelationalOperator relation |
| 2906 | |
| 2907 | op boolean isSatisfiedBy(ModeValueMapEntry[] context) { |
| 2908 | // no value defined => satisfied (don't care) |
| 2909 | val labelValue = context?.get(label) |
| 2910 | return (labelValue === null) || (labelValue == value) |
| 2911 | } |
| 2912 | } |
| 2913 | |
| 2914 | class ModeConditionConjunction extends ModeConditionDisjunctionEntry |
| 2915 | { |
| 2916 | contains ModeCondition[+] entries |
| 2917 | |
| 2918 | op boolean isSatisfiedBy(ModeValueMapEntry[] context) { |
| 2919 | for (ModeCondition entry : entries) { |
| 2920 | if (! entry.isSatisfiedBy(context)) return false; |
| 2921 | } |
| 2922 | return true; |
| 2923 | } |
| 2924 | } |
| 2925 | |
| 2926 | /* |
| 2927 | * Stimulus that is triggered periodically. |
| 2928 | * offset: Time of first occurrence |
| 2929 | * recurrence: Time between following occurrences |
| 2930 | */ |
| 2931 | interface FixedPeriodic |
| 2932 | { |
| 2933 | contains Time offset |
| 2934 | contains Time recurrence |
| 2935 | } |
| 2936 | |
| 2937 | /* |
| 2938 | * Stimulus that is triggered periodically. |
| 2939 | * jitter: Deviation from true periodicity to real occurrence |
| 2940 | * minDistance: Minimal time between occurrences |
| 2941 | */ |
| 2942 | class PeriodicStimulus extends Stimulus, FixedPeriodic |
| 2943 | { |
| 2944 | contains ITimeDeviation jitter |
| 2945 | contains Time minDistance |
| 2946 | } |
| 2947 | |
| 2948 | /* |
| 2949 | * Stimulus that is triggered relative to the previous occurrence. |
| 2950 | * offset: Time of first occurrence |
| 2951 | * step: Time (Deviation) between successive occurrences |
| 2952 | */ |
| 2953 | class RelativePeriodicStimulus extends Stimulus |
| 2954 | { |
| 2955 | contains Time offset |
| 2956 | contains ITimeDeviation nextOccurrence |
| 2957 | } |
| 2958 | |
| 2959 | /* |
| 2960 | * Periodic stimulus based on other events, like rotation speed |
| 2961 | * clock: Time base which defines deviation of time, multiple stimuli can have the same time base |
| 2962 | */ |
| 2963 | class VariableRateStimulus extends Stimulus |
| 2964 | { |
| 2965 | contains Time[1] step |
| 2966 | contains IContinuousValueDeviation occurrencesPerStep |
| 2967 | Double maxIncreasePerStep // initial value is null |
| 2968 | Double maxDecreasePerStep // initial value is null |
| 2969 | contains Scenario scenario |
| 2970 | } |
| 2971 | |
| 2972 | class Scenario extends BaseObject |
| 2973 | { |
Harald Mackamul | af04ede | 2019-07-30 12:42:41 +0200 | [diff] [blame^] | 2974 | contains Counter counter |
| 2975 | refers Clock[1] clock |
Harald Mackamul | aa64db0 | 2019-07-26 14:03:01 +0200 | [diff] [blame] | 2976 | } |
| 2977 | |
| 2978 | /* |
| 2979 | * Stimulus (repeated periodically) with a defined list of occurrences. |
| 2980 | * occurrenceTimes: List of all occurrences |
| 2981 | */ |
| 2982 | class PeriodicSyntheticStimulus extends Stimulus, FixedPeriodic |
| 2983 | { |
| 2984 | contains Time[+] occurrenceTimes |
| 2985 | } |
| 2986 | |
| 2987 | /* |
| 2988 | * Stimulus to describe own custom types, including properties. |
| 2989 | */ |
| 2990 | class CustomStimulus extends Stimulus |
| 2991 | { |
| 2992 | String description |
| 2993 | } |
| 2994 | |
| 2995 | /* |
| 2996 | * Single occurrence at a defined time. |
| 2997 | */ |
| 2998 | class SingleStimulus extends Stimulus |
| 2999 | { |
| 3000 | contains Time[1] occurrence |
| 3001 | } |
| 3002 | |
| 3003 | /* |
| 3004 | * Stimulus based on a explicit inter process trigger. |
| 3005 | */ |
| 3006 | class InterProcessStimulus extends Stimulus |
| 3007 | { |
| 3008 | contains Counter counter |
| 3009 | |
| 3010 | // back pointer (readonly) |
| 3011 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of triggers (InterProcessTrigger).</b></p>") |
| 3012 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3013 | refers transient readonly volatile derived InterProcessTrigger[] explicitTriggers get { |
| 3014 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.interProcessStimulus_ExplicitTriggers, |
| 3015 | #{AmaltheaPackage.eINSTANCE.interProcessTrigger_Stimulus} ) |
| 3016 | } |
| 3017 | } |
| 3018 | |
| 3019 | /* |
| 3020 | * Stimulus (repeated periodically) for burst occurrences |
| 3021 | * burstLength: Time frame for the burst (occurrences after the length are clipped) |
| 3022 | */ |
| 3023 | class PeriodicBurstStimulus extends Stimulus, FixedPeriodic |
| 3024 | { |
| 3025 | contains Time[1] burstLength |
| 3026 | contains Time occurrenceMinDistance |
| 3027 | int occurrenceCount = "0" |
| 3028 | } |
| 3029 | |
| 3030 | /* |
| 3031 | * Stimulus which is activated by an event. |
| 3032 | */ |
| 3033 | class EventStimulus extends Stimulus |
| 3034 | { |
| 3035 | refers TriggerEvent[+] triggeringEvents |
| 3036 | contains Counter counter |
| 3037 | } |
| 3038 | |
| 3039 | /* |
| 3040 | * Arrival Curve Stimulus |
| 3041 | */ |
| 3042 | class ArrivalCurveStimulus extends Stimulus |
| 3043 | { |
| 3044 | contains ArrivalCurveEntry[+] entries |
| 3045 | } |
| 3046 | |
| 3047 | class ArrivalCurveEntry extends BaseObject |
| 3048 | { |
| 3049 | int numberOfOccurrences = "0" |
| 3050 | contains Time lowerTimeBorder |
| 3051 | contains Time upperTimeBorder |
| 3052 | } |
| 3053 | |
| 3054 | /* |
| 3055 | * Within a Scenario a Clock defines the predefined curve progression in a simulation |
| 3056 | */ |
| 3057 | abstract class Clock extends ReferableBaseObject {} |
| 3058 | |
| 3059 | class ClockFunction extends Clock |
| 3060 | { |
| 3061 | CurveType curveType |
| 3062 | contains Time[1] period |
| 3063 | contains Frequency[1] peakToPeak // amplitude |
| 3064 | contains Time xOffset |
| 3065 | contains Frequency yOffset |
| 3066 | } |
| 3067 | |
| 3068 | |
| 3069 | enum CurveType |
| 3070 | { |
| 3071 | _undefined_ // Display: "<curve type>" |
| 3072 | sine |
| 3073 | triangle |
| 3074 | } |
| 3075 | |
| 3076 | class ClockStepList extends Clock |
| 3077 | { |
| 3078 | contains ClockStep[+] entries |
| 3079 | contains Time period |
| 3080 | } |
| 3081 | |
| 3082 | class ClockStep extends BaseObject |
| 3083 | { |
| 3084 | contains Frequency[1] frequency |
| 3085 | contains Time[1] time |
| 3086 | } |
| 3087 | |
| 3088 | |
| 3089 | // =============================================================================== |
| 3090 | // =============================================================================== |
| 3091 | // |
| 3092 | // SW Model |
| 3093 | // |
| 3094 | // =============================================================================== |
| 3095 | // =============================================================================== |
| 3096 | |
| 3097 | |
| 3098 | /* |
| 3099 | * Central instance to provide central access. |
| 3100 | */ |
| 3101 | class SWModel extends BaseObject |
| 3102 | { |
| 3103 | contains ISR[] isrs |
| 3104 | contains Task[] tasks |
| 3105 | contains Runnable[] runnables |
| 3106 | contains Label[] labels |
| 3107 | contains Channel[] channels |
| 3108 | contains ProcessPrototype[] processPrototypes |
| 3109 | contains Section[] sections |
| 3110 | contains Activation[] activations |
| 3111 | contains OsEvent[] events |
| 3112 | contains TypeDefinition[] typeDefinitions |
| 3113 | contains CustomEntity[] customEntities |
| 3114 | contains ProcessChain[] processChains |
| 3115 | contains Mode[] modes |
| 3116 | contains ModeLabel[] modeLabels |
| 3117 | op ModeLiteral modeLiteral(String mode, String literal) { |
| 3118 | if (mode.isNullOrEmpty || literal.isNullOrEmpty) return null |
| 3119 | return (modes?.findFirst[it instanceof EnumMode && it.name == mode] as EnumMode)?.literals?.findFirst[it.name == literal] |
| 3120 | } |
| 3121 | } |
| 3122 | |
| 3123 | abstract class AbstractMemoryElement extends ReferableBaseObject, ITaggable |
| 3124 | { |
| 3125 | /* |
| 3126 | * Specifying the size of the element corresponding to the needed memory allocation |
| 3127 | */ |
| 3128 | contains DataSize size |
| 3129 | |
| 3130 | // back pointer (readonly) |
| 3131 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of mappings (MemoryMapping).</b></p>") |
| 3132 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3133 | refers transient readonly volatile derived MemoryMapping[] mappings get { |
| 3134 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.abstractMemoryElement_Mappings, |
| 3135 | #{AmaltheaPackage.eINSTANCE.memoryMapping_AbstractElement} ) |
| 3136 | } |
| 3137 | } |
| 3138 | |
| 3139 | abstract class AbstractProcess extends AbstractMemoryElement |
| 3140 | { |
| 3141 | // back pointer (readonly) |
| 3142 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of components the abstract process belongs to.</b></p>") |
| 3143 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3144 | refers transient readonly volatile derived Component[] referringComponents get { |
| 3145 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.abstractProcess_ReferringComponents, |
| 3146 | #{AmaltheaPackage.eINSTANCE.component_Tasks} ) |
| 3147 | } |
| 3148 | } |
| 3149 | |
| 3150 | /* |
| 3151 | * Possibility to define general custom elements |
| 3152 | */ |
| 3153 | class CustomEntity extends AbstractMemoryElement |
| 3154 | { |
| 3155 | String typeName |
| 3156 | } |
| 3157 | |
| 3158 | /* |
| 3159 | * Groups a list of processes to a process chain. |
| 3160 | * This does not define how the processes are chained, like being executed by one parent or like they trigger each other |
| 3161 | * This just defines that the processes should be chained. |
| 3162 | */ |
| 3163 | class ProcessChain extends ReferableBaseObject |
| 3164 | { |
| 3165 | refers Process[] processes |
| 3166 | } |
| 3167 | |
| 3168 | /* |
| 3169 | * Generalizes interrupt service routines and tasks |
| 3170 | */ |
| 3171 | abstract class Process extends AbstractProcess |
| 3172 | { |
| 3173 | contains CallGraph callGraph |
| 3174 | refers Stimulus[] stimuli |
| 3175 | } |
| 3176 | |
| 3177 | interface ICallGraphItemContainer |
| 3178 | { |
| 3179 | contains CallGraphItem[] items |
| 3180 | } |
| 3181 | |
| 3182 | |
| 3183 | /* |
| 3184 | * Describes the different execution paths of a process or runnable |
| 3185 | */ |
| 3186 | class CallGraph extends BaseObject, ICallGraphItemContainer {} |
| 3187 | |
| 3188 | /* |
| 3189 | * An abstract item of a call graph |
| 3190 | */ |
| 3191 | abstract class CallGraphItem extends BaseObject |
| 3192 | { |
| 3193 | // container (read only) |
| 3194 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3195 | refers local readonly derived Process containingProcess get { |
| 3196 | AmaltheaServices.getContainerOfType(this, Process) |
| 3197 | } |
| 3198 | |
| 3199 | // container (read only) |
| 3200 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3201 | refers local readonly derived Runnable containingRunnable get { |
| 3202 | AmaltheaServices.getContainerOfType(this, Runnable) |
| 3203 | } |
| 3204 | } |
| 3205 | |
| 3206 | /* |
| 3207 | * A switch in the call graph, the selected path depends on the value of the provided mode conditions |
| 3208 | */ |
| 3209 | class ModeSwitch extends CallGraphItem |
| 3210 | { |
| 3211 | contains ModeSwitchEntry[] entries |
| 3212 | contains ModeSwitchDefault defaultEntry |
| 3213 | } |
| 3214 | |
| 3215 | /* |
| 3216 | * A switch entry for a ModeSwitch. |
| 3217 | * It describes a path of the switch and the required mode condition to use this path |
| 3218 | */ |
| 3219 | class ModeSwitchEntry extends BaseObject, INamed, ICallGraphItemContainer |
| 3220 | { |
| 3221 | contains ModeConditionDisjunction[1] condition |
| 3222 | } |
| 3223 | |
| 3224 | class ModeSwitchDefault extends BaseObject, ICallGraphItemContainer {} |
| 3225 | |
| 3226 | /* |
| 3227 | * A switch in the call graph, each path has a probability |
| 3228 | */ |
| 3229 | class ProbabilitySwitch extends CallGraphItem |
| 3230 | { |
| 3231 | contains ProbabilitySwitchEntry[] entries |
| 3232 | } |
| 3233 | |
| 3234 | /* |
| 3235 | * A switch entry for a ProbabilitySwitch |
| 3236 | * It describes a path of the switch and it's probability |
| 3237 | */ |
| 3238 | class ProbabilitySwitchEntry extends BaseObject, ICallGraphItemContainer |
| 3239 | { |
| 3240 | double probability = "0.0" |
| 3241 | } |
| 3242 | |
| 3243 | /* |
| 3244 | * A counter for the call sequence items |
| 3245 | */ |
| 3246 | class Counter extends BaseObject |
| 3247 | { |
| 3248 | PositiveLong prescaler = "1" |
Harald Mackamul | af04ede | 2019-07-30 12:42:41 +0200 | [diff] [blame^] | 3249 | NonNegativeLong offset = "0" |
Harald Mackamul | aa64db0 | 2019-07-26 14:03:01 +0200 | [diff] [blame] | 3250 | } |
| 3251 | |
| 3252 | /* |
| 3253 | * Let the process wait for a combination of events defined by eventMask |
| 3254 | * maskType defines if the events in eventMask are linked by a AND or OR |
| 3255 | */ |
| 3256 | class WaitEvent extends CallGraphItem |
| 3257 | { |
| 3258 | contains EventMask eventMask |
| 3259 | WaitEventType maskType |
| 3260 | WaitingBehaviour waitingBehaviour |
| 3261 | |
| 3262 | contains Counter counter |
| 3263 | } |
| 3264 | |
| 3265 | enum WaitEventType |
| 3266 | { |
| 3267 | _undefined_ // Display: "<wait event>" |
| 3268 | AND |
| 3269 | OR |
| 3270 | } |
| 3271 | |
| 3272 | enum WaitingBehaviour |
| 3273 | { |
| 3274 | _undefined_ // Display: "<waiting>" |
| 3275 | active |
| 3276 | passive |
| 3277 | } |
| 3278 | |
| 3279 | /* |
| 3280 | * Sets the events of eventMask |
| 3281 | * These events can be set for a specific process, if there is no process, is is global (for all processes) |
| 3282 | * If there is a process, it is possible to set the event for a specific process instance that is currently activated |
| 3283 | */ |
| 3284 | class SetEvent extends CallGraphItem |
| 3285 | { |
| 3286 | contains EventMask eventMask |
| 3287 | refers Process process |
| 3288 | |
| 3289 | contains Counter counter |
| 3290 | } |
| 3291 | |
| 3292 | /* |
| 3293 | * Clears the events of eventMask |
| 3294 | */ |
| 3295 | class ClearEvent extends CallGraphItem |
| 3296 | { |
| 3297 | contains EventMask eventMask |
| 3298 | |
| 3299 | contains Counter counter |
| 3300 | } |
| 3301 | |
| 3302 | /* |
| 3303 | * A event mask |
| 3304 | */ |
| 3305 | class EventMask extends BaseObject |
| 3306 | { |
| 3307 | refers OsEvent[] events |
| 3308 | } |
| 3309 | |
| 3310 | /* |
| 3311 | * A event that can be set, cleared and waited for by a process |
| 3312 | */ |
| 3313 | class OsEvent extends ReferableBaseObject, ITaggable |
| 3314 | { |
| 3315 | int communicationOverheadInBit = "0" |
| 3316 | |
| 3317 | // back pointer (readonly) |
| 3318 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of components the OS event belongs to.</b></p>") |
| 3319 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3320 | refers transient readonly volatile derived Component[] referringComponents get { |
| 3321 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.osEvent_ReferringComponents, |
| 3322 | #{AmaltheaPackage.eINSTANCE.component_OsEvents} ) |
| 3323 | } |
| 3324 | } |
| 3325 | |
| 3326 | /* |
| 3327 | * Triggers a stimulus to activate its processes |
| 3328 | */ |
| 3329 | class InterProcessTrigger extends CallGraphItem |
| 3330 | { |
| 3331 | refers InterProcessStimulus[1] stimulus |
| 3332 | |
| 3333 | contains Counter counter |
| 3334 | } |
| 3335 | |
| 3336 | /* |
| 3337 | * Migrates task to core of resource owner |
| 3338 | */ |
| 3339 | class EnforcedMigration extends CallGraphItem |
| 3340 | { |
| 3341 | refers TaskScheduler[1] resourceOwner |
| 3342 | } |
| 3343 | |
| 3344 | /* |
| 3345 | * Triggers scheduler |
| 3346 | */ |
| 3347 | class SchedulePoint extends CallGraphItem |
| 3348 | { |
| 3349 | } |
| 3350 | |
| 3351 | /* |
| 3352 | * Terminates the process |
| 3353 | */ |
| 3354 | class TerminateProcess extends CallGraphItem |
| 3355 | { |
| 3356 | contains Counter counter |
| 3357 | } |
| 3358 | |
| 3359 | /* |
| 3360 | * Schedulable entity, which is managed by the OS. An instance of a Task is mapped to exactly one core |
| 3361 | * and includes the direct representation of all abstractions. |
| 3362 | */ |
| 3363 | class Task extends Process |
| 3364 | { |
| 3365 | Preemption preemption |
| 3366 | int multipleTaskActivationLimit = "0" |
| 3367 | } |
| 3368 | |
| 3369 | /* |
| 3370 | * Interrupt service routine |
| 3371 | */ |
| 3372 | class ISR extends Process |
| 3373 | { |
| 3374 | ISRCategory category |
| 3375 | } |
| 3376 | |
| 3377 | enum ISRCategory |
| 3378 | { |
| 3379 | _undefined_ // Display: "<isr category>" |
| 3380 | CATEGORY_1 |
| 3381 | CATEGORY_2 |
| 3382 | } |
| 3383 | |
| 3384 | /* |
| 3385 | * Prototype class for Process. |
| 3386 | * It does contain meta information of potential processes, which does not represent the final state. |
| 3387 | * The final state can be several Tasks, which can be computed using provided information of this prototype. |
| 3388 | */ |
| 3389 | class ProcessPrototype extends AbstractProcess |
| 3390 | { |
| 3391 | Preemption preemption |
| 3392 | refers Runnable firstRunnable |
| 3393 | refers Runnable lastRunnable |
| 3394 | /* |
| 3395 | * Defines the general label accesses |
| 3396 | */ |
| 3397 | contains AccessPrecedenceSpec[] accessPrecedenceSpec |
| 3398 | /* |
| 3399 | * Defines the general order of runnables |
| 3400 | */ |
| 3401 | contains OrderPrecedenceSpec[] orderPrecedenceSpec |
| 3402 | contains ChainedProcessPrototype[] chainedPrototypes |
| 3403 | refers Activation activation |
| 3404 | contains RunnableCall[] runnableCalls |
| 3405 | } |
| 3406 | |
| 3407 | class ChainedProcessPrototype extends BaseObject |
| 3408 | { |
| 3409 | refers ProcessPrototype[1] prototype |
| 3410 | int apply = "0" |
| 3411 | int offset = "0" |
| 3412 | } |
| 3413 | |
| 3414 | /* |
| 3415 | * General abstraction for precedence |
| 3416 | */ |
| 3417 | abstract class GeneralPrecedence extends BaseObject |
| 3418 | { |
| 3419 | refers Runnable origin |
| 3420 | refers Runnable target |
| 3421 | } |
| 3422 | |
| 3423 | /* |
| 3424 | * |
| 3425 | */ |
| 3426 | class AccessPrecedenceSpec extends GeneralPrecedence |
| 3427 | { |
| 3428 | refers Label[1] label |
| 3429 | AccessPrecedenceType orderType |
| 3430 | } |
| 3431 | |
| 3432 | /* |
| 3433 | * Defines the access precedence at the time of one task period. |
| 3434 | */ |
| 3435 | enum AccessPrecedenceType |
| 3436 | { |
| 3437 | _undefined_ // Display: "<access>" |
| 3438 | /* |
| 3439 | * Writer of label has to be performed before the reader. |
| 3440 | */ |
| 3441 | defaultWR |
| 3442 | /* |
| 3443 | * Dependency between writer and reader can be ignored. |
| 3444 | */ |
| 3445 | ignoreWR |
| 3446 | /* |
| 3447 | * Reader of label has to be performed before the writer (delay unit of controller). |
| 3448 | */ |
| 3449 | enforceRW |
| 3450 | } |
| 3451 | |
| 3452 | /* |
| 3453 | * |
| 3454 | */ |
| 3455 | class OrderPrecedenceSpec extends GeneralPrecedence |
| 3456 | { |
| 3457 | OrderType orderType |
| 3458 | } |
| 3459 | |
| 3460 | enum OrderType |
| 3461 | { |
| 3462 | _undefined_ // Display: "<order>" |
| 3463 | /* |
| 3464 | * Defines a general order, the included elements must not follow directly |
| 3465 | */ |
| 3466 | order |
| 3467 | /* |
| 3468 | * The defined elements must follow directly |
| 3469 | */ |
| 3470 | directOrder |
| 3471 | startSequence |
| 3472 | endSequence |
| 3473 | } |
| 3474 | |
| 3475 | enum DirectionType |
| 3476 | { |
| 3477 | _undefined_ // Display: "<direction>“ |
| 3478 | in |
| 3479 | out |
| 3480 | inout |
| 3481 | } |
| 3482 | |
| 3483 | class DataDependency extends BaseObject |
| 3484 | { |
| 3485 | refers Label[] labels |
| 3486 | refers RunnableParameter[] parameters |
| 3487 | refers CallArgument[] callArguments |
| 3488 | |
| 3489 | // container (read only) |
| 3490 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3491 | refers local readonly derived Runnable containingRunnable get { |
| 3492 | AmaltheaServices.getContainerOfType(this, Runnable) |
| 3493 | } |
| 3494 | } |
| 3495 | |
| 3496 | class RunnableParameter extends ReferableBaseObject |
| 3497 | { |
| 3498 | @GenModel(propertyCategory="Read only") |
| 3499 | container readonly Runnable containingRunnable opposite parameters |
| 3500 | |
| 3501 | op String getNamePrefix() { containingRunnable?.name } |
| 3502 | |
| 3503 | DirectionType direction |
| 3504 | refers TypeDefinition dataType |
| 3505 | contains DataDependency dependsOn |
| 3506 | |
| 3507 | op String toString() { |
| 3508 | val runName = containingRunnable?.name |
| 3509 | return (if (runName.nullOrEmpty) "<runnable>" else runName) + "::" + (if (name.nullOrEmpty) "<parameter>" else name) |
| 3510 | } |
| 3511 | } |
| 3512 | |
| 3513 | |
| 3514 | /* |
| 3515 | * Smallest allocatable unit, which provides additional (optional) attributes for allocation algorithms. |
| 3516 | */ |
| 3517 | class Runnable extends AbstractMemoryElement |
| 3518 | { |
| 3519 | contains ModeConditionDisjunction executionCondition |
| 3520 | contains RunnableParameter[] parameters opposite containingRunnable |
| 3521 | contains CallGraph callGraph |
| 3522 | refers Activation[] activations |
| 3523 | |
| 3524 | op CallGraphItem[] getRunnableItems() { |
| 3525 | if (callGraph === null) callGraph = AmaltheaFactory.eINSTANCE.createCallGraph() |
| 3526 | callGraph.items |
| 3527 | } |
| 3528 | op Activation getFirstActivation() { |
| 3529 | activations.head |
| 3530 | } |
| 3531 | /* |
| 3532 | * Marker if runnable is used as callback. |
| 3533 | */ |
| 3534 | boolean callback = "false" |
| 3535 | /* |
| 3536 | * Marker if runnable is used as a service. |
| 3537 | */ |
| 3538 | boolean service = "false" |
| 3539 | /* |
| 3540 | * ASIL level for the runnable entity |
| 3541 | */ |
| 3542 | ASILType asilLevel |
| 3543 | |
| 3544 | refers Section section |
| 3545 | |
| 3546 | // back pointer (readonly) |
| 3547 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of callers (RunnableCalls).</b></p>") |
| 3548 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3549 | refers transient readonly volatile derived RunnableCall[] runnableCalls get { |
| 3550 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.runnable_RunnableCalls, |
| 3551 | #{AmaltheaPackage.eINSTANCE.runnableCall_Runnable} ) |
| 3552 | } |
| 3553 | // back pointer (readonly) |
| 3554 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of components the runnable belongs to.</b></p>") |
| 3555 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3556 | refers transient readonly volatile derived Component[] referringComponents get { |
| 3557 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.runnable_ReferringComponents, |
| 3558 | #{AmaltheaPackage.eINSTANCE.component_Runnables} ) |
| 3559 | } |
| 3560 | } |
| 3561 | |
| 3562 | /* |
| 3563 | * Data representation, which can be accessed by run entities. |
| 3564 | */ |
| 3565 | class Label extends AbstractMemoryElement, IDisplayName |
| 3566 | { |
| 3567 | contains DataType dataType |
| 3568 | /* |
| 3569 | * Defines the label as a constant, not modifiable entity |
| 3570 | */ |
| 3571 | boolean constant = "false" |
| 3572 | /* |
| 3573 | * Defines if the label value is volatile or persistent to survive shutdown and start of system |
| 3574 | */ |
| 3575 | boolean bVolatile = "false" |
| 3576 | /* |
| 3577 | * Defines the data stability needs of the label |
| 3578 | */ |
| 3579 | LabelDataStability dataStability |
| 3580 | DataStabilityLevel stabilityLevel |
| 3581 | |
| 3582 | refers Section section |
| 3583 | |
| 3584 | // back pointer (readonly) |
| 3585 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of accesses (LabelAccess).</b></p>") |
| 3586 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3587 | refers transient readonly volatile derived LabelAccess[] labelAccesses get { |
| 3588 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.label_LabelAccesses, |
| 3589 | #{AmaltheaPackage.eINSTANCE.labelAccess_Data} ) |
| 3590 | } |
| 3591 | // back pointer (readonly) |
| 3592 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of components the label belongs to.</b></p>") |
| 3593 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3594 | refers transient readonly volatile derived Component[] referringComponents get { |
| 3595 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.label_ReferringComponents, |
| 3596 | #{AmaltheaPackage.eINSTANCE.component_Labels} ) |
| 3597 | } |
| 3598 | |
| 3599 | } |
| 3600 | |
| 3601 | class Channel extends AbstractMemoryElement, IDisplayName |
| 3602 | { |
| 3603 | contains DataType elementType |
| 3604 | int defaultElements = "0" |
| 3605 | int maxElements = "0" |
| 3606 | |
| 3607 | // back pointer (readonly) |
| 3608 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of accesses (ChannelAccess).</b></p>") |
| 3609 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3610 | refers transient readonly volatile derived ChannelAccess[] channelAccesses get { |
| 3611 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.channel_ChannelAccesses, |
| 3612 | #{AmaltheaPackage.eINSTANCE.channelAccess_Data} ) |
| 3613 | } |
| 3614 | } |
| 3615 | |
| 3616 | class ModeLabel extends AbstractMemoryElement, IDisplayName { |
| 3617 | refers Mode[1] mode |
| 3618 | String initialValue |
| 3619 | |
| 3620 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 3621 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 3622 | } |
| 3623 | |
| 3624 | op boolean isEnum() { |
| 3625 | mode instanceof EnumMode |
| 3626 | } |
| 3627 | |
| 3628 | op boolean isNumeric() { |
| 3629 | mode instanceof NumericMode |
| 3630 | } |
| 3631 | } |
| 3632 | |
| 3633 | |
| 3634 | enum LabelDataStability |
| 3635 | { |
| 3636 | _undefined_ // Display: "<data stability>" |
| 3637 | noProtection |
| 3638 | automaticProtection |
| 3639 | customProtection |
| 3640 | handledByModelElements |
| 3641 | } |
| 3642 | |
| 3643 | /* |
| 3644 | * A section is a logical structure, which contains labels and abstract run entities. |
| 3645 | * It is used to provide an easy mechanism to distribute objects to memory, |
| 3646 | * which are belonging together. |
| 3647 | */ |
| 3648 | class Section extends ReferableBaseObject |
| 3649 | { |
| 3650 | /* |
| 3651 | * for specifying the ASIL level for the "virtual memory sections" |
| 3652 | */ |
| 3653 | ASILType asilLevel |
| 3654 | |
| 3655 | // back pointer (readonly) |
| 3656 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of labels (Label).</b></p>") |
| 3657 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3658 | refers transient readonly volatile derived Label[] labels get { |
| 3659 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.section_Labels, |
| 3660 | #{AmaltheaPackage.eINSTANCE.label_Section} ) |
| 3661 | } |
| 3662 | // back pointer (readonly) |
| 3663 | @GenModel(documentation="<p><b>Returns an <em>immutable</em> list of runnables (Runnable).</b></p>") |
| 3664 | @GenModel(propertyCategory="Read only", propertyFilterFlags="org.eclipse.ui.views.properties.expert") |
| 3665 | refers transient readonly volatile derived Runnable[] runnables get { |
| 3666 | AmaltheaIndex.getInverseReferences(this, AmaltheaPackage.eINSTANCE.section_Runnables, |
| 3667 | #{AmaltheaPackage.eINSTANCE.runnable_Section} ) |
| 3668 | } |
| 3669 | } |
| 3670 | |
| 3671 | /* |
| 3672 | * Representation of a object that describes computation |
| 3673 | */ |
| 3674 | abstract class ComputationItem extends CallGraphItem {} |
| 3675 | |
| 3676 | /* |
| 3677 | * Representation of the execution needs of a Runnable (default and core-specific) |
| 3678 | */ |
| 3679 | class ExecutionNeed extends CallGraphItem |
| 3680 | { |
| 3681 | contains NeedEntry[] needs |
| 3682 | } |
| 3683 | |
| 3684 | class NeedEntry wraps java.util.Map$Entry |
| 3685 | { |
| 3686 | String[1] key // refers to HwFeatureCategory |
| 3687 | contains IDiscreteValueDeviation[1] value |
| 3688 | } |
| 3689 | |
| 3690 | /* |
| 3691 | * Representation of the execution IDiscreteValueDeviation of a Runnable (default and core-specific) |
| 3692 | */ |
| 3693 | class Ticks extends ComputationItem { |
| 3694 | contains IDiscreteValueDeviation ^default |
| 3695 | contains TicksEntry[] extended |
| 3696 | } |
| 3697 | |
| 3698 | class TicksEntry wraps java.util.Map$Entry { |
| 3699 | refers ProcessingUnitDefinition[1] key |
| 3700 | contains IDiscreteValueDeviation[1] value |
| 3701 | } |
| 3702 | |
| 3703 | enum ModeLabelAccessEnum { |
| 3704 | _undefined_ // Display: "<access>" |
| 3705 | read |
| 3706 | ^set |
| 3707 | increment |
| 3708 | decrement |
| 3709 | } |
| 3710 | |
| 3711 | /* |
| 3712 | * Representation of a mode label access of a run entity. |
| 3713 | */ |
| 3714 | class ModeLabelAccess extends CallGraphItem |
| 3715 | { |
| 3716 | refers ModeLabel[1] data |
| 3717 | ModeLabelAccessEnum access |
| 3718 | /* |
| 3719 | * Just used in case that this access writes a value to a Mode-Label. |
| 3720 | * It can be used to define which mode value is written to the label. |
| 3721 | */ |
| 3722 | String value |
| 3723 | /* |
| 3724 | * Just used in case of increment or decrement. |
| 3725 | * It can be used to define a step other than 1. |
| 3726 | */ |
| 3727 | PositiveInt step = "1" |
| 3728 | |
| 3729 | op boolean validateInvariants(EDiagnosticChain diagnostics, EMap<Object,Object> context) { |
| 3730 | AmaltheaValidations.validateInvariants(this, diagnostics, context) |
| 3731 | } |
| 3732 | } |
| 3733 | |
| 3734 | /* |
| 3735 | * Representation of a label access of a run entity. |
| 3736 | */ |
| 3737 | class LabelAccess extends ComputationItem, ITaggable |
| 3738 | { |
| 3739 | refers Label[1] data |
| 3740 | LabelAccessEnum access |
| 3741 | |
| 3742 | /* |
| 3743 | * Optional parameter for statistic values |
| 3744 | */ |
| 3745 | contains LabelAccessStatistic statistic |
| 3746 | |
| 3747 | /* |
| 3748 | * Optional parameter for transmission policy of larger data |
| 3749 | */ |
| 3750 | contains TransmissionPolicy transmissionPolicy |
| 3751 | |
| 3752 | /* |
| 3753 | * Defines the data stability needs of the label access |
| 3754 | */ |
| 3755 | LabelAccessDataStability dataStability |
| 3756 | LabelAccessImplementation implementation |
| 3757 | |
| 3758 | contains DataDependency dependsOn |
| 3759 | } |
| 3760 | |
| 3761 | abstract class ChannelAccess extends CallGraphItem |
| 3762 | { |
| 3763 | refers Channel[1] data |
| 3764 | int elements = "0" |
| 3765 | contains TransmissionPolicy transmissionPolicy |
| 3766 | } |
| 3767 | |
| 3768 | class ChannelSend extends ChannelAccess |
| 3769 | { |
| 3770 | } |
| 3771 | |
| 3772 | class ChannelReceive extends ChannelAccess |
| 3773 | { |
| 3774 | ReceiveOperation receiveOperation |
| 3775 | boolean dataMustBeNew = "false" |
| 3776 | int elementIndex = "0" |
| 3777 | int lowerBound = "0" |
| 3778 | // int elementsHold -> use custom property |
| 3779 | } |
| 3780 | |
| 3781 | enum ReceiveOperation |
| 3782 | { |
| 3783 | _undefined_ // Display: "<receive operation>" |
| 3784 | FIFO_Read |
| 3785 | FIFO_Take |
| 3786 | LIFO_Read |
| 3787 | LIFO_Take |
| 3788 | } |
| 3789 | |
| 3790 | /* |
| 3791 | * Defines the data stability needs of a label access. |
| 3792 | * Inherited means that the setting of the Label is used |
| 3793 | */ |
| 3794 | enum LabelAccessDataStability |
| 3795 | { |
| 3796 | _undefined_ // Display: "<data stability>" |
| 3797 | inherited |
| 3798 | noProtection |
| 3799 | automaticProtection |
| 3800 | customProtection |
| 3801 | handledByModelElements |
| 3802 | } |
| 3803 | |
| 3804 | enum LabelAccessEnum |
| 3805 | { |
| 3806 | _undefined_ // Display: "<access>" |
| 3807 | read |
| 3808 | write |
| 3809 | } |
| 3810 | |
| 3811 | enum LabelAccessImplementation |
| 3812 | { |
| 3813 | _undefined_ // Display: "<implementation>" |
| 3814 | explicit // also known as "direct" |
| 3815 | implicit // also known as "optimized" |
| 3816 | timed |
| 3817 | } |
| 3818 | |
| 3819 | /* |
| 3820 | * Describes an semaphore access |
| 3821 | */ |
| 3822 | class SemaphoreAccess extends CallGraphItem |
| 3823 | { |
| 3824 | refers Semaphore[1] semaphore |
| 3825 | SemaphoreAccessEnum access |
| 3826 | WaitingBehaviour waitingBehaviour |
| 3827 | } |
| 3828 | |
| 3829 | /* |
| 3830 | * request: requests access to semaphore |
| 3831 | * release: release accessed semaphore |
| 3832 | * exclusive: gets access to requested semaphore only when there is no other user accessing it |
| 3833 | */ |
| 3834 | enum SemaphoreAccessEnum |
| 3835 | { |
| 3836 | _undefined_ // Display: "<access>" |
| 3837 | request |
| 3838 | exclusive |
| 3839 | release |
| 3840 | } |
| 3841 | |
| 3842 | /* |
| 3843 | * An abstract description for sender-receiver-communication (it can be read or write) |
| 3844 | */ |
| 3845 | abstract class SenderReceiverCommunication extends CallGraphItem |
| 3846 | { |
| 3847 | boolean buffered = "false" |
| 3848 | refers Label[1] label |
| 3849 | refers Port port |
| 3850 | } |
| 3851 | |
| 3852 | /* |
| 3853 | * The read operation of the receiver of the sender-receiver-communication |
| 3854 | */ |
| 3855 | class SenderReceiverRead extends SenderReceiverCommunication {} |
| 3856 | |
| 3857 | /* |
| 3858 | * The write operation of the sender of the sender-receiver-communication |
| 3859 | * It contains the runnables that have the corresponding SenderReceiverRead |
| 3860 | */ |
| 3861 | class SenderReceiverWrite extends SenderReceiverCommunication |
| 3862 | { |
| 3863 | refers Runnable[] notifiedRunnables |
| 3864 | } |
| 3865 | |
| 3866 | /* |
| 3867 | * An abstract description for client/server communication |
| 3868 | * It refers to a required runnable that describes the called server operation |
| 3869 | */ |
| 3870 | abstract class ServerCall extends CallGraphItem |
| 3871 | { |
| 3872 | refers Runnable[1] serverRunnable |
| 3873 | refers Port port |
| 3874 | } |
| 3875 | |
| 3876 | /* |
| 3877 | * A synchronous server call |
| 3878 | */ |
| 3879 | class SynchronousServerCall extends ServerCall |
| 3880 | { |
| 3881 | WaitingBehaviour waitingBehaviour |
| 3882 | } |
| 3883 | |
| 3884 | /* |
| 3885 | * A asynchronous server call |
| 3886 | * It refers to a optional runnable that exploits the results produced by the server |
| 3887 | */ |
| 3888 | class AsynchronousServerCall extends ServerCall |
| 3889 | { |
| 3890 | refers Runnable resultRunnable |
| 3891 | } |
| 3892 | |
| 3893 | /* |
| 3894 | * Get the result of a previous asynchronous server call |
| 3895 | */ |
| 3896 | class GetResultServerCall extends ServerCall |
| 3897 | { |
| 3898 | BlockingType blockingType |
| 3899 | } |
| 3900 | |
| 3901 | /* |
| 3902 | * Blocking type |
| 3903 | */ |
| 3904 | enum BlockingType |
| 3905 | { |
| 3906 | _undefined_ // Display: "<blocking>" |
| 3907 | active_wait |
| 3908 | passive_wait |
| 3909 | non_blocking |
| 3910 | } |
| 3911 | |
| 3912 | /* |
| 3913 | * Describes a group of deviation runnable items |
| 3914 | */ |
| 3915 | class Group extends CallGraphItem, INamed, ICallGraphItemContainer |
| 3916 | { |
| 3917 | boolean ordered = "true" |
| 3918 | } |
| 3919 | |
| 3920 | class CallArgument extends ReferableObject |
| 3921 | { |
| 3922 | @GenModel(propertyCategory="Read only") |
| 3923 | container readonly RunnableCall containingCall opposite arguments |
| 3924 | |
| 3925 | op String getName() { |
| 3926 | if (super.name.nullOrEmpty) "access.1" else super.name |
| 3927 | } |
| 3928 | |
| 3929 | op String computeUniqueName() { |
| 3930 | return encode(containingCall?.containingRunnable?.name) |
| 3931 | + "/calls/" + encode(containingCall?.runnable?.name) |
| 3932 | + "/param/" + encode(parameter?.name) + "/" + encode(name) |
| 3933 | + "?type=" + eClass.name |
| 3934 | } |
| 3935 | |
| 3936 | @GenModel(propertyCategory="Main") |
| 3937 | refers RunnableParameter parameter |
| 3938 | |
| 3939 | contains DataDependency dependsOn |
| 3940 | } |
| 3941 | |
| 3942 | /* |
| 3943 | * Representation of a runnable call of a run entity. |
| 3944 | */ |
| 3945 | class RunnableCall extends CallGraphItem, ITaggable |
| 3946 | { |
| 3947 | refers Runnable[1] runnable |
| 3948 | contains CallArgument[] arguments opposite containingCall |
| 3949 | contains RunEntityCallStatistic statistic |
| 3950 | } |
| 3951 | |
| 3952 | /* |
| 3953 | * Preemption type for scheduling |
| 3954 | */ |
| 3955 | enum Preemption |
| 3956 | { |
| 3957 | _undefined_ // Display: "<preemption>" |
| 3958 | preemptive |
| 3959 | cooperative // aka limited-preemptive |
| 3960 | non_preemptive |
| 3961 | } |
| 3962 | |
| 3963 | /* |
| 3964 | * Concurrency type of an entity |
| 3965 | */ |
| 3966 | enum ConcurrencyType |
| 3967 | { |
| 3968 | _undefined_ // Display: "<concurrency>" |
| 3969 | /* |
| 3970 | * Safe for access inside of the same core |
| 3971 | */ |
| 3972 | SingleCoreSafe |
| 3973 | /* |
| 3974 | * Safe for access from another core |
| 3975 | */ |
| 3976 | MultiCoreSafe |
| 3977 | SingleCorePrioSafe |
| 3978 | } |
| 3979 | |
| 3980 | /* |
| 3981 | * Explicitly trigger a custom event from a runnable. |
| 3982 | */ |
| 3983 | class CustomEventTrigger extends CallGraphItem |
| 3984 | { |
| 3985 | refers CustomEvent[1] event |
| 3986 | } |
| 3987 | |
| 3988 | /* |
| 3989 | * Central access point for different data type definitions |
| 3990 | */ |
| 3991 | interface DataType |
| 3992 | { |
| 3993 | } |
| 3994 | |
| 3995 | /* |
| 3996 | * Couple of compound data types |
| 3997 | */ |
| 3998 | abstract class CompoundType extends BaseObject, DataType |
| 3999 | { |
| 4000 | } |
| 4001 | |
| 4002 | /* |
| 4003 | * Representing a struct definition, containing different entries |
| 4004 | */ |
| 4005 | class Struct extends CompoundType |
| 4006 | { |
| 4007 | contains StructEntry[] entries |
| 4008 | } |
| 4009 | |
| 4010 | /* |
| 4011 | * Representation of one struct entry |
| 4012 | */ |
| 4013 | class StructEntry extends BaseObject, INamed |
| 4014 | { |
| 4015 | contains DataType dataType |
| 4016 | } |
| 4017 | |
| 4018 | /* |
| 4019 | * Representation of an array data type |
| 4020 | */ |
| 4021 | class Array extends CompoundType |
| 4022 | { |
| 4023 | int numberElements = "0" |
| 4024 | contains DataType dataType |
| 4025 | } |
| 4026 | |
| 4027 | /* |
| 4028 | * Representing a pointer |
| 4029 | */ |
| 4030 | class Pointer extends CompoundType |
| 4031 | { |
| 4032 | contains DataType dataType |
| 4033 | } |
| 4034 | |
| 4035 | class TypeRef extends BaseObject, DataType |
| 4036 | { |
| 4037 | refers TypeDefinition typeDef |
| 4038 | } |
| 4039 | |
| 4040 | |
| 4041 | class Alias extends BaseObject |
| 4042 | { |
| 4043 | /* |
| 4044 | * Name of the target environment |
| 4045 | */ |
| 4046 | String target |
| 4047 | /* |
| 4048 | * Corresponding name in the target environment |
| 4049 | */ |
| 4050 | String alias |
| 4051 | } |
| 4052 | |
| 4053 | abstract class TypeDefinition extends ReferableBaseObject |
| 4054 | { |
| 4055 | /* |
| 4056 | * Size of the defined data type |
| 4057 | */ |
| 4058 | contains DataSize size |
| 4059 | } |
| 4060 | |
| 4061 | class DataTypeDefinition extends TypeDefinition |
| 4062 | { |
| 4063 | contains DataType dataType |
| 4064 | } |
| 4065 | |
| 4066 | /* |
| 4067 | * Basic data type definition, including naming (alias) in target environments |
| 4068 | */ |
| 4069 | class BaseTypeDefinition extends TypeDefinition |
| 4070 | { |
| 4071 | /* |
| 4072 | * Naming in different target environments |
| 4073 | */ |
| 4074 | contains Alias[] aliases |
| 4075 | } |
| 4076 | |
| 4077 | /* |
| 4078 | * General abstraction for activation source. |
| 4079 | * Used for first definition of an activation rate, which is later refined by stimulus. |
| 4080 | */ |
| 4081 | abstract class Activation extends ReferableBaseObject, ITaggable |
| 4082 | { |
| 4083 | } |
| 4084 | |
| 4085 | /* |
| 4086 | * Min and Max execution frequency within a task or timeslice |
| 4087 | */ |
| 4088 | class PeriodicActivation extends Activation |
| 4089 | { |
| 4090 | contains Time min |
| 4091 | contains Time max |
| 4092 | contains Time[1] recurrence |
| 4093 | contains Time[1] offset |
| 4094 | } |
| 4095 | |
| 4096 | /* |
| 4097 | * Periodic activation based on other events, like rotation speed |
| 4098 | */ |
| 4099 | class VariableRateActivation extends Activation |
| 4100 | { |
| 4101 | String description |
| 4102 | contains Time[1] step |
| 4103 | contains IContinuousValueDeviation[1] occurrencesPerStep |
| 4104 | } |
| 4105 | |
| 4106 | class SporadicActivation extends Activation |
| 4107 | { |
| 4108 | String description |
| 4109 | contains ITimeDeviation[1] occurrence |
| 4110 | } |
| 4111 | |
| 4112 | /* |
| 4113 | * A single activation between time min and max |
| 4114 | */ |
| 4115 | class SingleActivation extends Activation |
| 4116 | { |
| 4117 | contains Time min |
| 4118 | contains Time max |
| 4119 | } |
| 4120 | |
| 4121 | /* |
| 4122 | * Activation which is triggered by an event. |
| 4123 | */ |
| 4124 | class EventActivation extends Activation |
| 4125 | { |
| 4126 | refers TriggerEvent[+] triggeringEvents |
| 4127 | contains Counter counter |
| 4128 | } |
| 4129 | |
| 4130 | class CustomActivation extends Activation |
| 4131 | { |
| 4132 | String description |
| 4133 | } |
| 4134 | |
| 4135 | /* |
| 4136 | * Contains information about access statistic values |
| 4137 | */ |
| 4138 | class LabelAccessStatistic extends BaseObject |
| 4139 | { |
| 4140 | contains NumericStatistic value |
| 4141 | contains NumericStatistic cacheMisses |
| 4142 | } |
| 4143 | |
| 4144 | class RunEntityCallStatistic extends BaseObject |
| 4145 | { |
| 4146 | contains NumericStatistic statistic |
| 4147 | } |
| 4148 | |
| 4149 | enum ASILType |
| 4150 | { |
| 4151 | _undefined_ // Display: "<ASIL Level>" |
| 4152 | D |
| 4153 | C |
| 4154 | B |
| 4155 | A |
| 4156 | QM |
| 4157 | } |
| 4158 | |
| 4159 | |
| 4160 | // =============================================================================== |
| 4161 | // =============================================================================== |
| 4162 | // |
| 4163 | // Measurement Model |
| 4164 | // |
| 4165 | // =============================================================================== |
| 4166 | // =============================================================================== |
| 4167 | |
| 4168 | |
| 4169 | class MeasurementModel extends BaseObject |
| 4170 | { |
| 4171 | contains Measurement[] measurements |
| 4172 | } |
| 4173 | |
| 4174 | abstract class Measurement extends BaseObject |
| 4175 | { |
| 4176 | contains Time[] runtimes |
| 4177 | contains ITimeDeviation runtimeDeviation |
| 4178 | } |
| 4179 | |
| 4180 | class EventChainMeasurement extends Measurement |
| 4181 | { |
| 4182 | refers EventChain[1] eventChain |
| 4183 | } |
| 4184 | |
| 4185 | class TaskMeasurement extends Measurement |
| 4186 | { |
| 4187 | refers Task[1] task |
| 4188 | } |
| 4189 | |
| 4190 | class RunnableMeasurement extends Measurement |
| 4191 | { |
| 4192 | refers Runnable[1] runnable |
| 4193 | } |
| 4194 | |