-
Notifications
You must be signed in to change notification settings - Fork 29
Description
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.