﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1794	Internal error BackendEquation.equationToExp failed with 1.9 beta, 1.8.1 works.	Teemu Lempinen	Jens Frenkel	"The latest 1.9 release does not simulate a model that has been working well with 1.8.1. The error is given below.

{{{
record SimulationResult
 resultFile = """",
 simulationOptions = ""startTime = 0.0, stopTime = 10.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Test', storeInTemp = false, noClean = false, options = '', outputFormat = 'csv', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''"",
 messages = ""Simulation failed for model: Test[Test.mo:15:5-15:96:writable] Error: Internal error BackendEquation.equationToExp failed: c[1,1] = if e[1,1] > 0.5 and d[1] < 0.5 then 1.0 else 0.0
 Error: Internal error createOdeSystem2 failed for Jacobian Constant
 Error: Internal error createOdeSystem failed for {5, 3, 6, 8, 10, 2, 4, 7, 9, 1:7, 3, 8, 10, 6, 2, 4, 9, 5, 1} Size: 10 Jacobian Constant
 Error: Internal error createEquationsForSystem1 failed
 Error: Internal error ./Compiler/BackEnd/SimCode.mo: function createSimCode failed [Transformation from optimised DAE to simulation code structure failed]
 "",
}}}

The error occurs when trying to simulate the following model:

{{{
model Test

    constant Integer size = 2;
    constant Integer elements[size] = {1,2};
    parameter Real e[size, size] = fill(0.0, size, size);
    Real a[size];
    Real b[size];
    Real c[size, size];
    Real d[size];

equation

    a = {if b[i] < 0.5 then -1 else 0 for i in elements};
    b = {if sum(c[i,:]) < 0.5 then 1 else 0 for i in elements};
    c = { { if e[i,j]  > 0.5 and d[j] < 0.5 then 1 else 0 for j in elements} for i in elements};
    d = {(if a[i] >= 0.9999 then 1 else 0) for i in elements};	
	
end Test;
}}}

The example model has been stripped down to a small model that gives the error. As such, this model does not make any sense. The original model is larger and automatically generated."	defect	closed	high	1.9.0	Backend		fixed		
