diff options
author | Siddharth11235 | 2019-09-03 18:09:16 +0530 |
---|---|---|
committer | Siddharth11235 | 2019-09-03 18:09:16 +0530 |
commit | b4b6aa36e3486a3544acc52419149b5671f841e9 (patch) | |
tree | 66c1783158f23e6d21c77324156fc57e18d4ac67 /avr_test.mo | |
parent | f5266f634f4fb4fd39933a83551a01cf446256b8 (diff) | |
download | OpenModelica_HIL-b4b6aa36e3486a3544acc52419149b5671f841e9.tar.gz OpenModelica_HIL-b4b6aa36e3486a3544acc52419149b5671f841e9.tar.bz2 OpenModelica_HIL-b4b6aa36e3486a3544acc52419149b5671f841e9.zip |
Diffstat (limited to 'avr_test.mo')
-rwxr-xr-x | avr_test.mo | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/avr_test.mo b/avr_test.mo new file mode 100755 index 0000000..8f510fd --- /dev/null +++ b/avr_test.mo @@ -0,0 +1,29 @@ +within MDD_Practice; +model avr_test + + Modelica.Blocks.Sources.Sine sine1(amplitude = 100, freqHz = 0.25, offset = 50) annotation( + Placement(visible = true, transformation(origin = {-72, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.Packager packager1(useBackwardPropagatedBufferSize = true, useBackwardSampleTimePropagation = true, userBufferSize = 16 * 64) annotation( + Placement(visible = true, transformation(origin = {-30, 76}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.AddReal addReal1(byteOrder = Modelica_DeviceDrivers.Utilities.Types.ByteOrder.LE, n = 1, nu = 1) annotation( + Placement(visible = true, transformation(origin = {-30, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica_DeviceDrivers.Blocks.Communication.SerialPortSend serialPortSend1(Serial_Port = "/dev/ttyACM1",autoBufferSize = true, baud = Modelica_DeviceDrivers.Utilities.Types.SerialBaudRate.B9600, enableExternalTrigger = false, sampleTime = 0.1) annotation( + Placement(visible = true, transformation(origin = {-30, 4}, extent = {{-10, -10}, {10, 10}}, rotation = -90))); + Modelica_DeviceDrivers.Blocks.OperatingSystem.SynchronizeRealtime synchronizeRealtime1 annotation( + Placement(visible = true, transformation(origin = {68, 76}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + Modelica_DeviceDrivers.Blocks.Communication.SerialPortReceive serialPortReceive1(Serial_Port = "/dev/ttyACM1", autoBufferSize = true, baud = Modelica_DeviceDrivers.Utilities.Types.SerialBaudRate.B9600) annotation( + Placement(visible = true, transformation(origin = {32, 56}, extent = {{-10, -10}, {10, 10}}, rotation = -90))); + Modelica_DeviceDrivers.Blocks.Packaging.SerialPackager.GetReal getReal1 annotation( + Placement(visible = true, transformation(origin = {32,16}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); +equation + connect(serialPortReceive1.pkgOut, getReal1.pkgIn) annotation( + Line(points = {{32, 45}, {32, 27}})); + connect(addReal1.pkgOut[1], serialPortSend1.pkgIn) annotation( + Line(points = {{-30, 29.2}, {-30, 29.2}, {-30, 13.2}, {-30, 13.2}}, thickness = 0.5)); + connect(sine1.y, addReal1.u[1]) annotation( + Line(points = {{-61, 40}, {-43, 40}, {-43, 40}, {-43, 40}}, color = {0, 0, 127})); + connect(packager1.pkgOut, addReal1.pkgIn) annotation( + Line(points = {{-30, 65.2}, {-30, 65.2}, {-30, 49.2}, {-30, 49.2}})); + annotation( + uses(Modelica_DeviceDrivers(version = "1.5.0"), Modelica(version = "3.2.2"))); +end avr_test;
\ No newline at end of file |