﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4782	Cannot pass a parameter value coming from a class to another class nested in another class!!	ali.shirazi@…	Martin Sjölund	"Hello,
I have been recently reporting a number of issues in relation to our OM library (i.e. SolarTherm available from: https://github.com/SolarTherm/SolarTherm/tree/alberto-merge) with the recent version of OMC, in particular the stable and the nightly build versions.

In this specific issue, which I should mention that never happened in the previous versions of OMC (e.g. V1.11), one of our example model (i.e. TroughWagner.mo available form: https://github.com/SolarTherm/SolarTherm/blob/alberto-merge/examples/TroughWagner.mo) breaks because OM fails to pass a value from the class instance “wea” (i.e. wea.lat which is a parameter showing the latitude of a location, which itself is read from a weather data file) to another class (i.e. OptEff) which is itself nested in another class instance called CL. It should be mentioned that the model TroughWagner.mo itself is an extension of a base class called “GenericSystem.mo” which is available from: https://github.com/SolarTherm/SolarTherm/blob/alberto-merge/SolarTherm/Systems/GenericSystem.mo.

Here is the piece of code in GenericSystem.mo that shows the issue that I have been trying to demonstrate:
{{{
SolarTherm.Models.Sources.Weather.WeatherSource wea(file=wea_file, delay=
wdelay);

SolarTherm.Models.CSP.CRS.HeliostatsField.SteeredCL CL(
redeclare model OptEff = SolarTherm.Models.CSP.CRS.HeliostatsField.FileOE (
file=opt_file, orient_north=if wea.lat < 0 then true else false),
A=if match_sam then 1.0273*A_field else A_field,
steer_rate=0.002,
target_error=0.0001,
actual_0=0.0); // ~8 minutes till fully on sun
// if large can be large source of missing energy
}}}


And below is the error I get when I run TroughWagner.mo in OMEdit:

{{{
[7] 11:18:24 Translation Error
[SolarTherm.Systems.GenericSystem: 120:19-120:67]: Variable wea.lat not found in scope SolarTherm.Models.CSP.CRS.HeliostatsField.SteeredCL$CL.
}}}

Finally, I should mention that the package SolarTherm (from “alberto-merge” branch: https://github.com/SolarTherm/SolarTherm/tree/alberto-merge/SolarTherm) must be imported to OMEdit before running the above model as it contains a number of dependencies required by the model.

I would appreciate it if you have a look and let me know what causes this error.

Thanks,
Ali Shirazi"	defect	assigned	high		OMEdit	v1.13.0-dev-nightly			john.pye@…
