-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update bus load analysis internal model to use ecore #2555
Comments
Created a new model busload.ecore. This uses a new generic element that created in analysis.ecore. The analysis.ecore model will eventually be moved to a new project/plugin. Need to create some infrastructure for traversing the EMF model. Trying to think about what Anna is going to need for the other Resource analyses and to figure out what is the generic way of doing things. |
Some comments on this: MutabilityWhen implementing the analysis model using plain-old Java classes (POJC) I am able to make fields Model TraversalFor some inexplicable reason, EMF does not provide any way to control the traversal of Ecore models. It does not have a proper visitor pattern. As far as I can tell you are expected to use Busload analysis needs a post order traversal to compute the loads. So I need to make my own machinery to do this. This seems wasteful, but there is no way around it. To this end I have the A side-effect of the clunkiness of using a This adds unnecessary clunkiness to the implementation, and I would argue unnecessary junk into the analysis model. Switch return valuesThe A cleaner approach, I supposed, would be to introduce a new enumeration:
and return |
@lwrage Pointed out that the above comment sounds like I was against using EMF. I was just trying to document how it forces a different way of doing things. Of course, the advantage of using EMF, is it provides uniformity across the analyses and with the main AADL models. I haven't tested the my EMF version of the bus load analysis yet. Should be able to do so shortly. My main complaint against EMF is with the model traversal and So after I finish testing the new EMF version, I am going to make a third version, that also uses EMF, but instead of using visitors or Then we will have 3 implementations of the same analysis and be able to make some informed decisions about how to proceed in general. |
More notes:
|
Had to fiddle with the order of the reference declarations in |
Reg tests now pass. I didn't any actual coding errors (that I have discovered yet). All the problems were from EMF meta modeling. :-( |
Okay, so I have the first working version: Ecore/EMF using iteration and |
Going to make 2 more versions:
|
Created branch |
Created alternate version of POJO traversal. No visitor. Instead each model class has an (Branch
Advantages:
Disadvantages
Other commentsUsing this traversal approach with Ecore/EMF would have the same problems. Realized when working on the next version ( Had to add
This raises interesting semantic problems below for |
Going to try a new approach: Visitor with pre and postfix method where the visit methods take a state parameter. I think this may be the best of both worlds, and is extendable to use with Ecore/EMF. This will be on branch |
Comments on version in This turned out to be harder to do than I thought. This is because Java's generic types don't work out nicely for it. To be completely type safe we need to declare the types using Generic Self types, which are not supported by Java. They can be approximated, but it causes a lot of problems. More details on this below when I discuss the realized implementation. So this version has to make use of some type casting, but most of it is relegated to the "boiler plate" template code used to callback to the model visitor. The point of this version was to try to move all the analysis code back into a single visitor class that handles both the prefix and postfix traversal of the model, this is in contradistinction to
I was able to do this successfully, but the abstraction is a little more complicated than just "handle the prefix case" and "handle the postfix case". As described in a previous comment, I realized that I had been passing down the
So what we actually have are three phases to a node:
Here we see the first place a cast is required. The visitor needs to be cast to the specific type of visitor expected for the overall model. This required in the implementation of The semantics of this method are that any state updates that do no depend on the specifics of a child node are made and returned. (How? See below.).
So, the prefix method needs to return a state and a lamda. This is done by returning a An example of how this works in practice is the prefix method for
First the data overhead is updated by getting the local overhead contribution. It is added to the existing overhead (the call to These are bundled up into a single
Here we also see that each node is also expected to implement a Overall, the results are successful in that the analysis can be expressed in a single visitor:
Because this visitor is now located separate from the model classes themselves, the helper methods, e.g. The downside here is the craziness in the prefix methods. This can be avoided if I instead add another abstract method to |
Created branch from |
Summary of different version of the BusLoad Analysis:
|
For reasons that will detailed later, it seems the An example of where this is a problem is with Going to try one final version where I use EMF adapters to handle the state used visitation. Started branch |
Actually, not going to use the EMF Adapters because they are too heavy weight. In particular, I don't care about the notification aspect of them. Even worse, because they become connected to the original For my purposes, I think it is best just to use a regular Java |
Question: What should be and should not be attributes in the analysis model?
I think this decision is a little bit fuzzy, but values that are clearly related to the core purpose of the model, in this case representing the data capacity and usage of the system, should/could be actual attributes in the model. In this case that means overhead, actual, and budget. You could argue that budget doesn't need to be in the model because it can be obtained by a property association just like capacity. But in this case, budget is used both by the local node and by its parent node. Storing it saved the trouble of looking it up a second time. I could see not including budget as an attribute, but I think it should remain to avoid the ugliness of looking up the property association twice, which is expensive. I don't see a good reason for the |
After much experimentation as detailed in the above wiki page, I have decided that using ECORE EMF is the best approach. I have cleaned up the branch |
Created a tag Summary of different version of the BusLoad Analysis:
|
Set the "Update Classpath" property to "false" on |
Closed by merging PR #2572 (issue wasn't linked to PR). |
After discussion of general analysis implementation issues with @lwrage we decided that the internal models should be based on Ecore for uniformity with the rest of OSATE.
The model used by Bus Load analysis needs to be converted to Ecore.
The text was updated successfully, but these errors were encountered: