The following calculations are currently supported:
- Dew point temperature ("daggpunktstemperatur") [°C]
- Difference between air tempeature and dew point temperature [°C]
- Current water vapor content ("ånghalt") [g/m3]
- Control fans for attic ventilation
- Control dehumidifier ("avfuktare") for a suspended house foundation ("krypgrund")
- Other stuff yet to explore

Instructions
- Put the files in the Binaries folder (found in the zip file) in the Plugins folder where the Switch King Server is installed.
- Open the DSVCalcEnginePlugin.dll.config file (using e.g. Notepad) and update the key values (see below).
- (Leave the key values empty for calculations you are not using)
- Restart the Switch King Server
Create new data source(s) to publish the results from the calculation:
- Select File > New > Data Source
- Select option "Values provided from external system"
- Configure the remaining options for the data source at will and finish
- Open the newly created data source and make a note of the Data Source ID found on the General tab
- Use this ID in the .config file to save the results from the calculation
(Use the same approach to find out the Data Source IDs for your data sources on which to perform the calculation.)
Dew point temperature
This function calculates the dew point temperature using air temperature and humidity as input.
Definition:
Code: Select all
Tc: Air temperature (°C)
Rh: Relative humidity (0-100%)
Td: Dew point temperature (°C)
if (Rh > 85.0)
{
Td = Tc - 0.133 * (100.0 - Rh);
}
else
{
Td = Tc - 0.2 * (95.0 - Rh);
}
Code: Select all
<add key="Dewpoint" value="i[Tc]:i[Rh]:o[Td]"/>
Replace Tc, Rh and Td with corresponding data source IDs, example:
<add key="Dewpoint" value="i1:i2:o3"/>
This function calculates the difference between the air temperature and the dew point temperature using air temperature and humidity as input.
Definition:
Code: Select all
Tc: Air temperature (°C)
Rh: Relative humidity (0-100%)
Td: Dew point temperature (°C)
Tdiff: Difference between Tc and Td (°C)
Tdiff = Tc - Td
(Rh is used to calculate Td using code defined for Dew point temperature.)
Code: Select all
<add key="DewpointDiff" value="i[Tc]:i[Rh]:o[Tdiff]"/>
Replace Tc, Rh and Td with corresponding data source IDs, example:
<add key="DewpointDiff" value="i1:i2:o3"/>
This function calculates the current amount of water content in vapor ("ånghalt") using air temperature and humidity as input.
Definition:
Code: Select all
Tc: Air temperature (°C)
Tk: Air temperature (Kelvin)
Rh: Relative humidity (0-100%)
v: Water vapor content (g/m3)
Tk = Tc + 273.2
//Maximum water vapor content
vs = (1.32 / Tk) * Math.Pow((1 + 0.02 * (Tk - 273.2)), 4) * 1000
//Current water vapor content
v = Rh * (vs / 100)
Code: Select all
<add key="WaterVapor" value="i[Tc]:i[Rh]:o[v]"/>
Replace Tc, Rh and Td with corresponding data source IDs, example:
<add key="WaterVapor" value="i1:i2:o3"/>
Source code is available for further development:
Search for "#mycalc" in the code for Plugin.cs to find out where to add code for your own calculation.
You may add any number of inputs, outputs and constants in the configuration key. The plugin will parse the value string from left so the order of the items are important.
The output data sources are not updated until the plugin has recorded updates of all input data sources (from the Switch King Server was started).
Example:
value="i10:i11:c1.25:i35:o14:o17"
It is possible to perform multiple calculations for the same function by using the pipe character in the value string.
Example:
value="i10:i11:c1.25:i35:o14:o17|i20:i21:c0.45:i45:o24:o27"
It is highly appreciated if you share your contributions with the community. Thanks!
Filename: DSVCalcEnginePlugin_0.1.zip
Version: 0.1
Date: 2015-02-18
Requirements: Switch King Server v 3.2.3 and later
Developer: Switch King
@krambriw, tack för att du delat med dig av beräkningarna!
(Det går bra att posta frågor/kommentarer på svenska också i denna tråden.)