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

How to Connect Input/s and Output/s

How to Connect Input/s and Output/s

Hello All,
I could understand the most in use of Modelica including of writing my own coding for user-defined blocks.
So far I have used the "extend" with selection of ready (built-in) interfaces in the Modelica library in order to have trouble-free block coding (easy involvement of input/output interfaces). In example: in order to have a block with boolean input and output, I added the code of 'extends Modelica.Blocks.Icons.BooleanBlock;' in my block code, then added the equation I wanted.

Now I need to have more flexibility in my block constitution with various types of interfaces (input and output) at various numbers. One example, I want to form a block with boolean and real inputs; and real output. How can I establish a connection between these inputs and output, both being different types (connection of boolean input with real output).

When extend is used with the built-in interfaces of blocks, you don't need to write a code with connect() operator. I want the same [no use of connect()] for my custom block codes without use of built-in block interfaces. Just simply, I want to add the input/s and output/s as much as I want and then I want to put the mathematical expression (equation) as textual code which calculates by use of the input/s and its result will determine the output.

Thanks in advance.

Re: How to Connect Input/s and Output/s

Weirdly my mistake. I don't know why I had the feeling of necessity to connect the input/s to output/s (probably due to a misunderstanding of the early errors when first started using modelica). So solution of my own question (previous post) is that after adding the input and output interfaces at the 'diagram' section::, changing to 'modelica text' section, I can simply just add equation which calculates by use of the input (real) or if-then-else conditions by use of boolean inputs, their results will give the output.

Can any of you suggest a good reference/s for textual coding in modelica?

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