modelica-3rdparty / PowerSystems

Free (standard conform) library that is intended to model electrical power systems at different levels of detail both in transient and steady-state mode.
65 stars 36 forks source link

Unit of measure of PVImeter quantities #22

Closed ceraolo closed 7 years ago

ceraolo commented 7 years ago

The model AC3ph.Sensors.PVImeter allows the variables it measures to be computed either in p.u. or S.I. units. Consider visualization in S.I. (puUnits=false). It works well, but quantities are plotted their units are shown as the quantities were p.u. Consider for instance Examples.Spot.AC3ph.Breaker, run with puUnits=false. Near the end of transient meter.v[1] is 1.0e4. The unit on the vertical axis says "V/V", but it should be "V". The same error occurs on meter's powers and currents.

rfranke commented 7 years ago

The current treatment is the best I could find: variables are always p.u., e.g. V/V. If puUnits=false, then the values are scaled with 1V (see PowerSystems.Utilities.Precalculation) -- meaning the value is the same as in S.I., the unit remains V/V.

I wonder if there is a better solution as long as Modelica has no dedicated support for p.u.

Note that p.u. is only used for parameterization and for sensors. All internal variables are S.I. and phase systems define the display unit kV. The use of p.u. for parameterization makes sense as datasheets often do so.

The use of p.u. for sensor outputs is because sensors convert physical quantities to control signals. Control signals must generally be scaled when connecting them to controllers, e.g. not 400000 V, but 1 p. 400000 V or maybe 400 p. 400000 V, i.e. kV.

ceraolo commented 7 years ago

I suspected that what I wished was not easy to implement. I already noted that SI units is obtained in Power Systems Library by selecting nominal values equal to 1. However I added the above comment just in case someone shared the view and was better than me in finding a solution using the current Modelica specification.

What I proposed would have been possible if Modelica standard (and implemented in tools) the allowed to select a different variable type depending on the value of the flag puUnits, such as:

Boolean puUnits;
...
if puUnits ==true then
  Modelica.SIunits.Voltage V;
else
  Real V (displayUnit="V/V");
end if;

But this is not currently allowed.

I could in principle add a ticket on the modelica site, to propose to make it possible definitions of variables be conditioned to a flag such as the one above. But I'm sure this will be accepted, because of the high cost/benefit ratio. I will think about it.

rfranke commented 7 years ago

The Modelica ticket exists since a long time (8 years), see: https://trac.modelica.org/Modelica/ticket/125 The task there is to come up with a sound specification and write a Modelica Change Proposal.

Lacking support in Modelica, as said above, the use of V/V was the best compromise found for the PowerSystems library.

Please note that optional p.u. is used for parameterization and sensor outputs. Use for parameterization makes a lot of sense as electrical components are often specified in p.u. Use for sensor outputs makes sense because one might want to connect the signal to a control system that uses scaled values as well.

The internal variables are all SI -- meaning that you should plot an internal variable, like the voltage in the terminal, if you want to see SI.

rfranke commented 7 years ago

Commit 545c30ef391ccd8ab415fdd0f0aff87051dfe80f improves readability of p.u. unit strings, like Ohm/Ohm instead of Ohm/(V.V/VA).