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
  • » DHexpert
  • » Profile

Posts

Posts

May-02-17 12:11:55
Understanding of the connection logic of Modelica for the case of writing own block with boolean...
Category: Programming

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?

May-02-17 11:51:37
The problem is structurally singular. It has 1220 scalar unknowns and 1220 scalar equations.

I am a beginner in modelica and using Dymola. This is a common error that I receive at most "The problem is structurally singular for the element type Real".

Can anybody explain what to check in the model when this error is issued?

Regards.

May-02-17 11:31:16
Understanding of the connection logic of Modelica for the case of writing own block with boolean...
Category: Programming

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.

Apr-28-17 14:50:17
Re: Modelica.Blocks.Logical.Edge / Modelica.Blocks.MathBoolean.RisingEdge
Category: Programming

Briant wrote:


Hello Hakan,

I assume that the function does work well, but it is not visible in the plot view. The output is only a "One Shot", which means that its change from 0 to 1 and back to 0 happens for a very short time only. Can you try to connect the output to the S port of a Modelica.Blocks.Logical.RSFlipFlop? If it works, you should see the output of the FlipFlop change to 1 permanently.

I checked your message late so couldn't check RSFlipFlop. But by chance I could find the built-in block that I have been in need; that is (Modelica.Blocks.MathInteger.)TriggeredAdd so no need to deal with textual coding any more (except solving this integer input issue -I need Real- but may be not necessary).

So this TriggeredAdd exactly solves my need since it catches the moment when the condition reached(RisingEdge) and provides a new output value with this trigger (the condition satisfaction) continuously.

Thank you Briant.

Apr-28-17 14:19:19
Boolean input based continuous output

SOLVED: I could find this Modelica.Blocks.MathInteger.TriggeredAdd by chance. When there is a trigger (the moment the condition satisfied -that is RisingEdge-) by the Boolean input to this block it resets the output to a new value to be stayed as consistent.

This is exactly what I needed. Now checking the textual codes to have the understanding of it (and of Modelica).

Apr-28-17 12:28:46
Boolean input based continuous output

May be the solution is simple but couldn't find. Quick solution can be rewarding.

I try to build a new control unit. It is checking the measurement at a point in my hydraulic network and when its value becomes less than the criteria; I want this control unit increase the set value at another point in my hydraulic network. After this moment of the simulation, I want my hydraulic system operate with this new set value.

The problem is that: the conditional statements (i.e. if u1<=threshold then y:=u2+increase else y:=50-fictional example value-) in modelica have a continuous time varying influence of the output, in detail: the y value changes (y:=u2+increase) only while the if/when condition is being satisfied and at the following time steps when the condition becomes non-satisfied it reverts to else condition (y:=50). I want to add "// do nothing" for else condition but not working. But this is still due to the nature of the modelica that is being 'if/when condition met make the calculation or revert to else', if I understand correctly.

What I want is to give the increase in y value when the if/when conditions satisfied and have the new y value as constant permanently after that.

A quick response will be appreciated a lot.
Regards.

Apr-27-17 08:07:01
Re: Modelica.Blocks.Logical.Edge / Modelica.Blocks.MathBoolean.RisingEdge
Category: Programming

Hello,

I need this RisingEdge function or block to give an one-time signal to my controller when the criteria from the ongoing measurement reaches to a certain value. The reason for that is because my hydronic system is slow responding (criteria reached: controller appoint a new set-point: wait for the new steady-state condition).

Attached picture: I modelled a simple system with boolean step source-block as input to the RisingEdge block. When the step response changes from false to true the RisingEdge has to react with one time true signal, right? But not. Can you please help me solving this issue?

http://i64.tinypic.com/293eo2o.jpg

Regards.
Hakan

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