It might be that I don't know enough about what you are modeling, but it seems to me that an output of a specific block would be either dimensionless, a rate or time, and for a specific block you don't really want to change it?
In the package below I have demonstrated some ways to set units in the GUI, and the model Test shows all four of them.
The block Item has an output that is something, e.g. "orange". What this is is set by the constant itemUnit, which shows up in the GUI in the "General" tab in the group "Units" (this is set by the annotation following the declaration of itemUnit).
The block Rate has an output that is a rate of something, e.g. "apple/s". You can set what "X" in "X/s" through the"rateUnit constant, which also shows up in the GUI. Here I have also set a displayUnit to be "X/h", but since we don't have the feature described in my last post, SimulationCenter won't be able to display in "X/h" unless X is 1.
In the block Generic I have done something like what you described. The block output has a unit that is either "1", "s" or "1/s", and this can be chosen with a drop-down list. The drop-down list is created from the choices
part of the annotation after the declaration of the output, each which has a part that is the modification to be applied (e.g. "= 1/s") and a description of what it is (e.g. "rate"). The description is what is shown in the drop-down menu.
Finally, in the block GenericWithX you can specify both a base unit (e.g. "banana" or "second") and specify it is a rate or not.
Concerning your PS, yes, that would in principle be what it would do; read "X/s", then use for example,the rule for "1/s" -> "1/year" to convert to "X/year".
package UnitsAndRates
model Test
Item item1(itemUnit = "apple") annotation(Placement(visible = true, transformation(origin = {-30, 57.954}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Rate rate1(rateUnit = "orange") annotation(Placement(visible = true, transformation(origin = {-10, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Generic generic1(genericUnit = "1/s") annotation(Placement(visible = true, transformation(origin = {-65, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
GenericWithX genericWithX1(base = "banana") annotation(Placement(visible = true, transformation(origin = {50, -2.046}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
GenericWithX genericWithX2(base = "kiwi", rate = "/s") annotation(Placement(visible = true, transformation(origin = {30, -62.465}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, extent = {{-100, -100}, {100, 100}}, radius = 25), Text(visible = true, textColor = {64, 64, 64}, extent = {{-150, 110}, {150, 150}}, textString = "%name")}));
end Test;
block Rate
constant String rateUnit = "1" annotation(Dialog(group = "Units"));
Modelica.Blocks.Interfaces.RealOutput y(unit = rateUnit + "/s", displayUnit = rateUnit + "/h") annotation(Placement(visible = true, transformation(origin = {155, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {101.511, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
y = 1 + cos(sin(time));
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, -100}, {100, 100}}), Text(visible = true, textColor = {64, 64, 64}, extent = {{-150, 110}, {150, 150}}, textString = "%name"), Text(visible = true, origin = {-0, 3.332}, extent = {{-100, -46.668}, {100, 46.668}}, textString = "Rate")}));
end Rate;
block Item
constant String itemUnit = "1" annotation(Dialog(group = "Units"));
Modelica.Blocks.Interfaces.RealOutput y(unit = itemUnit, displayUnit = itemUnit) annotation(Placement(visible = true, transformation(origin = {153.595, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {102.397, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
y = 1 + cos(sin(time));
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, extent = {{-100, -100}, {100, 100}}, radius = 25), Text(visible = true, textColor = {64, 64, 64}, extent = {{-150, 110}, {150, 150}}, textString = "%name"), Text(visible = true, extent = {{-100, -40}, {100, 40}}, textString = "Item")}));
end Item;
block Generic
constant String genericUnit = "1" annotation(Dialog(group = "units"), choices(choice = "1" "dimensionless", choice = "s" "time", choice = "1/s" "rate"));
Modelica.Blocks.Interfaces.RealOutput y(unit = genericUnit) annotation(Placement(visible = true, transformation(origin = {155, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {103.333, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
y = 1 + sin(cos(sin(time)));
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, -100}, {100, 100}}), Text(visible = true, textColor = {64, 64, 64}, extent = {{-150, 110}, {150, 150}}, textString = "%name")}));
end Generic;
block GenericWithX
constant String base = "1" annotation(Dialog(group = units));
constant String rate = "" annotation(Dialog(group = units), choices(choice = "" "not rate", choice = "/s" "rate"));
Modelica.Blocks.Interfaces.RealOutput y(unit = base + rate) annotation(Placement(visible = true, transformation(origin = {156.679, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {101.922, -2.301}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
y = 1 + sin(sin(time));
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Rectangle(visible = true, lineColor = {0, 114, 195}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, -100}, {100, 100}}), Text(visible = true, textColor = {64, 64, 64}, extent = {{-150, 110}, {150, 150}}, textString = "%name"), Text(visible = true, origin = {1.009, 0.32}, extent = {{-101.009, -99.68}, {101.009, 99.68}}, textString = "X")}));
end GenericWithX;
annotation(Diagram(coordinateSystem(extent = {{-150, -90}, {150, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {5, 5})), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {10, 10}), graphics = {Polygon(visible = true, origin = {0.248, 0.044}, lineColor = {56, 56, 56}, fillColor = {128, 202, 255}, fillPattern = FillPattern.Solid, points = {{99.752, 100}, {99.752, 59.956}, {99.752, -50}, {100, -100}, {49.752, -100}, {-19.752, -100.044}, {-100.248, -100}, {-100.248, -50}, {-90.248, 29.956}, {-90.248, 79.956}, {-40.248, 79.956}, {-20.138, 79.813}, {-0.248, 79.956}, {19.752, 99.956}, {39.752, 99.956}, {59.752, 99.956}}, smooth = Smooth.Bezier), Polygon(visible = true, origin = {0, -13.079}, lineColor = {192, 192, 192}, fillColor = {255, 255, 255}, pattern = LinePattern.None, fillPattern = FillPattern.HorizontalCylinder, points = {{100, -86.921}, {50, -86.921}, {-50, -86.921}, {-100, -86.921}, {-100, -36.921}, {-100, 53.079}, {-100, 103.079}, {-50, 103.079}, {0, 103.079}, {20, 83.079}, {50, 83.079}, {100, 83.079}, {100, 33.079}, {100, -36.921}}, smooth = Smooth.Bezier), Rectangle(visible = true, origin = {0, -5}, lineColor = {198, 198, 198}, fillColor = {238, 238, 238}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, extent = {{-100, -25}, {100, 25}}), Polygon(visible = true, origin = {-0, -10.704}, lineColor = {113, 113, 113}, fillColor = {255, 255, 255}, points = {{100, -89.296}, {50, -89.296}, {-50, -89.296}, {-100, -89.296}, {-100, -39.296}, {-100, 50.704}, {-100, 100.704}, {-50, 100.704}, {0, 100.704}, {20, 80.704}, {50, 80.704}, {100, 80.704}, {100, 30.704}, {100, -39.296}}, smooth = Smooth.Bezier)}));
end UnitsAndRates;