Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » jwmbrg
  • » Profile

Posts

Posts

Hmm, really dont understand the problem behind this.
The Art2140807 is a subtclass of of the BaseArray and therefore could be used interchangeably with BaseArray. Which Dymola and JModelica allows.
Declaring BaseArray and the variable, "theSensor", as replacable does not solve the problem.

Hi!

I have a base class:

class BaseArray
  /***HELPER CLASS FOR COMPONENT GENERATION, DO NOT TOUCH**/
  replaceable constant Modelica.SIunits.Height[:] steps = {0.232};
  replaceable constant Modelica.SIunits.Resistance[:] resistances = {120,160};
end BaseArray;

Then i extend this baseclass in:

final model Art2140807
  extends MyLibrary.Resistive.BaseArray(steps = {0.232,0.216,0.204,0.192,0.18,0.168,0.156,0.144,0.132,0.12,0.108,0.096,0.084,0.072,0.06,0.048,0.036}, resistances = {120,182,250,325,412,513,626,759,917,1104,1344,1631,1991,2490,3188,4188,5788,9088});
end Art2140807;


When i try to use it, in a component like this:
final MyLibrary.Art2140807 usedSensor;
MyLibrary.Resistive.ResistorArray levelResistor(stim_in(final unit = "m"), theSensor = usedSensor)

i get the error:

Error: Type mismatch in binding theSensor = usedSensor, expected subtype of MyLibrary.Resistive.BaseArray new def, got type MyLibrary.Art2140807 model.

Why is there i type mismatch when Art2140807 is extending BaseArray?

  • Index
  • » Users
  • » jwmbrg
  • » Profile
You are here: