Repository navigation
Expand file tree
/
Copy pathStatusFromCode.mo
More file actions
19 lines (19 loc) · 1.91 KB
/
Copy pathStatusFromCode.mo
File metadata and controls
19 lines (19 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
within EvaluationLibrary.Utilities.Functions;
function StatusFromCode "Convert an integer code to a data status"
extends Modelica.Icons.Function;
input Integer code "DataStatus enumeration ordinal";
output EvaluationLibrary.Utilities.Types.DataStatus status "Decoded status; INVALID for an unrecognised code";
algorithm
status:=if code==1 then EvaluationLibrary.Utilities.Types.DataStatus.PENDING elseif code==2 then EvaluationLibrary.Utilities.Types.DataStatus.COMPLETE elseif code==3 then EvaluationLibrary.Utilities.Types.DataStatus.INCOMPLETE
elseif code==5 then EvaluationLibrary.Utilities.Types.DataStatus.NOT_APPLICABLE else EvaluationLibrary.Utilities.Types.DataStatus.INVALID;
annotation(Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}),
graphics={
Ellipse(extent={{-100,-100},{100,100}}, lineColor={108,88,49}, fillColor={255,215,136}, fillPattern=FillPattern.Solid, pattern=LinePattern.Solid, lineThickness=0.5),
Text(extent={{-18,79},{18,47}}, textString="f", textColor={108,88,49}, fontSize=0),
Text(extent={{-57.017,18.934},{-25.53,-20.212}}, textString="#", textColor={108,88,49}, fontSize=0),
Line(points={{-17.871,-0.639},{10.212,-0.639}}, color={64,64,64}, thickness=0.8, pattern=LinePattern.Solid, arrow={Arrow.None,Arrow.Filled}),
Rectangle(extent={{22.977,-14.255},{50.209,12.977}}, lineColor={64,64,64}, fillColor={245,245,245}, fillPattern=FillPattern.Solid, pattern=LinePattern.Solid, lineThickness=0.5, radius=0),
Text(extent={{25.53,10.424},{47.656,-11.702}}, textString="Q", textColor={64,64,64}, fontSize=0)
}),
Documentation(info="<html><p>Decode the ordinals of <code>Types.DataStatus</code>: 1 is <code>PENDING</code>, 2 <code>COMPLETE</code>, 3 <code>INCOMPLETE</code>, 4 <code>INVALID</code> and 5 <code>NOT_APPLICABLE</code>. Any unrecognised code also returns <code>INVALID</code>.</p></html>"));
end StatusFromCode;