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

SimpleBuildingModel tutorial compilation errors in JModelica #114

Open
Ja98 opened this issue Mar 19, 2018 · 7 comments
Open

SimpleBuildingModel tutorial compilation errors in JModelica #114

Ja98 opened this issue Mar 19, 2018 · 7 comments

Comments

@Ja98
Copy link

Ja98 commented Mar 19, 2018

I have followed the tutorial in the UserGuide for the SimpleBuildingModel. The model seems to run fine in Dymola but I get the following errors when compiling in JModelica:

Error at line 25, column 41, in file 'C:\BuildingSystems\Buildings\Airpathes\AirpathPrescribedMassFlowRate.mo':
  Can not access non-function class through component access: 'airpathPort_1.Medium.T_default'

Error at line 264, column 13, in file 'C:\BuildingSystems\Buildings\Ambient.mo':
  Connecting to an instance of a non-connector type is not allowed

Any suggestions on why this is happening and what can be done to resolve it?

@thorade
Copy link
Contributor

thorade commented Mar 19, 2018

For the first error, do you get any further if you set T=300 for now?

The second error could possibly be fixed by changing line 264 to phi = phi_in instead of the connect statement.
The connect statement seems to be illegal, but Dymola accepts such things :-(
To get more hints, also check that single model in Dymola, and also check it in pedantic mode.
The same variable was mentioned in #111 so probably that code should be made more standard-compliant.

@Ja98
Copy link
Author

Ja98 commented Mar 19, 2018

Thanks, it seems these variable are buried somewhere deep in the model: is it possible to change the value of AirpathPrescribedMassFlowRate.T and Ambient.phi in the example script without editing the library file?

@thorade
Copy link
Contributor

thorade commented Mar 19, 2018

You would have to edit the library file, but the error message tells you the file and line.
You might want to start using git to track what you changed & when, and be able to reset to a previous state.

@Ja98
Copy link
Author

Ja98 commented Mar 19, 2018

Yes I use Git with the official package so I can keep track of updates but I wouldn't want to disrupt the main BuildingSystems package with my changes. I guess the next best thing would be to export a copy of only the required elements and dependencies into a new package that could then be referenced, rather than the BuildingSystems Library? Do you know if this is possible?

The pedantic check in Dymola does not indicate any additional warnings - does the check need to be done with simulation?

The first correction you suggested worked but the replacement of connect(phi, phi_in) with phi = phi_in results in:

Error at line 103, column 48, in file 'C:\Local Modelica Libraries\BuildingSystems\BuildingSystems\Buildings\Ambient.mo':
  The component phi_in is conditional: Access of conditional components is only valid in connect statements

Error at line 264, column 11, in file 'C:\Local Modelica Libraries\BuildingSystems\BuildingSystems\Buildings\Ambient.mo':
  The component phi_in is conditional: Access of conditional components is only valid in connect statements

I noticed that phi is defined also on line 103. Deletion of the entire conditional argument on line 264 results in the following error:

Error at line 103, column 48, in file 'C:\Local Modelica Libraries\BuildingSystems\BuildingSystems\Buildings\Ambient.mo':
  The component phi_in is conditional: Access of conditional components is only valid in connect statements

@thorade
Copy link
Contributor

thorade commented Mar 19, 2018

OK, maybe replace

// Select source for relative humidity of the ambient air
  if phiSou == BuildingSystems.Buildings.Types.DataSource.Parameter then
    phi = phi_constant;
  elseif phiSou == BuildingSystems.Buildings.Types.DataSource.File then
    phi = weatherData.y[6];
  else
    connect(phi, phi_in);
end if;

with

// Select source for relative humidity of the ambient air
    phi = if (phiSou == BuildingSystems.Buildings.Types.DataSource.Parameter) then phi_constant
      elseif (phiSou == BuildingSystems.Buildings.Types.DataSource.File) then weatherData.y[6]
      else phi_in;

or does that still give the error wrt conditional components!?

mtiller/ModelicaBook#338

Regarding the git workflow: You should click the "Fork" button, then you have a copy where you can do whatever you want. You can have multiple remotes. When you do changes, always create a branch first. Do not work in the master branch, because that branch will change and then you get merge conflicts.

@thorade
Copy link
Contributor

thorade commented Mar 19, 2018

phi is instantiated in line 103,
in line 212 the equation section starts,
in line 264 phi is assigned a value.

@Ja98
Copy link
Author

Ja98 commented Mar 19, 2018

Thanks very much for the git tips! Yes, unfortunately even when I replace that script, I am still getting the error:

Error at line 261, column 12, in file 'C:\Local Modelica Libraries\Forked\BuildingSystems Forked\BuildingSystems\Buildings\Ambient.mo':
  The component phi_in is conditional: Access of conditional components is only valid in connect statements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants