Skip to content

Commit

Permalink
Fixed missing byteOrder in clocked blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhard-thiele committed Sep 14, 2015
1 parent d4b00eb commit 921aa00
Showing 1 changed file with 38 additions and 14 deletions.
52 changes: 38 additions & 14 deletions Modelica_DeviceDrivers/ClockedBlocks/Packaging.mo
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@ package Packaging
input Modelica_DeviceDrivers.Packaging.SerialPackager pkg;
input Real u[:];
input Real dummy;
input Modelica_DeviceDrivers.Utilities.Types.ByteOrder byteOrder;
output Real dummy2;
algorithm
Modelica_DeviceDrivers.Packaging.SerialPackager_.addReal(pkg,u);
Modelica_DeviceDrivers.Packaging.SerialPackager_.addReal(pkg,u, byteOrder);
dummy2 :=dummy;
end addReal;

function addRealAsFloat
input Modelica_DeviceDrivers.Packaging.SerialPackager pkg;
input Real u[:];
input Real dummy;
input Modelica_DeviceDrivers.Utilities.Types.ByteOrder byteOrder;
output Real dummy2;
algorithm
Modelica_DeviceDrivers.Packaging.SerialPackager_.addRealAsFloat(pkg,u);
Modelica_DeviceDrivers.Packaging.SerialPackager_.addRealAsFloat(pkg,u,byteOrder);
dummy2 :=dummy;
end addRealAsFloat;

Expand All @@ -64,31 +66,34 @@ package Packaging
input Modelica_DeviceDrivers.Packaging.SerialPackager pkg;
input Integer u[:];
input Real dummy;
input Modelica_DeviceDrivers.Utilities.Types.ByteOrder byteOrder;
output Real dummy2;
algorithm
Modelica_DeviceDrivers.Packaging.SerialPackager_.addInteger(pkg,u);
Modelica_DeviceDrivers.Packaging.SerialPackager_.addInteger(pkg, u, byteOrder);
dummy2 := dummy;
end addInteger;

function getReal
input Modelica_DeviceDrivers.Packaging.SerialPackager pkg;
input Integer n;
input Real dummy;
input Modelica_DeviceDrivers.Utilities.Types.ByteOrder byteOrder;
output Real y[n];
output Real dummy2;
algorithm
y := Modelica_DeviceDrivers.Packaging.SerialPackager_.getReal(pkg, n);
y := Modelica_DeviceDrivers.Packaging.SerialPackager_.getReal(pkg, n, byteOrder);
dummy2 :=dummy;
end getReal;

function getRealFromFloat
input Modelica_DeviceDrivers.Packaging.SerialPackager pkg;
input Integer n;
input Real dummy;
input Modelica_DeviceDrivers.Utilities.Types.ByteOrder byteOrder;
output Real y[n];
output Real dummy2;
algorithm
y := Modelica_DeviceDrivers.Packaging.SerialPackager_.getRealFromFloat(pkg, n);
y := Modelica_DeviceDrivers.Packaging.SerialPackager_.getRealFromFloat(pkg, n, byteOrder);
dummy2 :=dummy;
end getRealFromFloat;

Expand All @@ -105,10 +110,11 @@ package Packaging
input Modelica_DeviceDrivers.Packaging.SerialPackager pkg;
input Integer n;
input Real dummy;
input Modelica_DeviceDrivers.Utilities.Types.ByteOrder byteOrder;
output Integer y[n];
output Real dummy2;
algorithm
y := Modelica_DeviceDrivers.Packaging.SerialPackager_.getInteger(pkg, n);
y := Modelica_DeviceDrivers.Packaging.SerialPackager_.getInteger(pkg, n, byteOrder);
dummy2 :=dummy;
end getInteger;

Expand Down Expand Up @@ -265,7 +271,9 @@ package Packaging
extends
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.PartialSerialPackager;
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Utilities.Types.ByteOrder;
parameter Integer n = 1;
parameter ByteOrder byteOrder = ByteOrder.LE;
Modelica.Blocks.Interfaces.IntegerInput u[n]
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
equation
Expand All @@ -275,7 +283,8 @@ package Packaging
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.DummyFunctions.addInteger(
pkgOut.pkg,
u,
pkgIn.dummy);
pkgIn.dummy,
byteOrder);
annotation (Icon(graphics={
Text(
extent={{-100,-50},{100,-90}},
Expand All @@ -297,7 +306,9 @@ package Packaging
extends
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.PartialSerialPackager;
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Utilities.Types.ByteOrder;
parameter Integer n = 1;
parameter ByteOrder byteOrder = ByteOrder.LE;
Modelica.Blocks.Interfaces.RealInput u[n]
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
equation
Expand All @@ -307,7 +318,8 @@ package Packaging
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.DummyFunctions.addReal(
pkgOut.pkg,
u,
pkgIn.dummy);
pkgIn.dummy,
byteOrder);
annotation (Icon(graphics={
Text(
extent={{-100,-50},{100,-90}},
Expand All @@ -332,7 +344,9 @@ package Packaging
extends
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.PartialSerialPackager;
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Utilities.Types.ByteOrder;
parameter Integer n = 1;
parameter ByteOrder byteOrder = ByteOrder.LE;
Modelica.Blocks.Interfaces.RealInput u[n]
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
equation
Expand All @@ -342,7 +356,8 @@ package Packaging
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.DummyFunctions.addRealAsFloat(
pkgOut.pkg,
u,
pkgIn.dummy);
pkgIn.dummy,
byteOrder);
annotation (Icon(graphics={
Text(
extent={{-100,-50},{100,-90}},
Expand Down Expand Up @@ -442,7 +457,9 @@ package Packaging
extends
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.PartialSerialPackager;
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Utilities.Types.ByteOrder;
parameter Integer n = 1;
parameter ByteOrder byteOrder = ByteOrder.LE;
Modelica.Blocks.Interfaces.IntegerOutput y[n]
annotation (Placement(transformation(extent={{100,-10},{120,10}})));
protected
Expand All @@ -455,7 +472,8 @@ package Packaging
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.DummyFunctions.getInteger(
pkgIn.pkg,
n,
pkgIn.dummy);
pkgIn.dummy,
byteOrder);
pkgOut.dummy = fill(dummy,nu);
end when;

Expand All @@ -480,7 +498,9 @@ package Packaging
extends
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.PartialSerialPackager;
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Utilities.Types.ByteOrder;
parameter Integer n = 1;
parameter ByteOrder byteOrder = ByteOrder.LE;
Modelica.Blocks.Interfaces.RealOutput y[n]
annotation (Placement(transformation(extent={{100,-10},{120,10}})));
protected
Expand All @@ -493,7 +513,8 @@ package Packaging
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.DummyFunctions.getReal(
pkgIn.pkg,
n,
pkgIn.dummy);
pkgIn.dummy,
byteOrder);
pkgOut.dummy = fill(dummy,nu);
end when;

Expand Down Expand Up @@ -521,7 +542,9 @@ package Packaging
extends
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.PartialSerialPackager;
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Utilities.Types.ByteOrder;
parameter Integer n = 1;
parameter ByteOrder byteOrder = ByteOrder.LE;
Modelica.Blocks.Interfaces.RealOutput y[n]
annotation (Placement(transformation(extent={{100,-10},{120,10}})));
protected
Expand All @@ -534,7 +557,8 @@ package Packaging
Modelica_DeviceDrivers.ClockedBlocks.Packaging.SerialPackager.Internal.DummyFunctions.getRealFromFloat(
pkgIn.pkg,
n,
pkgIn.dummy);
pkgIn.dummy,
byteOrder);
pkgOut.dummy = fill(dummy,nu);
end when;

Expand Down Expand Up @@ -611,7 +635,7 @@ package Packaging
pkgIn.dummy);
end when;
annotation (defaultComponentName="packInt",
Icon(graphics={
Icon(graphics={
Text(
extent={{-120,40},{-40,-40}},
lineColor={255,127,0},
Expand Down Expand Up @@ -654,7 +678,7 @@ package Packaging
end when;

annotation (defaultComponentName="unpackInt",
Icon(graphics={
Icon(graphics={
Bitmap(extent={{-7,19},{57,-20}}, fileName=
"Modelica://Modelica_DeviceDrivers/Resources/Images/Icons/Bit2IntArrow.png"),
Text(
Expand Down

0 comments on commit 921aa00

Please sign in to comment.