- Index
- » Programming
- » Modelica Language
- » Debug Translation Error
Debug Translation Error
Debug Translation Error
Hi,
I am trying to call a function using some input values (see equation section). When I check the Intake model below, I get Translation Error: Function solveSCFM has more than one algorithm section or external declaration. Any ideas what is causing this error? Thanks.
Code:
model Intake
extends Modelica.Fluid.Interfaces.PartialTwoPortTransport;
input Real RPM;
output Real SCFM;
redeclare package Medium = Modelica.Media.Water.StandardWater;
//obtained from Modelica ValveLinear
Modelica.Blocks.Interfaces.RealInput input_position(min = 0, max = 1) "=1: completely open, =0: completely closed";
inner Modelica.Fluid.System system annotation(
Placement(visible = true, transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
SCFM = path.solveSCFM(AirValvePos=input_position, engineRPM=RPM);
RPM = path.solveRPM(SCFM);
end Intake;
solveSCFM looks like this:
Code:
function solveSCFM
extends BaseClasses.Capacity_partial(AirValvePos=Pos);
input Real Pos;
input Real engineRPM;
output Real capacity;
protected
parameter Real AmbientTemp = 20 "Ambient temperature in degrees C";
algorithm
capacity := formula with AmbientTemp and engineRPM;
end solveSCFM;
Re: Debug Translation Error
Is there an algorithm section in BaseClasses.Capacity_partial?
- adrpo
- 885 Posts
Re: Debug Translation Error
Thank you for your quick reply. Yes, there is an algorithm section in the partial function but it is empty (default). Removing the keyword solves that error. To better my understanding, would you mind explaining why that was an issue? Many thanks.
Re: Debug Translation Error
Modelica Spec says a function can have only one algorithm section.
https://specification.modelica.org/main … -functions
"• A function can have at most one algorithm section or one external function interface (not both), which, if present, is the body of the function."
In your case you inherited a second (empty) algorithm section.
- adrpo
- 885 Posts
- Index
- » Programming
- » Modelica Language
- » Debug Translation Error