-
Notifications
You must be signed in to change notification settings - Fork 5
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
Test cases for Complex operator record support in MARCO #8
Comments
|
|
Very good news, the results reported for T01-T07 are indeed correct 😃 For power system models to work, we also need to get IDA to work, so that last part is also required. |
@mscuttari I added I would suggest to add the updated version of ComplexTest to the marco testsuite, so we make sure these features do not get broken. |
Regarding the problems about
model 'ComplexTest.T08'
function 'Complex.\'*\'.multiply' "Multiply two complex numbers"
input 'Complex' 'c1';
input 'Complex' 'c2';
output 'Complex' 'c3';
algorithm
'c3' := 'Complex.\'constructor\'.fromReal'('c1'.'re' * 'c2'.'re' - 'c1'.'im' * 'c2'.'im', 'c1'.'re' * 'c2'.'im' + 'c1'.'im' * 'c2'.'re');
annotation(Inline = true);
end 'Complex.\'*\'.multiply';
function 'Complex.\'-\'.subtract' "Subtract two complex numbers"
input 'Complex' 'c1';
input 'Complex' 'c2';
output 'Complex' 'c3';
algorithm
'c3' := 'Complex.\'constructor\'.fromReal'('c1'.'re' - 'c2'.'re', 'c1'.'im' - 'c2'.'im');
annotation(Inline = true);
end 'Complex.\'-\'.subtract';
function 'Complex.\'constructor\'.fromReal' "Construct Complex from Real"
input Real 're';
input Real 'im' = 0.0;
output 'Complex' 'result';
algorithm
annotation(Inline = true);
end 'Complex.\'constructor\'.fromReal';
function 'Modelica.ComplexMath.conj' "Conjugate of complex number"
input 'Complex' 'c1';
output 'Complex' 'c2';
algorithm
'c2' := 'Complex.\'constructor\'.fromReal'('c1'.'re', -'c1'.'im');
annotation(Inline = true);
end 'Modelica.ComplexMath.conj';
record 'Complex'
parameter Real 're';
parameter Real 'im';
end 'Complex';
parameter 'Complex' 'Z' = 'Complex'(0.03, 0.1);
'Complex' 'v0' = 'Complex'(1.0, 0.0);
'Complex' 'v';
'Complex' 'i';
equation
'v' = 'Complex.\'-\'.subtract'('v0', 'Complex.\'*\'.multiply'('Complex'(0.03, 0.1), 'i'));
'Complex.\'*\'.multiply'('v', 'Modelica.ComplexMath.conj'('i')) = 'Complex'(1.0, 0.2);
end 'ComplexTest.T08'; Notice how The same happens with model |
See #12 and OpenModelica/OpenModelica#11792 |
I pinged Per on the OpenModelica issue, let's see if he can fix that before Michele is back from Norway. |
Here is a bunch of tests for the support of the Complex operator record in MARCO, borrowed from OpenModelica/OpenModelica#11504:
@mscuttari, can you please report on the current status with the latest development version of the compiler?
The text was updated successfully, but these errors were encountered: