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

Defining electrical Pins as an Output

Defining electrical Pins as an Output

Hello,

i want to use FMU´s which calculate electrical circuits to run in CO-Simulation.

With Real-values, everything works fine, but with currents and voltages,  it doesn´t work.

I use the PyFMI Master, which means, I simulate with to separate FMU´s.

When i try to transfer the currents and voltages through the Pin via following line, i receive the Error:

Code:

connections = [( spannung ,"pin.i",widerstand ,"pin.i"),

               ( spannung ,"pin.v",widerstand ,"pin.v")]

The connection variable pin.i in model spannung is not an output.

For me, the best would be if I could directly connect the pins. Is that somehow possible?

Or can the "pin" be redefined as an output?
My tries to do this didn´t work, probably because of problems with the flowing current.

I would really appreciate any help!

Regards

Mota

Edited by: Mota - Jan-28-20 12:14:07

Re: Defining electrical Pins as an Output

I found a solution for the Output:

Code:



connector Pin_Out "Pin of an electrical component"
output SI.ElectricPotential v;
flow output SI.Current i;
    annotation(...);
end Pin_Out;

But defining a pin as an input does not work like this, at least I could not figure out why. Every time i try, i just get over- or underdetermined equation system when i try to generate the FMU.


Running a simulation with a direct connection works with a similar input-pin

Code:

connector Pin_in2 "Pin of an electrical component"

input SI.ElectricPotential v;
flow input SI.Current i;
   annotation(...);
end Pin_in2;

I think the problem is that i can not include equations in a connector. Using a model-block instead, inserting a normal pin creates an additional equation which overdetermines my system.

Anyone any idea how to solve this problem and write an exportable input pin?

Best regards

Mota


Re: Defining electrical Pins as an Output

Hi:
I’m are afraid I don’t understand well which is the problem. I see you are defining the pins as connectors with one potential variable (voltage) and one flow variable (intensity). In this situation there is no need to define the potential variable as input or output, although it can be done, and two pins should be connected with no problem. In fact I think that the flow variable can’t be defined as input or output, but I’m not sure.

Re: Defining electrical Pins as an Output

Hello,

yes, in openmodelica, the model runs without any problems.

But when i try to export the FMU and run them in co-simulation via PyFMI Master, it doesnt work with those pins.

Then i just receive the error message:



pin.v is not defined as output



I fixed the problem with the the output, but not the problem with the input.

So I would be really thankful for any help!

Best regards

Mota

Edited by: Mota - Jan-30-20 13:41:37
There are 0 guests and 0 other users also viewing this topic
You are here: