Skip to content

Check array function inputs. #254

Description

@joaquinffernandez

Bug*
We are getting compile time errors in defs like:

model array_params

constant Integer N = 10;

Real x[N];
discrete Real d;
parameter Real p[N];

function F
  input Real x[:];
  output Real y;
  external "C" y = sample(x) annotation(
                                Include="#include \"array_params.c\"");
end F;

initial algorithm
d := F(p);

equation
for i in 1:N loop
   der(x[i]) = 1;
end for;

algorithm

when time > 1 then
  d := F(x);
end when;
	annotation(

	experiment(
		MMO_Description="",
		MMO_Solver=QSS3,
		MMO_PartitionMethod=Metis,
		Jacobian=Dense,
		MMO_BDF_PDepth=1,
		MMO_BDF_Max_Step=0,
		StartTime=0.0,
		StopTime=1.0,
		Tolerance={1e-3},
		AbsTolerance={1e-3}
	));
end array_params;

with array_params.c:

int sample(double* arr) {
  return arr[0];
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions