CAPE-OPEN Forum Index
RegisterSearchFAQMemberlistUsergroupsfChatLog in
Reply to topic Page 1 of 1
I am still using J++ to develop COM objects
Author Message
Reply with quote
Post I am still using J++ to develop COM objects 
In 2000, I developped a simulation library in J++ (mainly an hobby).
I chose the Miscrosoft brand of java, J++, because it was at that time the most efficient way I found to develop COM objects with a nice language.
Unfortunately J++ was short lived, but I am still using it from time to time.

In 2000, CAPE-OPEN seemed too difficult for me to implement and I used a simpler approach.
Today my interrest for this topic is revived.
I was quite happy to discover how CAPE-OPEN has evolved, specially by the tools made available.
I would like to revamp my toys, based on CAPE-OPEN.

Which way would you suggest me?
Did some of you use J++ or java in the past?

Thanks

View user's profile Send private message
Reply with quote
Post  
I have no experience with J++. Can you be more specific about what is not clear?

Generally you will need to import the CAPE-OPEN IDL, and then create a new COM class that implements the unit operation interfaces (ICapeUnit, ICapeIdentification, Error interfaces, etc, see http://www.cocosimulator.org/index_support.html for more information). This COM class will need some additional classes such as parameters and ports as well.

If you have a whole library of J++ unit operation, and you can access them in a uniform way, you could consider writing a single (C++, J++ or other) CAPE-OPEN unit operation in which you select (as a parameter) which of your models to use. A single unit operation implementation that is the glue between your library and CAPE-OPEN...

View user's profile Send private message Send e-mail Visit poster's website
Reply with quote
Post  
jasper,

My concern is mainly about the "learning curve".
Given my experience and the time available (as a hobby mainly), how could I best do it?

Yesterday evening I had a quick look at the USEPA Class Library.
It looks like I could be operational very fast on that side, but I would have "more work".
The provided example was particularly useful as it shows me what I have to do at the least.

Another option that your answer suggests would be to stay in J++ as long as J++ can be used (it is not supported anymore).
Then indeed, I should simply stay in my usual environment and add some glue code.
Would there be some samples or templates available to learn the minimum stuff I should implement?
Samples in VB6 would be ok, as it maps easily to j++.

A specific question is about streams, units and ports
To simplify my life I had decided not to define ports in my application.
Streams are simply pre-defined members of unit classes.
They are even not collected in a collection, but they can be identified by looking at the types.
The units can only work with the specified streams.
It is not clear for me if this can be translated to CAPE-OPEN.
... and anyway, if I could translate it within java/COM it would be easier.

One more question is about the PME.
I have defined an extremely simple flowsheet class. (I use it directly from MS-Excel which is my PME!)
The solver is very rudimentary but suits me well: a direct substitution solver.
(there are many recycles, but they are "weak" and substitution converges very well, usually)
Using COCO would offer me an opportunity to solve more complicated problems.
But, I would also like to implement a better solver for my use within MS-Excel.
Here J++ makes a problem because very few (free) numerical codes have been translated to java.
(and translations are sometimes very difficults because java does not support goto's)
Again, I have to think about the way to switch to CAPE-OPEN: the J++ track or another one?

Let me note finally that my application is made of about 50 tiny unit classes and 5 tiny stream classes.
The most complicated objects use a few hundred tiny objects in "counter current".
Yet the whole thing calculates in a few seconds.

Thanks for your suggestions.

View user's profile Send private message
Reply with quote
Post  
Quote:
Would there be some samples or templates available to learn the minimum stuff I should implement?
Samples in VB6 would be ok, as it maps easily to j++.


See http://www.cocosimulator.org/index_support.html; section "How to I add user defined unit operations?", first example contains VB code.

Quote:
To simplify my life I had decided not to define ports in my application.
Streams are simply pre-defined members of unit classes.


In CAPE-OPEN terms: ports are the connection points of the unit operation. To this, the simulation environment will connect a Material Object (if it is a material port). The Material Object is what you should think of as the stream in the flowsheet. You do not define it, the simulation environment does. You will just see that they get connected to your ports.

Quote:
The units can only work with the specified streams.
It is not clear for me if this can be translated to CAPE-OPEN.


It seems to me that you want to define a port for each 'stream' of your unit operation class. Then at
Code:
ICapeUnit::Validate
, you make sure that the unit will not run if not all ports are connected (and it would be wise to check things like: are the connected material objects of the same type, e.g. do they have the same list of compounds). At
Code:
ICapeUnit::Calculate
you can get the input values from the material objects connected to the inlet ports, and you must specify flow, overall composition and two more variables for the materials connected to the outlet ports, and then perform a flash for the materials connected to the outlet ports.

Quote:
Again, I have to think about the way to switch to CAPE-OPEN: the J++ track or another one?


I cannot advise you there; this is a personal choice. Generally it is possible to mix languages as well, in case of Java it would be possible to compile C++ solvers (e.g. the Sundials solvers) and call them via JNI.

View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:
Reply to topic Page 1 of 1


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum