-
Notifications
You must be signed in to change notification settings - Fork 3
HelloWorldTutorial
mitchell-conrad edited this page Jan 19, 2021
·
1 revision
This tutorial will guide the user in creating a basic HelloWorld model. The model consists of a Sender and a Receiver component and prints out the contents of the message received.
A complete version of the tutorial model can be found here: File:HelloWorldTutorialModel.graphml.
- Select "New Project" from the welcome screen when MEDEA starts up
- Go to the Model menu and select "Select Model"
- Using the Data Table to the right, change the model's label to "HelloWorld"
- All available data fields for each entity can be edited using the Data Table (unless they are locked)
- Maximise the Interfaces aspect using the button in the top right hand corner of the aspect's title bar
- Using the parts dock to the left, add an Aggregate entity
- Select the Aggregate entity and change its label to "Message"
- This can be done by double clicking on either the label of the item on the canvas, or "label" field in the Data Table to the right
- Add three Member entities in the Aggregate labelled "Message"
- This can be done by one of the following methods:
- Selecting the Member entity from the parts dock to the left
- Clicking the plus button within the Aggregate entity in the canvas and selecting Member from the menu
- Right-clicking on the Aggregate entity, selecting "Add Node", and then selecting Member from the menu
- This can be done by one of the following methods:
- Change the Member labels to "instName", "messageID" and "content" respectively
- Select the Member labelled "instName" and change the "key" field in the Data Table to "True"
- Select the member labelled "messageID" and change the "type" field in the Data Table to "Integer"
- The default value for "type" in a Member is "String"
- Select the Interfaces aspect and add two Components labelled "HelloSender" and "HelloReceiver"
- Select the Component labelled "HelloSender" then do the following:
- Add an Attribute entity labelled "message"
- Add a Publisher Port entity labelled "greeting"
- When adding a Publisher Port or a Subscriber Port from both the Dock and the right-click menu, a menu will appear displaying a list of Aggregate types the port can use. In this case select the only option - "Message"
- Select the Component labelled "HelloReceiver" then do the following:
- Add a Subscriber Port using the Aggregate labelled "Message" in the same way as the Publisher Port
- Set the label of the Subscriber Port to "greeting"
- Entities can be expanded/contracted to hide children entities by double-clicking on their icon
- Contract the currently visible aspect (Interfaces aspect) using the button in the top right hand corner of the aspect's title bar
- The View Manager tool on the right, can also be used to hide and show aspects and tool panels in MEDEA
- Maximise the Behaviour aspect
- Here there should be two ComponentImpl entities labelled "HelloSender" and "HelloReceiver"
- Creating Component entities in the Interfacaces aspect automatically create their corresponding ComponentImpl entities in the Behaviour aspect
- Feel free to move the entities around so that they are layed out nicely
- You can also pan the aspects by pressing and holding the right mouse button and then moving it around
- Here there should be two ComponentImpl entities labelled "HelloSender" and "HelloReceiver"
- Select the ComponentImpl labelled "HelloSender"
- Add a Periodic Port labelled "tick"
- Add a Variable labelled "count" set its "value" field to "0"
- Add a ClassInstance of "Component_Info"
- Select this Variable then add a Member entity
- Select the Member and set its "type" to "Integer"
- Select the Periodic Port labelled "tick" and using either the dock or the Workflow button within the entity, add the FunctionCall "Get Name"
- Add a Publisher Port Impl
- Click and drag from the Data Edge on the right edge of the MemberInstance labelled "Label" inside "Get Name" and drag the edge onto the MemberInstance "instName" inside the "tick" > "greeting" > "Message"
- Clicking and dragging on Data Edges will highlight all the entities that you can connect the clicked entity to
- Connect the Variable labelled "count" to "greeting" > "Message" > "messageID"
- Connect the Attribute labelled "message" to "greeting" > "Message" > "content"
- Select the ComponentImpl labelled "HelloSender" then add a Setter entity
- Inside the Setter, select the InputParameter and set its "label" field to "+="
- Select the InputParameter labelled "rhs" and set its"value" field to "1"
- Connect the Variable "count" to the Setter > "lhs"
- Select the ComponentImpl labelled "HelloReceiver" then add a ClassInstance of "Utility_Worker"
- Select the SubscriberPortImpl labelled "greeting" then add a FunctionCall called "Log"
- Select the MemberInstance labelled "Message Format" and set its "value" field to "Received Message[%i] from '%s' = '%s'" (Note - include the double quotes)
- Select the InputParamterGroupInstance labelled "Input Parameters" and then add three Optional Parameters
- Connect the Optional Parameters to the following MemberInstances inside the "Message" AggregateInstance in this order:
- "messageID"
- "instName"
- "content"
- Select "Verbosity" inside the Input Parameters in "Log" and set it to "1"
- Maximize the Assemblies aspect
- Add a ComponentAssembly labelled "HelloWorld_Asm"
- Select the ComponentAssembly labelled "HelloWorld_Asm" then add a ComponentInstance using the following:
- Right-click "HelloWorld_Asm"
- Select "Add Node" from the menu
- Select "ComponentInstance" > "HelloSender"
- Set the ComponentInstance's label to "Sender"
- Using the same method, add another ComponentInstance labelled "Receiver"
- Select the AttributeInstance labelled "instName" inside the ComponentInstance labelled "Sender" and set its "value" field to "Sender"
- Select the AttributeInstance labelled "message" inside the ComponentInstance labelled "Sender" and set its "value" field to "Hello World!"
- Select the AttributeInstance labelled "Frequency" inside the PeriodicPortInstance labelled "tick", and set its "value" field to "1"
- Select the PublisherPortInstance labelled "greeting" inside the ComponentInstance labelled "Sender" connect it using the following:
- Click on the Assembly Edge on the right edge of "greeting"
- This will display a list of SubscriberPortInstances that the selected PublisherPortInstance can connect to
- Select the SubscriberPortInstance that you want to connect to; in this case there's only one option - "greeting"
- Click on the Assembly Edge on the right edge of "greeting"
- Show the Assemblies and Hardware aspects next to each other
- Go to the Jenkins menu and select "Import Jenkins Nodes"
- This requires a valid Jenkins Settings
- This will load in the HardwareNode entities available to deploy ComponentInstance entities to
- A notification will appear displaying that the request is in progress
- The notification will then either display a green or red icon based on the success of the import
- In the Assemblies aspect, select the "Sender" ComponentInstance
- Click on its Deployment Edge on its top right edge, to display the list of HardwareNodes it can connect to
- ComponentInstance entites can be deployed using either the hardware dock, the right-click menu or its Deployment Edge
- ComponentAssembly entities can also be deployed, which will deploy any of its un-deployed children to the selected HardwareNode
- If the ComponentInstance/ComponentAssembly is already connected and you want to change where it's connected to, you will need to disconnect it first in the same way as connecting it
- Likewise, deploy the "Receiver" ComponentInstance to a different HardwareNode
- Go to the File menu and and select "Save Project"
- Save the project as "HelloWorld.graphml"
- Deploying Using Jenkins
Generated on 11 Feb 2021 @ 17:34:14 by Jenkins - MediaWiki2GitHubWiki
- Model Entities
- Loading and Saving Projects
- Modelling Quality of Service
- Workers
- Validation and Code Generation Functionality
- Jenkins Functionality
- Logging Functionality
- Toolbars
- Data Table
- Dock
- Search
- Notification Manager
- View Manager
- Settings
- App Shortcuts
- Code Editor
- Code Browser
- Execution Monitor
- QoS Browser
- Trigger Browser



































