Hi there,
I am trying to report in an automated way forces and moments generated by a foil (or FM) for dynamic simulations. I would like to evaluate max, min, std and the statistics block provides some use for pure scalar and angles. However when trying to apply the Statistics block to a single FM component in a specific frame (ie the channel on which it is reported), it seems to send an error (-> ‘x’ (block output reference in curly brackets expected) about the use of curly bracket inside curly bracket defining the input.
For instance when using:
var statWindowDuration = 60;
R.merge(“Blocks.” + boatSpec.Name + “.Statistics”, {
“Stats” : BL.Statistics({
// “Inputs”: {“x”: “{^.StbdRear.Foil.FM{Boat.StbdRear.FrameFoilRearFixed}Fx}”},//Does not work, single scalar with curly bracket in its channel name.
“Inputs”: {“x”: “{^.StbdRear.Foil.CpMin}”},//Works, single scalar without bracket in its channel name
“ValueType”: “Scalar”,
“Window” : statWindowDuration,
“EnableMean”: true,
“EnableStdDev”: true,
“EnableMin”: true,
“EnableMax”: true,
“Percentiles”: [5, 50, 95],
}),
});
Is that something expected? Is there a simple workaround with some js semantic (or maybe small improvement for next release)? The Block AVG (average) seems affected as well by this situation, and it might be the case for any relevant blocks that could take a channel input with a curly bracket (FM component in a frame).
Thank you,
Nicolas
Hi Nicolas,
Thanks for reaching out. The issue you’re facing should be solved by updating the syntax of the Input
variable used in the Statistics
block.
Could you please try to adapt the following example using the force X-component of a FM
block?
R.merge("Blocks." + boatSpec.Name + "." + PtSt + ".Statistics", {
FxForStats: "{Root.Boat." + PtSt + ".Foil.FM}.F()[0]",
Stats: BL.Statistics({
Inputs: { "x": "{FxForStats}" },
ValueType: "Scalar",
Window: 1,
EnableMean: true,
EnableStdDev: true,
EnableMin: true,
EnableMax: true,
Percentiles: [5, 50, 95],
}),
});
Hi, yes bringing the curly brackets out of the direct input via a intermediate quantity works.
Thank you,
Nicolas