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

statement: "redeclare function extends" not working??

statement: "redeclare function extends" not working??

Hello,

I would like to redeclare and extend a replaceable partial function in my OpenModelica models as it is done for example in the Modelica Library (Fluid.Pipes.BaseClasses.WallFriction).

Should that work in OM or not?

The following code works in Dymola but My OMEdit crahses when entering the redeclare function extends part current/sad.

thanks,

Fritz


Code:


within ;
package Shell

  partial package PartialPackage

    replaceable partial function FunctionToBeExtendet

      input Real FunctionInput;
      output Real FunctionOutput;

      protected
      Real Variable;

    end FunctionToBeExtendet;

  end PartialPackage;


  package FinalPackage

  extends PartialPackage;

    redeclare function extends FunctionToBeExtendet

    algorithm
       Variable:= FunctionInput*2;
       FunctionOutput:= Variable;

    end FunctionToBeExtendet;

  end FinalPackage;


  model FunctionCall

  Real Value;
  Real Result;

  equation
  Value = 2;
  Result = FinalPackage.FunctionToBeExtendet(Value);

  end FunctionCall;
 
end Shell;


Re: statement: "redeclare function extends" not working??

omc handles the code just fine. OMEdit on the other hand seems to have some issues with editing the package... (Note that I am talking about the trunk version of OMEdit; older versions may have crashed from it, new one only has trouble saving the model)

Re: statement: "redeclare function extends" not working??

Fritz,

I guess you are Windows user. That problem was fixed but you have to wait for the new release/nightly build.

Adeel.

Re: statement: "redeclare function extends" not working??

No, I am on Ubuntu and wanted to load and simulate the model with the OMEdit trunk version (from Monday). Yeah, looks like there is an editing problem...OMEdit crashes while loading...I should have mentioned that before. What is now the best way to run my models until OMEdit is fixed? OMShell?

Re: statement: "redeclare function extends" not working??

Command-line omc (mos-script) is always best current/smile

As for the loading crashes... they should have been fixed in r10111

Re: statement: "redeclare function extends" not working??

Thanks! current/smile

There are 0 guests and 0 other users also viewing this topic
You are here: