| // ***************************************************************************** |
| // Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v1.0 |
| // which accompanies this distribution, and is available at |
| // http://www.eclipse.org/legal/epl-v10.html |
| // |
| // Contributors: |
| // Pierre Allard - initial API and implementation |
| // Regent L'Archeveque |
| // |
| // SPDX-License-Identifier: EPL-1.0 |
| // ***************************************************************************** |
| @GenModel(prefix="ApogyAddonsTelecoms", |
| childCreationExtenders="true", |
| extensibleProviderFactory="true", |
| multipleEditorPages="false", |
| copyrightText="******************************************************************************* |
| Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| All rights reserved. This program and the accompanying materials |
| are made available under the terms of the Eclipse Public License v1.0 |
| which accompanies this distribution, and is available at |
| http://www.eclipse.org/legal/epl-v10.html |
| |
| Contributors: |
| Pierre Allard - initial API and implementation |
| Regent L'Archeveque |
| |
| SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************", |
| modelName="ApogyAddonsTelecoms", |
| complianceLevel="8.0", |
| suppressGenModelAnnotations="false", |
| dynamicTemplates="true", |
| templateDirectory="platform:/plugin/org.eclipse.apogy.common.emf.codegen/templates") |
| @GenModel(modelDirectory="/org.eclipse.apogy.addons.telecoms/src-gen") |
| @GenModel(editDirectory="/org.eclipse.apogy.addons.telecoms.edit/src-gen") |
| |
| package org.eclipse.apogy.addons.telecoms |
| |
| import org.eclipse.apogy.common.emf.Named |
| import org.eclipse.apogy.addons.SimpleTool |
| import org.eclipse.apogy.common.topology.Node |
| import org.eclipse.apogy.common.math.Matrix4x4 |
| import org.eclipse.apogy.core.environment.surface.AbstractLineOfSightImageMapLayer |
| import org.eclipse.apogy.common.Apogy |
| |
| // Types |
| |
| type Color3f wraps javax.vecmath.Color3f |
| |
| /** |
| * The different possible states of the TelecomNode |
| */ |
| enum TelecomNodeStatus |
| { |
| NOT_STARTED as "Not Started" = 0 |
| NOT_ENABLED as "Not Enabled" = 1 |
| UNREACHABLE as "Unreachable" = 2 |
| NORMAL as "Normal" = 3 |
| PACKET_LOSS_WARNING as "Warning: High Packet Loss" = 4 |
| PACKET_LOSS_ALARM as "Alarm: Packet Loss Out Of Valid Range" = 5 |
| LATENCY_WARNING as "Warning: High Latency" = 6 |
| LATENCY_ALARM as "Alarm: Latency Out Of Valid Range" = 7 |
| BOTH_WARNING as "Warning: High Latency & Packet Loss" = 8 |
| BOTH_ALARM as "Alarm: Latency & Packet Loss Out Of Valid Range" = 9 |
| } |
| |
| /** |
| * A node containing all the information required to attempt communication |
| * with the desired network address, keeping track of the current latency, |
| * packet loss and overall state. |
| */ |
| @Apogy(hasCustomClass="true") |
| class TelecomNode |
| { |
| /** |
| * The status monitor to which this node belongs |
| */ |
| container TelecomStatusMonitorTool statusMonitorTool opposite telecomNodes |
| |
| /** |
| * Whether the network node is enabled, and thus, is actively |
| * receiving updates. |
| */ |
| @GenModel(propertyCategory="Current Status", property="Readonly", notify="true", children="false") |
| boolean enabled = "true" |
| |
| /** |
| * The current name of the telecom node |
| */ |
| @GenModel(propertyCategory="Connection Settings", notify="true", children="false") |
| String name = "" |
| |
| /** |
| * The current address of the telecom node |
| */ |
| @GenModel(propertyCategory="Connection Settings", notify="true", children="false") |
| String address = "localhost" |
| |
| /** |
| * The number of packets to send in each update requested (>= 1) |
| */ |
| @GenModel(propertyCategory="Connection Settings", notify="true", children="false") |
| int packetsToSend = "1" |
| |
| /** |
| * The time (in ms) to wait between waiting for a response and considering |
| * a packet lost. |
| */ |
| @GenModel(propertyCategory="Connection Settings", notify="true", children="false") |
| @Apogy(units="ms") |
| int connectionTimeout = "2000" |
| |
| /** |
| * The point where packet latency (in ms) is becoming high (should be warned) |
| */ |
| @GenModel(propertyCategory="Warnings And Alarms", notify="true", children="false") |
| @Apogy(units="ms") |
| double latencyWarning = "500.0" |
| |
| /** |
| * The point where packet latency (in ms) is so high as to be out of valid range (should be an alarm) |
| */ |
| @GenModel(propertyCategory="Warnings And Alarms", notify="true", children="false") |
| @Apogy(units="ms") |
| double latencyAlarm = "1000.0" |
| |
| /** |
| * The point where packet loss (in %) is becoming high (should be warned) |
| */ |
| @GenModel(propertyCategory="Warnings And Alarms", notify="true", children="false") |
| @Apogy(units="%") |
| double packetLossWarning = "20.0" |
| |
| /** |
| * The point where packet loss (in %) is so high as to be out of valid range (should be an alarm) |
| */ |
| @GenModel(propertyCategory="Warnings And Alarms", notify="true", children="false") |
| @Apogy(units="%") |
| double packetLossAlarm = "50.0" |
| |
| /** |
| * The current packet latency, in milliseconds, between this computer and the target address |
| */ |
| @GenModel(propertyCategory="Current Status", property="Readonly", notify="true", children="false") |
| @Apogy(units="ms") |
| transient double latency = "0.0" |
| |
| /** |
| * The current packet loss, in percent,between this computer and the target address |
| */ |
| @GenModel(propertyCategory="Current Status", property="Readonly", notify="true", children="false") |
| @Apogy(units="%") |
| transient double packetLoss = "0.0" |
| |
| /** |
| * The current status of the network node, as derived from the network |
| * node's other state. |
| */ |
| @GenModel(propertyCategory="Current Status", property="Readonly", notify="true", children="false") |
| transient volatile derived TelecomNodeStatus status get |
| { |
| if (statusMonitorTool.running == false) |
| { |
| return TelecomNodeStatus.NOT_STARTED |
| } |
| else if (enabled == false) |
| { |
| return TelecomNodeStatus.NOT_ENABLED |
| } |
| else |
| { |
| if (packetLoss >= 100.0) |
| { |
| return TelecomNodeStatus.UNREACHABLE |
| } |
| else if (latency >= 0 && latency < latencyWarning) |
| { |
| if (packetLoss < packetLossWarning) |
| { |
| return TelecomNodeStatus.NORMAL |
| } |
| else if (packetLoss >= packetLossWarning && |
| packetLoss < packetLossAlarm) |
| { |
| return TelecomNodeStatus.PACKET_LOSS_WARNING |
| } |
| else |
| { |
| return TelecomNodeStatus.PACKET_LOSS_ALARM |
| } |
| } |
| else if (latency >= latencyWarning && |
| latency < latencyAlarm) |
| { |
| if (packetLoss < packetLossWarning) |
| { |
| return TelecomNodeStatus.LATENCY_WARNING |
| } |
| else if (packetLoss >= packetLossWarning && |
| packetLoss < packetLossAlarm) |
| { |
| return TelecomNodeStatus.BOTH_WARNING |
| } |
| else |
| { |
| return TelecomNodeStatus.BOTH_ALARM |
| } |
| } |
| else |
| { |
| if (packetLoss < packetLossWarning) |
| { |
| return TelecomNodeStatus.LATENCY_ALARM |
| } |
| else if (packetLoss >= packetLossWarning && |
| packetLoss < packetLossAlarm) |
| { |
| return TelecomNodeStatus.BOTH_ALARM |
| } |
| else |
| { |
| return TelecomNodeStatus.BOTH_ALARM |
| } |
| } |
| } |
| } |
| } |
| |
| /** |
| * This is used to keep track of all the relevant state for |
| * a telecom status monitor tool. |
| */ |
| @Apogy(hasCustomClass="true") |
| class TelecomStatusMonitorTool |
| { |
| /** |
| * All of the telecom nodes that are associated with the |
| * associated with this status monitor tool |
| */ |
| contains TelecomNode[0..*] telecomNodes opposite statusMonitorTool |
| |
| /** |
| * The list of telecom status monitors to which this particular monitor belongs |
| */ |
| container TelecomStatusMonitorToolList statusMonitorToolList opposite telecomStatusMonitors |
| |
| /** |
| * Whether or not the telecom status monitor is currently running |
| */ |
| @GenModel(property="Readonly", notify="true", children="false") |
| transient boolean running = "false" |
| |
| /** |
| * Whether or not the telecom status monitor is currently disposed |
| */ |
| @GenModel(property="Readonly", notify="true", children="false") |
| transient boolean disposed = "false" |
| |
| /** |
| * Operation used to start the telecom status monitor running. |
| */ |
| op void start() |
| |
| /** |
| * Operation used to stop the telecom status monitor. |
| */ |
| op void stop() |
| |
| /** |
| * Operation used to dispose of the telecom status monitor |
| * when it is no longer needed |
| */ |
| op void dispose() |
| } |
| |
| /** |
| * This is used to keep track of the list of telecom status monitor |
| * tool. |
| */ |
| @Apogy(hasCustomClass="true") |
| class TelecomStatusMonitorToolList extends SimpleTool |
| { |
| /* |
| * Used to keep track of all of the telecom status monitors |
| */ |
| contains TelecomStatusMonitorTool[0..*] telecomStatusMonitors opposite statusMonitorToolList |
| } |
| |
| /** |
| * Abstract class defining a antenna radiation pattern, which is the directional (angular) dependence of |
| * the strength of the radio waves from the antenna or other source. |
| */ |
| @Apogy(hasCustomItemProvider="true") |
| abstract class AbstractAntennaRadiationPattern extends Node, Named |
| { |
| /** |
| * Returns the gain of the antenna in the direction specified by a vector. |
| * @param theta The angle between the z axis and the direction vector, in radians. |
| * @param phi The angle between the x axis and the projection of the point in the x-y plane, in radians |
| * @return The gain, in dBi (decibels isotropic or dBi) associated with the radiation pattern in the specified direction. |
| */ |
| @Apogy(units="dB") |
| op double computeGain(@Apogy(units="rad") double theta, @Apogy(units="rad") double phi) |
| } |
| |
| /** |
| * Class that represent a theoretical antenna that acts as a point source of electromagnetic waves which radiates |
| * the same intensity of radiation in all directions. |
| */ |
| @Apogy(hasCustomClass="true") |
| class IsotropicAntenna extends AbstractAntennaRadiationPattern |
| { |
| } |
| |
| /** |
| * Simple dipole antenna. The antenna axis is along the z-axis. |
| */ |
| class DipoleAntennaRadiationPattern extends AbstractAntennaRadiationPattern |
| { |
| } |
| |
| /** |
| * Simple half-wave dipole antenna. The antenna axis is along the z-axis. |
| */ |
| @Apogy(hasCustomClass="true") |
| class HalfWaveDipoleAntennaRadiationPattern extends AbstractAntennaRadiationPattern |
| { |
| } |
| |
| /** |
| * A simple radiation pattern defined as a rectangular frustum. Outside the frustum, gain is null. |
| */ |
| @Apogy(hasCustomClass="true", hasCustomItemProvider="true") |
| class SimpleConicalRadiationPattern extends AbstractAntennaRadiationPattern |
| { |
| /** |
| * The apex angle of the cone. The cone is pointing toward +Z. |
| */ |
| @Apogy(units="rad") |
| double apexAngle = "0.79" |
| } |
| |
| /** |
| * A simple radiation pattern defined as a rectangular frustum. Outside the frustum, gain is null. |
| */ |
| @Apogy(hasCustomClass="true", hasCustomItemProvider="true") |
| class SimpleRectangularFrustumRadiationPattern extends AbstractAntennaRadiationPattern |
| { |
| /** |
| * Horizontal field of view angle. |
| */ |
| @Apogy(units="rad") |
| double horizontalFieldOfView = "0.79" |
| |
| /** |
| * Vertical field of view angle. |
| */ |
| @Apogy(units="rad") |
| double verticalFieldOfView = "1.57" |
| } |
| |
| /** |
| * Defines an antenna radiation pattern which actually pattern data is found in a URL. |
| */ |
| class URlBasedAntennaRadiationPattern extends AbstractAntennaRadiationPattern |
| { |
| /** |
| * The URL to the file containing the radiation pattern data. |
| */ |
| @GenModel(propertyCategory="URL") |
| String url |
| } |
| |
| /** |
| * A map layer used to show an antenna radiation pattern. |
| */ |
| @Apogy(hasCustomClass="true", hasCustomItemProvider="true") |
| class AntennaRadiationPatternImageMapLayer extends AbstractLineOfSightImageMapLayer |
| { |
| /** |
| * The position of the observer with which we want line of sight. |
| */ |
| @GenModel(property="Editable", propertyCategory="IMAGE_GENERATION_SETTINGS") |
| contains Matrix4x4[1] observerPose |
| |
| @GenModel(property="Editable", propertyCategory="ANTENNA") |
| contains AbstractAntennaRadiationPattern antennaRadiationPattern |
| |
| /** |
| * Cutoff signal strength under which no signal is usuable. |
| */ |
| @Apogy(units="dB", property="Editable", propertyCategory="CUTOFF_SETTINGS") |
| double signalStrengthCutoff = "-100.0" |
| |
| /** |
| * Color to use to mark line of sigh is available. |
| */ |
| @GenModel(property="Editable", propertyCategory="CUTOFF_SETTINGS") |
| Color3f bellowCutoffColor |
| } |