mappRecipe does not group variables in an xml if added separately

Hello,
If I add the whole structure at once with MpRecipeRegPar, mappRecipe during save create this file:

<Element Name="gProduktparameter.Zentralschmierung" Type="PvParameter">
	<Group ID="gProduktparameter.Zentralschmierung">
		<Property ID="ProcessTime" DataType="UINT" Value="10" />
		<Property ID="IdleTime" DataType="UINT" Value="10" />
		<Property ID="ErrorDelay" DataType="UINT" Value="30" />
	</Group>
</Element>

If I add it seperatly with each of that variables, I get something like this:

<Element Name="gProduktparameter.Zentralschmierung" Type="PvParameter">
		<Property ID="ProcessTime" DataType="UINT" Value="10" />
</Element>
<Element Name="gProduktparameter.Zentralschmierung" Type="PvParameter">
		<Property ID="IdleTime" DataType="UINT" Value="10" />
</Element>
<Element Name="gProduktparameter.Zentralschmierung" Type="PvParameter">
		<Property ID="ErrorDelay" DataType="UINT" Value="30" />
</Element>

But I wonder why? The result should not be dependend how I register the variables.
MappRecipe can save that based on the variable name, recognize the structure and generate groups.
It is not always possible to add the structure at once, if there are variables in a structure with should be not saved or are machine parameters for another recipe.

Hi Johannes,

in your second example, did you register “gProduktparameter.Zentralschmierung” or the three variables seperately?

regards Stefan

Hi Stefan, yes, I wrote it, maybe is was not so clear. Sorry for that. Also if I add it seperatly the mappRecipe should be able to group it like just add the structure of it.

Hi!

In theory, MpRecipe could do / could have done something this, but:

  • For MpRecipe a “structure” always means “the complete type” (for simplicity and performance)
    • Choosing individual structure members is only possible by registering individual PVs
    • As per the definition of MpRecipe there are two possible (registerable) types: Structures and “simple PV types”
  • What would/should happen if one of the MpRecipeRegPar FBs is not active?
    • Currently, PVs which are not registered will be ignored, but all the others will be filled (up to my knowledge)
    • Depending on what the recipe/structure is for, this may lead to dangerous situations/combinations
  • It would require more processing power for saving and loading
    • MpRecipe can not simply use string operations, instead it has to “search” the system for the PV(s) and their relationships
    • Depending on the size of the project (and available free CPU time / idle-time) loading/saving will take noticeably longer
    • There is also the additional overhead of trying to find out if you are trying to write a “simple value” or a “structure” (as registered PVs are only evaluated during a save/load)
  • The only observable benefit would be a slightly smaller file size (but if this is wanted/needed XML would already be the wrong format)

In the end, it was a decision made when MpRecipe was first developed (it might as well have done grouping on “task-name”), but (most likely for simplicity and resilience) the most simple representation was chosen, which was structuring the file based on how the PVs are registered.
You also have to remember that MpRecipe is now 8+ years old, and up to my knowledge since then the format never changed and is still compatible to what it first was. If it were to be changed now, it would cause incompatibilities with existing recipe files, which is usually only done if there would be a perceived benefit big enough to outweigh the drawback of having to update everything…

Is there a specific reason you want to have them always grouped into the “structure” layout even if you registered individual PVs? Or were you just curious? :wink:

4 Likes

Hello Michael,

Thank you for your detailed explanation. After looking into it further, I realized that our custom solution, which is already 16 years old, actually fits our needs better than mappRecipe. While I am a bit disappointed that I won’t be able to use mappRecipe and reduce some of the code, I understand that the mapping process is more complicated. I had high expectations for mappRecipe, but it’s not a big issue. I’ll just continue using our existing solution.

Thanks again!

That is sad to hear (but somewhat understandable, I guess most developers have been in a similar situation at least once :wink:). If a library doesn’t fit, it… well, doesn’t fit :sweat_smile:

But if your original question is solved (answered), may I ask you to mark the answer/post that you think fits best as “solution”?