In this section we want to answer question around specific calculations in jBEAM.
Table of Contents |
---|
How to use map values in formula?
Only the Formula Editor with Text Resolver allows the direct selection of a map value in the window. For the other two (Formula Editor for numeric Objects, Formula Editor for numeric Channels), the map value must first be converted into a data object.
Proceed as follows:
Use Property → DataItem component (menu: Math → Conversions) and select the requested map value. If the map value provides a measurement unit, this gets also applied to the data object:
The result from step 1 is a data object you can use in i.e. Formula Editor for numeric Objects:
The result of max(abs(A)) in formula editor for numeric object (line by line)is max (A), not considering the negative part
...
Meanwhile we can say the object formula editor is the favorite one. It is faster has more functions and works better due to its object approach. The formula editor (line by line) should be used only in special circumstances, e.g. with an input channel of a measurement component where the measurement value come into jBEAM value by value, which is line by line.
How can I define several result objects in Inline Java-Class?
Result objects can be defined using parent.setResultObjects(...). By default, a DoubleChannel is created. This can be overwritten in init. Example:
Code Block |
---|
@Override public void init(InlineUserClassParentIF parent) { this.parent = parent; try { GroupOfChannels result = ProducerUtils.getResultDataObject(parent, "Gruppe", GroupOfChannels.class, true); StringChannel result2 = ProducerUtils.getResultDataObject(parent, "StringChannel", StringChannel.class, true); parent.setResultObjects(result, result2); } catch (Cea2ItemNotAvailable | Cea2UnsupportedDataType e) { throw new IllegalStateException(e); } } @Override public void validate() { if (parent == null) { return; } GroupOfChannels result = (GroupOfChannels) parent.getResultObject(0); StringChannel result2 = (StringChannel) parent.getResultObject(1); ... |