.. highlight:: none
#############
User's manual
#############
Introduction
------------
Aga8Calc is a service type application that takes gas composition, pressure and temperature, and returns one of the Aga8 properties.
It can return the following properties:
- CompressibilityFactor [-]
- Density [kg/m³]
- Enthalpy [J/mol]
- Entropy [J/(mol-K)]
- GibbsEnergy [J/mol]
- InternalEnergy [J/mol]
- IsentropicExponent [-]
- IsobaricHeatCapacity [J/(mol-K)]
- IsochoricHeatCapacity [J/(mol-K)]
- JouleThomsonCoefficient [K/kPa]
- MolarConcentration [mol/l]
- MolarMass [g/mol]
- SpeedOfSound [m/s]
The gas composition, pressure and temperature are read from an OPC-UA server.
The result is written back to the same OPC-UA server.
Getting Aga8Calc
----------------
The latest release version of Aga8Calc can be downloaded from:
https://github.com/equinor/Aga8Calc/releases
Installation
------------
Windows Installation
~~~~~~~~~~~~~~~~~~~~
Copy the Aga8Calc folder to ``C:\\Program Files``.
Open cmd or PowerShell as Administrator and install the service using the sc.exe utility::
PS C:\Program Files\Aga8Calc> sc.exe create Aga8CalcService binPath= "C:\Program Files\Aga8Calc\Aga8CalcService.exe" start= auto DisplayName= "Aga8 Calc Service"
PS C:\Program Files\Aga8Calc> sc.exe description Aga8CalcService "Calculates Aga8 parameters like density, molar mass, speed of sound."
PS C:\Program Files\Aga8Calc> sc.exe start Aga8CalcService
This will install and start Aga8Calc as a Windows service that starts automatically when the computer starts.
It is also possible to run Aga8Calc directly from the command line for testing::
PS C:\Program Files\Aga8Calc> .\Aga8CalcService.exe
To uninstall the Windows service, stop it first and then delete it::
PS C:\Program Files\Aga8Calc> sc.exe stop Aga8CalcService
PS C:\Program Files\Aga8Calc> sc.exe delete Aga8CalcService
This should be done before installing a new version of Aga8Calc.
Linux Installation (systemd)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copy the Aga8Calc folder to a suitable location (e.g., ``/opt/aga8calc``).
Create a systemd service unit file at ``/etc/systemd/system/aga8calc.service``::
[Unit]
Description=Aga8 Calc Service
After=network.target
[Service]
Type=notify
WorkingDirectory=/opt/aga8calc
ExecStart=/opt/aga8calc/Aga8CalcService
Restart=on-failure
RestartSec=10
KillMode=process
SyslogIdentifier=aga8calc
User=aga8calc
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
Enable and start the service::
$ sudo systemctl daemon-reload
$ sudo systemctl enable aga8calc.service
$ sudo systemctl start aga8calc.service
To check the service status::
$ sudo systemctl status aga8calc.service
To stop and disable the service::
$ sudo systemctl stop aga8calc.service
$ sudo systemctl disable aga8calc.service
Configuration
-------------
The configuration file is structured like the example below.
.. code-block:: xml
opc.tcp://lt-103009:62548/Quickstarts/DataAccessServer
xxx
xxx
http://test.org/UA/Alarms/
1000
AGA8Detail
...
...
...
- `` is the root element.
All other elements live inside this one.
- `` is used to select what OPC server to connect to.
- `` and `` are used to select what user name and password to use to connect to the OPC server.
- `` is used to set the default namespace URI to be used if no namespace URI is specified for the individual nodes.
- `` is used to set the update interval of the calculation task.
The interval is set in milli seconds, so 1000 would be 1 second.
- `` is used to select the equation of state to use.
The possible selections are:
- AGA8Detail
- Gerg2008
- `` can contain one or more `` elements.
Every `` element is structured like below.
.. code-block:: xml
This holds the values that is read from, and the result written back to the OPC server.
- `` contains up to 21 `` elements where each one contains attributes for the component.
`` can have the following attributes:
- `SamplingInterval` is the default sampling interval that will be requested for the monitored items for the OPC subscription.
- `Normalize` can be set to `true` to automatically normalize the composition sum to 1.0.
Attributes for ``:
- `Name` is used to identify the component.
The available names are:
- Methane
- Nitrogen
- CarbonDioxide
- Ethane
- Propane
- IsoButane
- NormalButane
- IsoPentane
- NormalPentane
- Hexane
- Heptane
- Octane
- Nonane
- Decane
- Hydrogen
- Oxygen
- CarbonMonoxide
- Water
- HydrogenSulfide
- Helium
- Argon
- `NamespaceURI` is the namespace URI for the OPC node to read.
If this is empty, the DefaultNamespaceURI will be used.
- `Identifier` is the OPC identifierType and identifier of the node to be read from.
- `StartIdentifier` is the start Node for the RelativePath.
- `RelativePath` is the path to the wanted node, relative to StartIdentifier.
- `ScaleFactor` is used to scale the individual component values into the mol fraction range from 0-1.
- `Value` is used to set a constant value for the component.
Identifier and Value can not both be used at the same time for a component. Use one or the other!
To read values from an OPC server either the `Identifier`, or the `RelativePath` with `StartIdentifier` can be used.
When using `RelativePath` the `StartIdentifier` is optional. If `StartIdentifier` is not specified it will default to the Objects folder.
- `` can contain several `` elements.
Every `` element contains the pressure and temperature to read, and one or more properties that is to be written to the OPC server.
- `` is the pressure to be read.
It contains one or more `` elements.
The `MathFunction` attribute selects what function to use when reading multiple pressure values.
The possible functions are:
- `Min` will select the lowest value.
- `Max` will select the highest value.
- `Average` will select the average of all the values.
- `Median` will select the median value.
The `` elements have the following attributes:
- `Identifier` is the OPC identifierType and identifier of the node to be read from.
- `ScaleFactor` is used to scale the pressure to the expected unit.
For example to scale from mbarg to barg, ScaleFactor should be set to 0.001.
- `Unit` is the expected engineering unit of the pressure value.
This is used to convert the pressure value to the unit needed for the Aga8 equation of state, namely [kPa].
The possible units are:
- barg (bar gauge)
- bara (bar absolute)
- `` is the temperature to read.
It contains one or more `` elements.
Like the `` it also has the `MathFunction` attribute.
The possible functions are identical to that of the ``.
The `` element have the following attributes:
- `Identifier` is the OPC identifierType and identifier of the node to be read from.
- `Unit` is the expected engineering unit of the temperature value.
This is used to convert the temperature to the proper unit - [K].
The possible temperature units are:
- C (degree Celsius)
- K (Kelvin)
- `` contains one or more `` elements.
These are the results that will be written to the OPC server.
The Attributes of the `` element are:
- `Identifier` is the OPC identifierType and identifier of the node to be read from.
- `Property` is the result that will be written to the OPC item.
The possible options are:
- CompressibilityFactor
- Density
- Enthalpy
- Entropy
- GibbsEnergy
- InternalEnergy
- IsentropicExponent
- IsobaricHeatCapacity
- IsochoricHeatCapacity
- JouleThomsonCoefficient
- MolarConcentration
- MolarMass
- SpeedOfSound
- `Type` is the datatype that the OPC server expects for the item.
Possible types are:
- `single` a 32-bit floating point type.
- `double` a 64-bit floating point type.
A complete configuration file could look like this.
.. code-block:: xml
opc.tcp://lt-103009:62548/Quickstarts/DataAccessServer
username
password
http://test.org/UA/Alarms/
10000.0
Gerg2008
Files
-----
- **aga8.dll** Library that implements the equations of state.
- **Aga8_Calc_Client.Config.xml** Config file for the OPC client.
- **Aga8CalcService.exe** Main program.
- **NLog.config** Configuration file for logging system.
- **Aga8Calc.config** Main configuration file.
Sequence Diagram
----------------
.. uml::
@startuml
scale 1
== Init ==
Aga8Calc -> OpcServer : Connect request
OpcServer --> Aga8Calc : Connect granted
Aga8Calc -> OpcServer : Subscription request
OpcServer --> Aga8Calc : Subscription granted
== Main loop ==
loop forever
hnote over Aga8Calc : Calculate results
Aga8Calc -> OpcServer : Write results
hnote over Aga8Calc : Wait ms
end
group Subscription
OpcServer --> Aga8Calc : Subscription notification
end
@enduml