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
  • » dileep.krishnan
  • » Profile

Posts

Posts

sjoelund.se wrote:

your system

May be a few details about my system would throw some light into the issue.

I am using Raspberry Pi 3 Model B V1.2 With Ubuntu Mate 16.04.3. The command

Code:

uname -a

gives the following output.

Code:

Linux mavlab-RPi3 4.14.24-v7+ #1097 SMP Mon Mar 5 16:42:05 GMT 2018 armv7l armv7l armv7l GNU/Linux

I tried using older versions of OM, but the issue still persists.
Please let me know if any more details are required in this regard.

HI There!
I am also facing the same issue as

ritexarma wrote:

Compilation fails saying [ clang: error: the clang compiler does not support '-march=native' ]

. Has anyone resolved this issue?

Hello,
I am trying to use Modelica Device Drivers Library to send some serial data through COM port and receive the data at the other end using a null modem. The model compiles and runs but, no data is sent over the serial port. Below is the code that I used.

Code:

model serialTest

  Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.Packager packager1(enableExternalTrigger = false, useBackwardPropagatedBufferSize = false, useBackwardSampleTimePropagation = true);
  Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.AddFloat addFloat1(byteOrder = Modelica_DeviceDrivers.Utilities.Types.ByteOrder.LE,n = 1, nu = 1);
  Modelica.Blocks.Sources.RealExpression realExpression1(y = 35.68 * 21.25);
  Modelica_DeviceDrivers.Blocks.Communication.SerialPortSend serialPortSend1(Serial_Port = "COM3", autoBufferSize = true, baud = Modelica_DeviceDrivers.Utilities.Types.SerialBaudRate.B9600, enableExternalTrigger = false, parity = 0, sampleTime = 0.1, startTime = 0, userBufferSize = 16 * 64);
  Modelica_DeviceDrivers.Blocks.OperatingSystem.SynchronizeRealtime synchronizeRealtime1;
equation
  connect(serialPortSend1.pkgIn, addFloat1.pkgOut[1]);
  connect(realExpression1.y, addFloat1.u[1]);
  connect(addFloat1.pkgIn, packager1.pkgOut);
  annotation(
    uses(Modelica_DeviceDrivers(version = "1.4.4"), Modelica(version = "3.2.2")));
end serialTest;

I am using Windows 7 x64 OS with OpenModelica v1.11.0-dev.beta1-10-g789afa4 (64-bit).
For serial port, I am using an FTDI device, which is recognized by the OS as COM3.

Please let me know what went wrong and how to make the data transfer.  Thanks in advance!!

I am trying to toggle a boolean variable depending on some condition as per the following code.

Code:

model boolean_logic_try

 
  Boolean dio_out;
  Boolean dio_out1;

  equation
  if (mod(time,0.01) == 0.0) then
    dio_out1 = not dio_out;
  else
    dio_out1 = dio_out;
  end if;
  dio_out = dio_out1;
 
end boolean_logic_try;

But, I am getting the following error in compilation stage as follows.

Code:

boolean_logic_try_02nls.c: In function 'initializeStaticDataNLS2':

boolean_logic_try_02nls.c:35:84: error: 'BOOLEAN_ATTRIBUTE {aka struct BOOLEAN_ATTRIBUTE}' has no member named 'nominal'
   sysData->nominal[i] = data->modelData->booleanVarsData[0].attribute /* dio_out */.nominal;
                                                                                    ^
boolean_logic_try_02nls.c:36:84: error: 'BOOLEAN_ATTRIBUTE {aka struct BOOLEAN_ATTRIBUTE}' has no member named 'min'
   sysData->min[i]     = data->modelData->booleanVarsData[0].attribute /* dio_out */.min;
                                                                                    ^
boolean_logic_try_02nls.c:37:84: error: 'BOOLEAN_ATTRIBUTE {aka struct BOOLEAN_ATTRIBUTE}' has no member named 'max'
   sysData->max[i++]   = data->modelData->booleanVarsData[0].attribute /* dio_out */.max;
                                                                                    ^
boolean_logic_try_02nls.c: In function 'initializeStaticDataNLS4':
boolean_logic_try_02nls.c:70:84: error: 'BOOLEAN_ATTRIBUTE {aka struct BOOLEAN_ATTRIBUTE}' has no member named 'nominal'
   sysData->nominal[i] = data->modelData->booleanVarsData[0].attribute /* dio_out */.nominal;
                                                                                    ^
boolean_logic_try_02nls.c:71:84: error: 'BOOLEAN_ATTRIBUTE {aka struct BOOLEAN_ATTRIBUTE}' has no member named 'min'
   sysData->min[i]     = data->modelData->booleanVarsData[0].attribute /* dio_out */.min;
                                                                                    ^
boolean_logic_try_02nls.c:72:84: error: 'BOOLEAN_ATTRIBUTE {aka struct BOOLEAN_ATTRIBUTE}' has no member named 'max'
   sysData->max[i++]   = data->modelData->booleanVarsData[0].attribute /* dio_out */.max;
                                                                                    ^
boolean_logic_try_02nls.c: In function 'boolean_logic_try_initialNonLinearSystem':
boolean_logic_try_02nls.c:96:43: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
   nonLinearSystemData[0].getIterationVars = getIterationVarsNLS2;
                                           ^
boolean_logic_try_02nls.c:108:43: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
   nonLinearSystemData[1].getIterationVars = getIterationVarsNLS4;
                                           ^
<builtin>: recipe for target 'boolean_logic_try_02nls.o' failed
\tools\msys\mingw64\bin\mingw32-make: *** [boolean_logic_try_02nls.o] Error 1
\tools\msys\mingw64\bin\mingw32-make: *** Waiting for unfinished jobs....
Compilation process failed. Exited with code 2.

Is there a problem with my logic or something else?
Any help will be greatly appreciated. Thanks in advance.

Jan-13-17 14:00:22
Category: Programming

Thanks for the prompt reply.
Is there any other way, that I can assign values to the variable attributes?

Jan-13-17 13:42:23
Category: Programming

Hello,
I am trying to access the initial condition of the variable in a sub class. The code is as given below.

Code:

class MainClass001

  class SubClass001
    Modelica.Blocks.Interfaces.RealInput u annotation(
      Placement(visible = true, transformation(origin = {-106, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-106, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
    Modelica.Blocks.Interfaces.RealOutput y annotation(
      Placement(visible = true, transformation(origin = {106, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {106, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); 
    Modelica.SIunits.Angle phi(start=0) "phi";   
  equation
    der(phi) = u;
    y = phi; 
  end SubClass001;
  class SubClass002
    Modelica.Blocks.Interfaces.RealInput u annotation(
      Placement(visible = true, transformation(origin = {-108, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-108, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
    Modelica.Blocks.Interfaces.RealOutput y annotation(
      Placement(visible = true, transformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  MainClass001.SubClass001 subClass0011 annotation(
      Placement(visible = true, transformation(origin = {0, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
    parameter Real initial_condition "Initial condition for phi";   
    equation
    subClass0011.phi.start = initial_condition;
    connect(subClass0011.u,u);
    connect(subClass0011.y,y); 
  end SubClass002;
  annotation(
    uses(Modelica(version = "3.2.2")));
end MainClass001;

I am getting the following error.

Code:

[1] 19:07:32 Translation Error

[MainClass001: 26:5-26:47]: Variable subClass0011.phi.start not found in scope MainClass001.SubClass002.

[2] 19:07:32 Translation Error
Error occurred while flattening model MainClass001.SubClass002

Please let me know how to resolve this issue. It would be a great help if I could get through this.
Thanks in advance!!

  • Index
  • » Users
  • » dileep.krishnan
  • » Profile
You are here: