Re: Bond Graph modeling with Dia



On Thu, 14 Nov 2002, David Hoover wrote:
Hi,

Bond graphs are domain-independent diagrams that are used to model
mechanical, electrical, hydraulic, pneumatic, and thermal systems.
What is particularly appealing about bond graphs is that they are
modular, allowing component interconnection, and that computer
programs can convert them to differential equations or other forms
suitable for simulation or compensator/controller design.

At the moment, the only free software that works with bond graphs is
called mtt (mtt.sourceforge.net), and it uses xfig to draw the bond
graphs.  As you can guess from the bond graph diagram that is
attached, xfig is not the best tool.  If you move a component
(R,C,I,0,1,SE,SF,SS), xfig does not move the connecting bonds (lines
with half arrows, full arrows, and flat heads).

I believe that Dia, with perhaps little modification, could be used as
an ideal tool for bond graph design.

I tried to make a custom shape with only the number '1' inside, but it
appears that text inside shapes is not displayed.  When I did this, my
shape was invisible.  Would it be easy to make the svg text get
displayed?

There are shapes that do have text inside.  Alan is more up-to-date on the
situation.  Shouldn't be a problem.

It would be possible to place numerous anchors on the outside of the
components so that they could be connected with arrows.  The problem
with this is that if the shape is moved around, the arrows might end
up going through the center of the component.  This problem could be
solved in the following general way that could be useful for other
diagrams: The components would have a single anchor in the middle, and
all bonds (arrows/lines) would point to that single anchor.  Arrows
could have a 'gap' parameter so that arrows with this parameter
non-null would not connect their end points completely, but either
leave a gap between the arrow tip and the anchor (if the gap were
positive), or extend past the anchor (if the gap were negative).  This
way, all bonds would point to the center of components, and moving
components would still work correctly.

This came up in another context recently, and now we have a compelling
argument why it's not just a creation thing.  We already have some code
that adjusts the line length and arrow placement to account for the extent
of the arrow.  It would be possible to add such a gap there.

Just one problem I see with the gap:  How do we calculate how big it should
be?  Objects don't currently have any method that asks for intersection
points.  The closest they get is the method asking for distance from a
point -- I guess in a pinch that could be used for a binary search.  Not
pretty, but workable.

The only other change that would be necessary for basic bond graph
design would be to have an attribute that would allow one to place a
flat bar on the end of arrows, half-head arrows, and lines.  This
could be done in a general way: the line code, instead of giving a
fixed choice of different line endings as is currently done, could be
written in the following way:  Each line ending or center could have
multiple attributes that could be selected independently.  Attributes
could be:  Half head, full head, flat head, half flat head, circle,
triangle, filled triangle, diamond, filled diamond, etc.  Instead of
these being mutually exclusive, they could be combined.

That's an appealing idea.  The current arrow code is bloated with the many
built-in arrow variations and their little differences.  I certainly
wouldn't mind a more generic system.

Two things to consider in that:  Backwards compatibility and user
interface.  We must still be able to load old diagrams.  That shouldn't be
too hard, we can just keep a set of predefined arrows, though the exact
placement may change a bit when better modularization sets in.

The user interface for a modular arrow system is more interesting.  I guess
something like what's being used for fonts in the CVS head may be
applicable here.  A couple standard arrows, then a section with
user-defined arrows, then an item to pop up an editor for them.  

Internally, this would change the arrow structure.  Fortunately, very few
places use the internals of the arrow structure, so that shouldn't be too
bad. 

I was just wondering if these modifications appear to be relatively
straightforward, or not.  I think these types of enhancements could be
useful not only for bond-graph modeling, but for other diagram
editing. What do you think?

I agree that these are generally useful things.  My comments above should
give an idea of how hard it would be.  

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| Hårdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]