INTO-CPS-Association / into-cps-application

The front-end of the INTO-CPS tool chain
https://into-cps-association.github.io/simulation/app.html
Other
17 stars 8 forks source link

Multi-model configuration does not get rendered #214

Closed clagms closed 1 year ago

clagms commented 1 year ago

Steps to reproduce:

  1. Open INTO-CPS-Application.4.0.5
  2. Open the following project: decoupled_model_cosim.zip
  3. Try to open the multi-model configuration.
  4. Get a blank screen: image

This is a particularly nasty problem, as the user looses the multi-model configuration.

UPDATE: Some more investigation with the developer tools seems to point out at the problem source being the TestBench FMU. When the INTO-CPS app contains that FMU, we get the following error:

C:\Users\D48113\AppData\Local\Temp\22YC1puCJ7fuv3E89xXES60huX8\resources\app.asar\dist\angular2-app\mm\mm-page.component.js:31 MMPAGECOMPONENT
@angular.js:2 Unhandled Promise rejection: Cannot read property 'hasAttributes' of null ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'hasAttributes' of null
    at t.populateFromModelDescription (C:\Users\D48113\AppData\Local\Temp\22YC1puCJ7fuv3E89xXES60huX8\resources\app.asar\dist\angular2-app\coe\models\Fmu.js:31)
    at C:\Users\D48113\AppData\Local\Temp\22YC1puCJ7fuv3E89xXES60huX8\resources\app.asar\dist\angular2-app\coe\models\Fmu.js:31
    at t.invoke (@angular.js:2)
    at e.run (@angular.js:2)
    at @angular.js:2
    at t.invokeTask (@angular.js:2)
    at e.runTask (@angular.js:2)
    at y (@angular.js:2)
    at e.invokeTask (@angular.js:2)
    at Immediate.i.useG.invoke (@angular.js:2) TypeError: Cannot read property 'hasAttributes' of null
    at t.populateFromModelDescription (C:\Users\D48113\AppData\Local\Temp\22YC1puCJ7fuv3E89xXES60huX8\resources\app.asar\dist\angular2-app\coe\models\Fmu.js:31:3858)
    at C:\Users\D48113\AppData\Local\Temp\22YC1puCJ7fuv3E89xXES60huX8\resources\app.asar\dist\angular2-app\coe\models\Fmu.js:31:2774
    at t.invoke (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:24060)
    at e.run (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:19259)
    at file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:30742
    at t.invokeTask (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:24744)
    at e.runTask (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:19922)
    at y (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:27035)
    at e.invokeTask (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:25880)
    at Immediate.i.useG.invoke (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:25742)
Zone.__load_patch.r.onUnhandledError @ @angular.js:2
f @ @angular.js:2
t @ @angular.js:2
Zone.__load_patch.r.microtaskDrainDone @ @angular.js:2
y @ @angular.js:2
e.invokeTask @ @angular.js:2
i.useG.invoke @ @angular.js:2
n.args.<computed> @ @angular.js:2
processImmediate @ internal/timers.js:456
@angular.js:2 Unhandled Promise rejection: Cannot read property 'hasAttributes' of null ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'hasAttributes' of null
    at t.populateFromModelDescription (C:\Users\D48113\AppData\Local\Temp\22YC1puCJ7fuv3E89xXES60huX8\resources\app.asar\dist\angular2-app\coe\models\Fmu.js:31)
    at C:\Users\D48113\AppData\Local\Temp\22YC1puCJ7fuv3E89xXES60huX8\resources\app.asar\dist\angular2-app\coe\models\Fmu.js:31
    at t.invoke (@angular.js:2)
    at e.run (@angular.js:2)
    at @angular.js:2
    at t.invokeTask (@angular.js:2)
    at e.runTask (@angular.js:2)
    at y (@angular.js:2)
    at e.invokeTask (@angular.js:2)
    at Immediate.i.useG.invoke (@angular.js:2) TypeError: Cannot read property 'hasAttributes' of null
    at t.populateFromModelDescription (C:\Users\D48113\AppData\Local\Temp\22YC1puCJ7fuv3E89xXES60huX8\resources\app.asar\dist\angular2-app\coe\models\Fmu.js:31:3858)
    at C:\Users\D48113\AppData\Local\Temp\22YC1puCJ7fuv3E89xXES60huX8\resources\app.asar\dist\angular2-app\coe\models\Fmu.js:31:2774
    at t.invoke (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:24060)
    at e.run (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:19259)
    at file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:30742
    at t.invokeTask (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:24744)
    at e.runTask (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:19922)
    at y (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:27035)
    at e.invokeTask (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:25880)
    at Immediate.i.useG.invoke (file:///C:/Users/D48113/AppData/Local/Temp/22YC1puCJ7fuv3E89xXES60huX8/resources/app.asar/dist/@angular.js:2:25742)
Zone.__load_patch.r.onUnhandledError @ @angular.js:2
f @ @angular.js:2
t @ @angular.js:2
Zone.__load_patch.r.microtaskDrainDone @ @angular.js:2
y @ @angular.js:2
e.invokeTask @ @angular.js:2
i.useG.invoke @ @angular.js:2
n.args.<computed> @ @angular.js:2
processImmediate @ internal/timers.js:456
clagms commented 1 year ago

@levisen this issue is pressing. Lectures and external tutorials are depending on this very basic functionality working. I've asked @mapalmieri to try reproduce this issue as it could be just on my machine. Thanks!

clagms commented 1 year ago

After discussions with @mapalmieri , we have found out that this issue is probably caused by https://github.com/INTO-CPS-Association/into-cps-application/issues/182 because the FMUs exported by open Modelica often contain parameters which are enumeration types.

The workaround is as follows:

  1. Open the FMU's modelDescription.xml and search for any scalar variable with type Enumeration. It will look like:
    <!-- Index of variable = "31" -->
    <ScalarVariable
    name="dut_turbine.stateSelect"
    valueReference="3"
    description="Priority to use phi and w as states"
    variability="fixed"
    causality="calculatedParameter"
    >
    <Enumeration declaredType="StateSelect"/>
    </ScalarVariable>
  2. Replace <Enumeration declaredType="StateSelect"/> with <Real />. this will make the intercps up think this parameter is a real number. As long as the user does not have to set this parameter then everything will work.
  3. Repeat the previous two steps for every fmu. It is a lot easier to include the FMUs as folders.