Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please write proper unit in PI-timeseries export (applies to version 2.3 and higher) #1130

Open
SGeeversAtVortech opened this issue Jan 22, 2020 · 2 comments

Comments

@SGeeversAtVortech
Copy link
Contributor

In GitLab by @gijsber on Jan 22, 2020, 09:40

Currently pi_mixin writes unit_unknown in the timeseries header during export.

please write a proper unit if known based on the SI specification as used in the Modlica model.
Currently both flow and volume, typically expressed in m3/s and m3, have the same unit_unknown, which gives trouble on the Fews-side when I have to convert this to ML/day (multiply by 86.4) vs. ML (multiply by 0.01)

Please fix in version 2.3 and higher

@SGeeversAtVortech
Copy link
Contributor Author

In GitLab by @gijsber on Jan 22, 2020, 14:49

This is rather problematic as pymoca does not parse all this Modelica SI-units stuff.
Three solutions could be envisioned:

  1. extend pymoca to deal with it (= lot's of work)
  2. extend rtcDataConfig with a unit field
  3. for optimization:
  • the pi.post() function retrieves a unit from the timeseries_import dict unless the unit is specified at during a set_timeseries operation.
    including your result timeseries as part of the timeseries_import ensures that the proper header info including unit is utilized
  1. for simulation, inclusion of the result timeseries as part of timeseries_import creates a warning and computation failure as the code currently handles all those series as input and it cannot deal with the nan's specified. the solution is:
  • in the post() function of the script, add the following before calling super().post():

      extra_units = {}
    
      for var in self.get_output_variables():
          if '.Q' in var or '_Q' in var:
              extra_units[var] = 'm3/s'
          elif '.V' in var or '_V' in var:
              extra_units[var] = 'm3'
    
      for var, unit in extra_units.items():
          for alias in self.alias_relation.aliases(var):
              self.timeseries_import.set_unit(alias, unit, 0)
    

@SGeeversAtVortech
Copy link
Contributor Author

In GitLab by @rsinnige on Jan 27, 2020, 16:12

See issue #1112

SGeeversAtVortech pushed a commit that referenced this issue Oct 7, 2024
In case partial history was present, the delay expressions with missing
values were correctly logged a warning for. However, in case no history
was provided at all, these warnings were not logged due to the if-check
not catching this. This commit makes sure that warnings are logged also
in that scenario.

Closes #1130
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant