Book a Demo

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - fishy

Pages: [1]
1
I have noticed that when I have ports with multiple flow properties or complex structures - e.g. those typed with blocks containing multiple/nested properties (such as SysPhS interfaceBlocks) - the shapes that represent those properties do not always retain their position and dimensions on a Parametric diagram when the diagram is closed and re-opened.
Since it can take a lot of time to lay out a parametric diagram neatly, it's extremely frustrating to close the diagram, re-open it and then find that several things have moved or re-sized!
The underlying issue has something to do with the relative sizes of the shapes and the text they contain.   It appeas that a shape will re-size if the manually set size doesn't allow a sufficient margin around the text.   The same appears to be true of shapes containing other shapes - e.g. a block type containing properties, which itself is contained within a port on the boundary/frame of a parametric diagram:  if there is insufficient margin between a shape and the boundaries of the shapes it contains, then the containing shape may re-size or relocate.

As a supplementary observation, it's really frustrating that the resizing behaviour of ports and the shapes they contain is different:
  • the outer boundary of the port shape exhibits horizontal and vertical symmetry.   When you resize it, it's anchored in place by it's centre
  • any shapes (flow properties/type blocks) contained within the port do not anchor in the same way, meaning that they have to be manually positioned in the horizontal centre of the port.

2
General Board / Re: Modelica Library integration with EA/SysML/SysPhS
« on: November 28, 2025, 02:00:37 am »
An update on what I'm learning by experimentation:
Analogues of the Modelica block structures need to be set up in EA:   Blocks, contianing properties to represent Modelica parameters, and ports.
  • For blocks, stereotype them as ModelicaBlock and set the ModelicaBlock.Name property to the full classpath of the Modelica element you want to 'wrap'.   For example:  Modelica.Fluids.Pipes.StaticPipe for a block that calculates flow through a pipe
  • For properties, stereotype them as ModelicaParameter.   Use the ModelicaParameter.Name property to match the name of the parameter instance within the Modelica block - for example length or diameter as constant properties of the pipe.   That allows you to set a completely arbitrary name as the SysML parameter name if you want to - e.g. use d for diameter, or L for length.   If you don't use ModelicaParameter.Name, or don't apply the ModelicaParameter stereotyope, then the SysML name field must match the Modelica instance name exactly.
  • For ports, similar to parameters, use ModelicaPort and ModelicaPort.Name to match the interface name used by the Modelica block - e.g. port_a or port_b on a pipe.

One clear problem arises, which I can't see a workaround for:  If you stereotype a propery as both ModelicaParameter and PhSVariable, the SysMLSimConfiguration ignores this, and lists the property as a PhSConstant.   This means that the property then isn't available to choose as a plottable value, and as a consequence I can't see a way to extract varibles calculated by Modelica (e.g. flow through a pipe, or water level in a tank) and plot it from EA.

Another clear problem is the setting of typed Modelica properties via SysML parameters - e.g. specifying a Medium used in a flow calculation, such as water.   There isn't any easy way to do this as Modelica requires you to redeclare types that don't match the base class that a block is expecting.   For example, Modelica.Fluid.Vessels.OpenTank expects a Medium of type Modelica.Media.Interfaces.PartialMedum.   But the modelica object Modelica.Media.Water.StandardWater isn't of this type.   Setting Medium = 'redeclare package Medium = Modelica.Media.Water.StandardWater' as the EA initial value doesn't work - you still get the error:

Quote
Error: component tank1 contains the definition of a partial class Medium. (Expression: Modelica.Fluid.Vessels.OpenTank tank1(T_ambient=20,crossArea=1,height=3,p_ambient=101325) annotation(Documentation(info = ""), Placement(visible = true, transformation( origin = {-357, 30}, extent = {{0, 0}, { 152, 141}})));  ")"
Please redeclare it to any package compatible with Modelica.Media.Interfaces.PartialMedium.

3
General Board / Modelica Library integration with EA/SysML/SysPhS
« on: November 20, 2025, 01:51:24 am »
Hi,
I am modeling a system that involves flows of multicomponent liquids.   I have managed to build and simulate simple models for single component fluid flow using the SysPhS library to generate blocks representing tanks, pipes, motors and pumps and SysMLSim Configurations to drive OpenModelica.
However, there is already a large library of active and passive components in the OpenModelica library.   I am trying to understand how to build blocks that can leverage that library, rather than re-create all the complex parametric models they contain from scratch in EA.   Really I just want SysML blocks that 'wrap' Modelica blocks, reproduce the properties/parameters and ports, but leave the underlying maths/parametrics to Modelica.
There are some simple examples on Sparx's website and YouTube showing how to use ModelicaBlocks from the SysPhS library as "pointers" Modelica Library items, but this looks at an electronics example using JK FlipFlops, and stops short of explaining how to setup all the constants, variables and ports defined on more sophisticated, non-electrical Library components, where some of the interfaces may be more complex than the templates available in the SysPhS library.   Has anyone done this, or can point me to a tutorial...?   I am particularly interested in Fluid components in the first instance.
Thanks,

Pages: [1]