|
| 1 | +package hflink.components.c2computer; |
| 2 | + |
| 3 | +import hflink.common.ports.DesktopUIServerProtocol; |
| 4 | +import hflink.common.ports.ElectricalPowerProtocol; |
| 5 | +import hflink.common.ports.EthernetProtocol; |
| 6 | +import hflink.common.ports.IP; |
| 7 | +import hflink.common.ports.PCUIServerProtocol; |
| 8 | +import hflink.common.ports.ThermalHeatTransferProtocol; |
| 9 | +import hflink.common.ports.UDP; |
| 10 | +import sysmlinjava.annotations.AssociationConnector; |
| 11 | +import sysmlinjava.annotations.AssociationConnectorFunction; |
| 12 | +import sysmlinjava.annotations.Flow; |
| 13 | +import sysmlinjava.annotations.FullPort; |
| 14 | +import sysmlinjava.annotations.Value; |
| 15 | +import sysmlinjava.annotations.requirements.RequirementAttribute; |
| 16 | +import sysmlinjava.annotations.requirements.RequirementInterfaceProtocol; |
| 17 | +import sysmlinjava.annotations.requirements.RequirementInterfaceProtocolConnector; |
| 18 | +import sysmlinjava.annotations.requirements.RequirementPhysical; |
| 19 | +import sysmlinjava.annotations.requirements.RequirementReliability; |
| 20 | +import sysmlinjava.annotations.requirements.RequirementResource; |
| 21 | +import sysmlinjava.blocks.SysMLBlock; |
| 22 | +import sysmlinjava.connectors.SysMLAssociationBlockConnector; |
| 23 | +import sysmlinjava.connectors.SysMLAssociationBlockConnectorFunction; |
| 24 | +import sysmlinjava.requirements.SysMLVerificationMethodKind; |
| 25 | +import sysmlinjava.valuetypes.Cost$US; |
| 26 | +import sysmlinjava.valuetypes.HeatWatts; |
| 27 | +import sysmlinjava.valuetypes.MassKilograms; |
| 28 | +import sysmlinjava.valuetypes.Percent; |
| 29 | +import sysmlinjava.valuetypes.PowerWatts; |
| 30 | +import sysmlinjava.valuetypes.SString; |
| 31 | +import sysmlinjava.valuetypes.VolumeMetersCubic; |
| 32 | + |
| 33 | +/** |
| 34 | + * The CommandControlComputer is a system component that hosts the |
| 35 | + * web-browser-based application for the command/control of the remotely |
| 36 | + * deployed systems. It transmits HTTP requests and receive HTTP responses over |
| 37 | + * internet protocols via the ModemRadio with the web-servers hosted by |
| 38 | + * DeployedComputers. |
| 39 | + * <p> |
| 40 | + * The CommandControlComputer block includes full ports for each of the |
| 41 | + * protocols used to communicate with the deployed computers via the |
| 42 | + * modem-radio. These protocols include UDP over IP over ethernet for remote |
| 43 | + * computer communications, and a web-browser on a PC-like desktop for operator |
| 44 | + * interactions.It also includes full ports for power and heat and their |
| 45 | + * corresponding flows - power-in and heat-out. Specified block values include |
| 46 | + * availability, size, weight, speed, and cost. |
| 47 | + * <p> |
| 48 | + * The block also contains all of the connectors between the ports in the block. |
| 49 | + * These include the connectors between the full ports that represent the |
| 50 | + * protocol stacks of the external interfaces. Note the connectors between |
| 51 | + * {@code CommandControlComputer} protocols and external systems are specified |
| 52 | + * in the {@code CommandControlSystem} block and/or the {@code HFLinkDomain} |
| 53 | + * block. |
| 54 | + * |
| 55 | + * @author ModelerOne |
| 56 | + * |
| 57 | + */ |
| 58 | +public class CommandControlComputer extends SysMLBlock |
| 59 | +{ |
| 60 | + /** |
| 61 | + * Port for the web browser hosted by the computer and used by the operator to |
| 62 | + * view controls and monitors and communicate via HTTP over UDP |
| 63 | + */ |
| 64 | + @RequirementInterfaceProtocol |
| 65 | + @FullPort |
| 66 | + public WebBrowser C2WebBrowser; |
| 67 | + /** |
| 68 | + * Port for the UDP used by the web browser to communicate with web servers on |
| 69 | + * other computers |
| 70 | + */ |
| 71 | + @RequirementInterfaceProtocol |
| 72 | + @FullPort |
| 73 | + public UDP UDP; |
| 74 | + /** |
| 75 | + * Port for IP used by UDP to communicate with UDP ports on other computers |
| 76 | + */ |
| 77 | + @RequirementInterfaceProtocol |
| 78 | + @FullPort |
| 79 | + public IP IP; |
| 80 | + /** |
| 81 | + * Port for ethernet used by IP to communicate via router with IP on other |
| 82 | + * computers |
| 83 | + */ |
| 84 | + @RequirementInterfaceProtocol |
| 85 | + @FullPort |
| 86 | + public EthernetProtocol Ethernet; |
| 87 | + |
| 88 | + /** |
| 89 | + * Port for the computer's desktop user-interface to interact with the operator |
| 90 | + */ |
| 91 | + @RequirementInterfaceProtocol |
| 92 | + @FullPort |
| 93 | + public DesktopUIServerProtocol desktop; |
| 94 | + /** |
| 95 | + * Port for the computer's physical interface (monitor, keyboard, etc.) to |
| 96 | + * interact with the operator |
| 97 | + */ |
| 98 | + @RequirementInterfaceProtocol |
| 99 | + @FullPort |
| 100 | + public PCUIServerProtocol pc; |
| 101 | + |
| 102 | + /** |
| 103 | + * Port for electrical power in |
| 104 | + */ |
| 105 | + @RequirementInterfaceProtocol |
| 106 | + @FullPort |
| 107 | + public ElectricalPowerProtocol electricPower; |
| 108 | + /** |
| 109 | + * Port for heat transfer out |
| 110 | + */ |
| 111 | + @RequirementInterfaceProtocol |
| 112 | + @FullPort |
| 113 | + public ThermalHeatTransferProtocol thermalHeat; |
| 114 | + |
| 115 | + /** |
| 116 | + * Flow of heat out |
| 117 | + */ |
| 118 | + @RequirementResource(requirementVerificationMethod = SysMLVerificationMethodKind.Test) |
| 119 | + @Flow |
| 120 | + public HeatWatts maxHeatOut; |
| 121 | + /** |
| 122 | + * Flow of power in |
| 123 | + */ |
| 124 | + @RequirementResource(requirementVerificationMethod = SysMLVerificationMethodKind.Test) |
| 125 | + @Flow |
| 126 | + public PowerWatts maxPowerIn; |
| 127 | + |
| 128 | + /** |
| 129 | + * Value for (minimum) system availability |
| 130 | + */ |
| 131 | + @RequirementReliability(requirementVerificationMethod = SysMLVerificationMethodKind.Analysis) |
| 132 | + @Value |
| 133 | + public Percent systemAvailability; |
| 134 | + /** |
| 135 | + * Value for max size of the computer |
| 136 | + */ |
| 137 | + @RequirementPhysical(requirementVerificationMethod = SysMLVerificationMethodKind.Inspection) |
| 138 | + @Value |
| 139 | + public VolumeMetersCubic maximumSize; |
| 140 | + /** |
| 141 | + * Value for max weight of the computer |
| 142 | + */ |
| 143 | + @RequirementPhysical(requirementVerificationMethod = SysMLVerificationMethodKind.Inspection) |
| 144 | + @Value |
| 145 | + public MassKilograms maximumWeight; |
| 146 | + /** |
| 147 | + * Value for max cost of the computer |
| 148 | + */ |
| 149 | + @RequirementAttribute(requirementVerificationMethod = SysMLVerificationMethodKind.Analysis) |
| 150 | + @Value |
| 151 | + public Cost$US maximumCost; |
| 152 | + |
| 153 | + /** |
| 154 | + * Value for host name of computer |
| 155 | + */ |
| 156 | + @RequirementAttribute(requirementVerificationMethod = SysMLVerificationMethodKind.Inspection) |
| 157 | + @Value |
| 158 | + public SString hostName; |
| 159 | + /** |
| 160 | + * Function to make connection of browser to UDP |
| 161 | + */ |
| 162 | + @AssociationConnectorFunction |
| 163 | + public SysMLAssociationBlockConnectorFunction webBrowserToUDPPortConnectorFunction; |
| 164 | + /** |
| 165 | + * Function to make connection of UDP to IP |
| 166 | + */ |
| 167 | + @AssociationConnectorFunction |
| 168 | + public SysMLAssociationBlockConnectorFunction udpToIPPortConnectorFunction; |
| 169 | + /** |
| 170 | + * Function to make connection of IP to ethernet |
| 171 | + */ |
| 172 | + @AssociationConnectorFunction |
| 173 | + public SysMLAssociationBlockConnectorFunction ipToEthernetPortConnectorFunction; |
| 174 | + |
| 175 | + /** |
| 176 | + * Connector to invoke function to make connection of browser to UDP |
| 177 | + */ |
| 178 | + @RequirementInterfaceProtocolConnector |
| 179 | + @AssociationConnector |
| 180 | + public SysMLAssociationBlockConnector WebBrowserToUDPPortConnector; |
| 181 | + /** |
| 182 | + * Connector to invoke function to make connection of UDP to IP |
| 183 | + */ |
| 184 | + @RequirementInterfaceProtocolConnector |
| 185 | + @AssociationConnector |
| 186 | + public SysMLAssociationBlockConnector UDPToIPPortConnector; |
| 187 | + /** |
| 188 | + * Connector to invoke function to make connection of IP to ethernet |
| 189 | + */ |
| 190 | + @RequirementInterfaceProtocolConnector |
| 191 | + @AssociationConnector |
| 192 | + public SysMLAssociationBlockConnector IPToEthernetPortConnector; |
| 193 | + |
| 194 | + /** |
| 195 | + * Function to make connection of browser to desktop |
| 196 | + */ |
| 197 | + @AssociationConnectorFunction |
| 198 | + public SysMLAssociationBlockConnectorFunction webBrowserToDesktopUIConnectorFunction; |
| 199 | + /** |
| 200 | + * Function to make connection of desktop to physical PC |
| 201 | + */ |
| 202 | + @AssociationConnectorFunction |
| 203 | + public SysMLAssociationBlockConnectorFunction desktopUIToPCUIConnectorFunction; |
| 204 | + /** |
| 205 | + * Connector to invoke function to make connection of browser to desktop |
| 206 | + */ |
| 207 | + @RequirementInterfaceProtocolConnector |
| 208 | + @AssociationConnector |
| 209 | + public SysMLAssociationBlockConnector WebBrowserToDesktopUIConnector; |
| 210 | + /** |
| 211 | + * Connector to invoke function to make connection of desktop to physical PC |
| 212 | + */ |
| 213 | + @RequirementInterfaceProtocolConnector |
| 214 | + @AssociationConnector |
| 215 | + public SysMLAssociationBlockConnector DesktopUIToPCUIConnector; |
| 216 | + |
| 217 | + /** |
| 218 | + * Constructor |
| 219 | + */ |
| 220 | + public CommandControlComputer() |
| 221 | + { |
| 222 | + super(); |
| 223 | + } |
| 224 | + |
| 225 | + @Override |
| 226 | + public void start() |
| 227 | + { |
| 228 | + C2WebBrowser.start(); |
| 229 | + Ethernet.start(); |
| 230 | + } |
| 231 | + |
| 232 | + @Override |
| 233 | + public void stop() |
| 234 | + { |
| 235 | + C2WebBrowser.stop(); |
| 236 | + Ethernet.stop(); |
| 237 | + } |
| 238 | + |
| 239 | + @Override |
| 240 | + protected void createValues() |
| 241 | + { |
| 242 | + systemAvailability = new Percent(99.99); |
| 243 | + maximumSize = new VolumeMetersCubic(0.1); |
| 244 | + maximumWeight = new MassKilograms(9.5); |
| 245 | + maximumCost = new Cost$US(10_000); |
| 246 | + hostName = new SString("hostname"); //Set after construction by domain |
| 247 | + } |
| 248 | + |
| 249 | + @Override |
| 250 | + protected void createFlows() |
| 251 | + { |
| 252 | + maxPowerIn = new PowerWatts(500); |
| 253 | + maxHeatOut = new HeatWatts(500); |
| 254 | + } |
| 255 | + |
| 256 | + @Override |
| 257 | + protected void createFullPorts() |
| 258 | + { |
| 259 | + C2WebBrowser = new WebBrowser(this, 0L); |
| 260 | + UDP = new UDP(this, 0L); |
| 261 | + IP = new IP(this, 0L); |
| 262 | + Ethernet = new EthernetProtocol(this, 0L); |
| 263 | + desktop = new DesktopUIServerProtocol(this, 0L); |
| 264 | + pc = new PCUIServerProtocol(this, 0L); |
| 265 | + |
| 266 | + electricPower = new ElectricalPowerProtocol(this, 0L); |
| 267 | + thermalHeat = new ThermalHeatTransferProtocol(this, 0L); |
| 268 | + } |
| 269 | + |
| 270 | + @Override |
| 271 | + protected void createConnectorFunctions() |
| 272 | + { |
| 273 | + webBrowserToDesktopUIConnectorFunction = () -> |
| 274 | + { |
| 275 | + C2WebBrowser.application.addConnectedPortServer(desktop); |
| 276 | + desktop.addConnectedPortClient(C2WebBrowser.application); |
| 277 | + }; |
| 278 | + desktopUIToPCUIConnectorFunction = () -> |
| 279 | + { |
| 280 | + desktop.addConnectedPortServer(pc); |
| 281 | + pc.addConnectedPortClient(desktop); |
| 282 | + }; |
| 283 | + webBrowserToUDPPortConnectorFunction = () -> |
| 284 | + { |
| 285 | + C2WebBrowser.WebBrowserHTTP.addConnectedPortServer(UDP); |
| 286 | + UDP.addConnectedPortClient(C2WebBrowser.WebBrowserHTTP); |
| 287 | + }; |
| 288 | + udpToIPPortConnectorFunction = () -> |
| 289 | + { |
| 290 | + UDP.addConnectedPortServer(IP); |
| 291 | + IP.addConnectedPortClient(UDP); |
| 292 | + }; |
| 293 | + ipToEthernetPortConnectorFunction = () -> |
| 294 | + { |
| 295 | + IP.addConnectedPortServer(Ethernet); |
| 296 | + Ethernet.addConnectedPortClient(IP); |
| 297 | + }; |
| 298 | + } |
| 299 | + |
| 300 | + @Override |
| 301 | + protected void createConnectors() |
| 302 | + { |
| 303 | + WebBrowserToUDPPortConnector = new SysMLAssociationBlockConnector(C2WebBrowser, UDP, webBrowserToUDPPortConnectorFunction); |
| 304 | + UDPToIPPortConnector = new SysMLAssociationBlockConnector(UDP, IP, udpToIPPortConnectorFunction); |
| 305 | + IPToEthernetPortConnector = new SysMLAssociationBlockConnector(IP, Ethernet, ipToEthernetPortConnectorFunction); |
| 306 | + WebBrowserToDesktopUIConnector = new SysMLAssociationBlockConnector(C2WebBrowser, desktop, webBrowserToDesktopUIConnectorFunction); |
| 307 | + DesktopUIToPCUIConnector = new SysMLAssociationBlockConnector(desktop, pc, desktopUIToPCUIConnectorFunction); |
| 308 | + } |
| 309 | +} |
0 commit comments