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

Connection between two input-type connection ports

Connection between two input-type connection ports

Why does OpenModelica allow to connect an input-type connection port to another input-type connection port?

A model check of the attached TestModel, for example, runs successfully without any errors or warnings.
If I understood it correctly, only connections between an input and an output port/variable should be allowed...

Test.mo

Edited by: MP - Nov-30-21 14:13:37
Attachments:

Re: Connection between two input-type connection ports

I dont know the exact rationale behind it, but in my use case, nested model(s), i.e. input propagation, especially in schematic view.

You have a model A that have an input input_a nested/used insiede model B and model B itself is used inside a top model C. inorder to connect model C to input_a you have to create some input port to allow the value to be passed from C via B to A.

e.g.:

Code:


connect(modelA.input_a, modelB.input_ba) ; //connection between B and A inside modelB

connenct(modelC.someValue, modelB.input_ba) ; //connection between some value to B inside model C

of course you can write your own under equation section in text view such as:

Code:

connecnt(modelC.someValue, modelB.modelA.input_a); //connection between modelA and someValue in model C

but sometimes user only want to do the modelling through schematic/diagram view and thats why it is possible to connect two input ports together.

at least that is MY reasoning.

cheers

Re: Connection between two input-type connection ports

OK, thanks, that sounds reasonable.

Do you know any way to restrict possible connections to input-to-output connections only (so that input-input (or output-output) connections will not be allowed)?

Re: Connection between two input-type connection ports

MP wrote:


Do you know any way to restrict possible connections to input-to-output connections only (so that input-input (or output-output) connections will not be allowed)?

Why would you restrict the connection?

I dont have any idea how that would be done... normally you can use assert to check condition regarding parameter (i.e. check if a parameter within allowed limit), but i've never done a connectuion type checking.

If you could share your use case or a minimum working example, it would help.

Code:


model Test
Modelica.Blocks.Interfaces.RealInput input1;
Modelica.Blocks.Interfaces.RealInput input2;
Modelica.Blocks.Interfaces.RealOutput output1;
equation
  connect(input1, input2);
end Test;

failed the translation

Code:

[2] 16:09:22 Symbolic Error

[Test: 8:3-8:26]: Found equation without time-dependent variables: input1 = input2

[3] 16:09:22 Translation Error
[C:/dev/OM64bit/OMCompiler/Compiler/BackEnd/ResolveLoops.mo: 295:9-295:86]: Internal error function resolveLoops_cutNodes failed

[4] 16:09:22 Translation Error
Internal error IndexReduction.pantelidesIndexReduction failed! Found empty set of continuous equations. Use -d=bltdump to get more information.

[5] 16:09:22 Translation Error
Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!

Edited by: Arinomo23 - Dec-01-21 15:09:50
There are 0 guests and 0 other users also viewing this topic
You are here: