﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1163	parameter(fixed = true) should be treated as a constant during runtime	Henning Kiel	Henning Kiel	"I would like to have a parameter which I can pass to a constructor for an ExternalObject.
I use the below code, but only get a NULL pointer passed to the constructor.
{{{#!modelica
package demo
  model test

    class MyData
      extends ExternalObject ;

      function constructor
        input String fileName ;
        output MyData table ;
      external ""C"" table = constructor(fileName) annotation(Library = ""test.o"", Include = ""#include \""test.h\"""");
      end constructor ;

      function destructor
        input MyData table ;
      external ""C"" destructor(table) annotation(Library = ""test.o"", Include = ""#include \""test.h\"""");
      end destructor ;

    end MyData ;
    parameter String DataFile = ""sampledata.xml"";

    MyData table = MyData(DataFile ) ;
...

  algorithm
    if HallSignal <> pre(HallSignal) then
        sig = func(omega, HallPos, table);
    end if;
  end test ;

end demo;
}}}
!!Comment from Martin Sjoelund:


The simulation generates the following result:
{{{
$ ./test -v
construct: (null)
read start = 0 from init file.
read stop = 1 from init file.
read stepSize = 0.002 from init file.
read tolerance = 1e-06 from init file.
read method = dassl from init file.
read $dummy = 0 from init file.
read der($dummy) = 0 from init file.
read DataFile = ""sampledata.xml"" from init file.
}}}

The way OpenModelica does this is it first initializes the whole structure. Then calls the external object constructors. Then reads the input.

I think this is wrong. It should move calling external objects to a new function in the simulation code. And do that after the input has been read. Obviosuly your code should work since it's a parameter(fixed = true), which [should be] treated as a constant during runtime."	defect	closed	high		*unknown*		fixed		Henning Kiel Martin Sjölund
