Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check array function inputs. #254

Open
joaquinffernandez opened this issue Aug 14, 2024 · 0 comments
Open

Check array function inputs. #254

joaquinffernandez opened this issue Aug 14, 2024 · 0 comments
Assignees
Labels

Comments

@joaquinffernandez
Copy link
Collaborator

joaquinffernandez commented Aug 14, 2024

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];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant