﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4749	Error: variable wea.lat not found in scope (...) while flattening model	john.pye@…	Martin Sjölund	"We have a bug here arising from use of the latest nightly version of omc --version = ""OpenModelica 1.13.0~dev-614-g4bf4d98"". Previously our code gave no error, but since updating, we have an error relating to a Parameter value, initialised in a submodel, not being available in the parent model.

The code which causes problems is visible here:
https://github.com/SolarTherm/SolarTherm/blob/alberto-merge/examples/TroughWagner.mo

That model in turn includes this one:
https://github.com/SolarTherm/SolarTherm/blob/alberto-merge/SolarTherm/Systems/GenericSystem.mo

In that model, you can see that 'wea' is instantiated and then immediately we refer to 'wea.lat', which currently results in the following compiler output:

{{{
[2] 17:36:27 Translation Notification
[SolarTherm.Models.Sources.Weather.WeatherSource: 15:2-15:49]: Moving binding to initial equation section and setting fixed attribute of wea.meta.name to false.

[3] 17:36:27 Translation Notification
[SolarTherm.Models.Sources.Weather.WeatherSource: 15:2-15:49]: Moving binding to initial equation section and setting fixed attribute of wea.meta.lat to false.

[4] 17:36:27 Translation Notification
[SolarTherm.Models.Sources.Weather.WeatherSource: 15:2-15:49]: Moving binding to initial equation section and setting fixed attribute of wea.meta.lon to false.

[5] 17:36:27 Translation Notification
[SolarTherm.Models.Sources.Weather.WeatherSource: 15:2-15:49]: Moving binding to initial equation section and setting fixed attribute of wea.meta.elev to false.

[6] 17:36:27 Translation Notification
[SolarTherm.Models.Sources.Weather.WeatherSource: 15:2-15:49]: Moving binding to initial equation section and setting fixed attribute of wea.meta.tzone to false.

[7] 17:36:27 Translation Notification
[SolarTherm.Models.Sources.Weather.WeatherSource: 15:2-15:49]: Moving binding to initial equation section and setting fixed attribute of wea.meta.tstart to false.

[8] 17:36:27 Translation Error
[SolarTherm.Systems.GenericSystem: 120:19-120:67]: Variable wea.lat not found in scope SolarTherm.Models.CSP.CRS.HeliostatsField.SteeredCL$CL.

[9] 17:36:27 Translation Error
Error occurred while flattening model TroughWagner
}}}

The error is that 'wea.lat' is not found in scope. This seems to closely relate to other issues we've been having recently with Parameters being set in submodels, so we think some regression has happened here.

For example, see this related bug:
https://trac.openmodelica.org/OpenModelica/ticket/4710

Also please note that the ""Translation Notification"" given above is new -- we never used to see this Notification before -- and seems likely to be related to this problem. Note in particular that the value wea.meta.lat is clearly understood by the compiler, but that the reassignment of wea.meta.lat to Parameter wea.lat in WeatherSource line 6, is not working, since the compiler doesn't then recognise that 'wea.lat' exists.

"	defect	assigned	high		*unknown*	v1.13.0-dev-nightly			ali.shirazi@…
