Skip to content

Deep Modifications #9

@xogeny

Description

@xogeny

I've come across several cases where "deep modifications" are used. An example would be this fragment from OpenHydraulics.Circuits.PressureCompensated:

OpenHydraulics.Components.Valves.DirectionalValves.V4_3CC v4_3CC(
  portA(p(start=101325, fixed=true)),
  portB(p(start=101325, fixed=false)),
  portP(p(start=101325)),
  P2A(table=[0,0; 1,1]),
  B2T(table=[0,0; 1,1]),
  P2B(table=[-1,1; 0,0; 1,0]),
  A2T(table=[-1,1; 0,0]));

A better approach would be to "propagate" the parameters like portA.p.start and P2A.table up one level. This has two advantages. First, it adds those parameters to the dialog for V4_3CC (and potentially others, depending on where in the inheritance tree they the parameters are introduced) and it avoids having to remember how to make these deep modifications each time you create a new instance of V4_3CC. Otherwise, users have to do something like "Show Component" in Dymola and explore the whole hierarchy for these important parameters.

Ideally, the above code should really look like:

OpenHydraulics.Components.Valves.DirectionalValves.V4_3CC v4_3CC(
  p_A=101325, p_A_fixed=true,
  p_B=101325, p_B_fixed=false,
  p_P=101325,
  P2A_table=[0,0; 1,1],
  B2T_table=[0,0; 1,1],
  P2B_table=[-1,1; 0,0; 1,0],
  A2T_table=[-1,1; 0,0]);

Of course, these should be organized into tabs and groups.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions