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

Using Modelica Device Drivers Library

Using Modelica Device Drivers Library

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!!

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