Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5729 closed defect (invalid)

LibRAS is broken with the NF

Reported by: Francesco Casella Owned by: Per Östlund
Priority: high Milestone: 1.16.0
Component: New Instantiation Version:
Keywords: Cc:

Description

Please compare the coverage report of LibRAS between the OF and NF. The OF flattens 8/10 and simulates 5/10, the NF flattens 0/10.

Maybe there are problems with the source code, but I guess it's mostly NF issues.

For example, compiling LibRAS.Culture.SSCulture_V with the NF gives:

[LibRAS/Culture/PartialCulture.mo:14:3-14:140:writable] Error: 
Variable loss not found in scope PartialCulture.

but the line in question contains

  parameter Waste.WasteData waste = Waste.WasteData(fish=fish, feed=feed, loss=loss) "WasteData record" annotation(choicesAllMatching=true);

and the definition of WasteData contains the line

  parameter Real loss = 0.1 "Feed loss factor";

@perost, can you please check if those issues are real?

Thanks!

Change History (2)

comment:1 by Per Östlund, 5 years ago

Resolution: invalid
Status: newclosed

The issue here is not what WasteData contains, but the fact that PartialCulture doesn't have any variable called loss. So this is a library issue.

The reason why this works with the OF is because it handles extends incorrectly. The OF will happily flatten an incorrect model such as:

model A
  Real x = y; // Wrong, no y in this scope.
end A;

model M
  extends A;
  Real y;
end M;

Since SSCulture_V extends PartialCulture and also contains a declaration for loss it works with the OF, even though it shouldn't.

If the incorrect modifier for loss is removed the next error that occurs is:

[SSCulture_V.mo:102:5-102:180] Error: The iteration range hold(ft) is not a constant or parameter expression.

which is the line:

feedingPulse = if sum({if t < time and time < t + feedingDuration then 1 else 0 for t in hold(ft)}) > 0 then 1 / (feedingDuration * size(feedingTimes, 1) * F_nominal) else 0;

The error is caused by sum({... for t in hold(ft)}), since hold(ft) as the error says isn't a parameter expression which means the size of the array can't be calculated. As far as I can see this can be fixed by simply removing the { and } and just use the reduction form of sum rather than constructing an array and then calling sum on it.

The next error that occurs is:

[PartialCulture.mo:39:7-39:50] Error: m_S_tot[i] is not a valid connector.

This is correct, m_S_tot is declared to be of the type Modelica.SIunits.MassFlowRate which is just a fancy Real and not a connector in any way. At this point I gave up trying to fix the library.

comment:2 by Francesco Casella, 5 years ago

Thank you Per!

I'll report these issues to the library authors.

Note: See TracTickets for help on using tickets.