Skip to content

Commit

Permalink
Set quantity Modelica.SIunits.Period for sampleTime
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeu committed Mar 13, 2015
1 parent fb500b8 commit 0b327f8
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 29 deletions.
12 changes: 6 additions & 6 deletions Modelica_DeviceDrivers/Blocks/Communication.mo
Expand Up @@ -9,7 +9,7 @@ package Communication
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Communication.SharedMemory;
import Modelica_DeviceDrivers.Communication.SharedMemory_;
parameter Real sampleTime=0.01 "Sample time for input update";
parameter Modelica.SIunits.Period sampleTime=0.01 "Sample time for input update";
parameter Boolean autoBufferSize = false
"true, buffer size is deduced automatically, otherwise set it manually"
annotation(Dialog(group="Shared memory partition"), choices(__Dymola_checkBox=true));
Expand Down Expand Up @@ -53,7 +53,7 @@ provided by the parameter <b>memoryID</b>. If the shared memory partition does n
extends Modelica_DeviceDrivers.Utilities.Icons.SharedMemoryIcon;
import Modelica_DeviceDrivers.Packaging.SerialPackager;
import Modelica_DeviceDrivers.Communication.SharedMemory;
parameter Real sampleTime=0.01 "Sample time for update";
parameter Modelica.SIunits.Period sampleTime=0.01 "Sample time for update";
parameter Boolean autoBufferSize = false
"true, buffer size is deduced automatically, otherwise set it manually"
annotation(Dialog(group="Shared memory partition"), choices(__Dymola_checkBox=true));
Expand Down Expand Up @@ -101,7 +101,7 @@ provided by the parameter <b>memoryID</b>. If the shared memory partition does n
import Modelica_DeviceDrivers.Packaging.SerialPackager;
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Communication.UDPSocket;
parameter Real sampleTime=0.01 "Sample time for input update";
parameter Modelica.SIunits.Period sampleTime=0.01 "Sample time for input update";
parameter Boolean autoBufferSize = true
"true, buffer size is deduced automatically, otherwise set it manually"
annotation(Dialog(group="Incoming data"), choices(__Dymola_checkBox=true));
Expand Down Expand Up @@ -148,7 +148,7 @@ provided by the parameter <b>memoryID</b>. If the shared memory partition does n
import Modelica_DeviceDrivers.Packaging.SerialPackager;
import Modelica_DeviceDrivers.Communication.UDPSocket;

parameter Real sampleTime=0.01 "Sample time for update";
parameter Modelica.SIunits.Period sampleTime=0.01 "Sample time for update";
parameter Boolean autoBufferSize = true
"true, buffer size is deduced automatically, otherwise set it manually."
annotation(Dialog(group="Outgoing data"), choices(__Dymola_checkBox=true));
Expand Down Expand Up @@ -198,7 +198,7 @@ provided by the parameter <b>memoryID</b>. If the shared memory partition does n
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Communication.SerialPort;
import Modelica_DeviceDrivers.Utilities.Types.SerialBaudRate;
parameter Real sampleTime=0.01 "Sample time for input update";
parameter Modelica.SIunits.Period sampleTime=0.01 "Sample time for input update";
parameter Boolean autoBufferSize = true
"true, buffer size is deduced automatically, otherwise set it manually"
annotation(Dialog(group="Incoming data"), choices(__Dymola_checkBox=true));
Expand Down Expand Up @@ -258,7 +258,7 @@ See <a href=\"modelica://Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackag
import Modelica_DeviceDrivers.Communication.SerialPort;
import Modelica_DeviceDrivers.Utilities.Types.SerialBaudRate;

parameter Real sampleTime=0.01 "Sample time for update";
parameter Modelica.SIunits.Period sampleTime=0.01 "Sample time for update";
parameter Boolean autoBufferSize = true
"true, buffer size is deduced automatically, otherwise set it manually."
annotation(Dialog(group="Outgoing data"), choices(__Dymola_checkBox=true));
Expand Down
12 changes: 6 additions & 6 deletions Modelica_DeviceDrivers/Blocks/HardwareIO.mo
Expand Up @@ -38,7 +38,7 @@ package HardwareIO
import Modelica_DeviceDrivers.Blocks.HardwareIO.Comedi.Types;
import Modelica_DeviceDrivers.HardwareIO.Comedi;

parameter Real sampleTime = 0.01 "Sample time of block";
parameter Modelica.SIunits.Period sampleTime = 0.01 "Sample time of block";
parameter Comedi comedi "Handle to comedi device";
parameter Integer subDevice=1 "Subdevice";
parameter Integer channel=0 "Channel";
Expand Down Expand Up @@ -78,7 +78,7 @@ package HardwareIO
import Modelica_DeviceDrivers.Blocks.HardwareIO.Comedi.Types;
import Modelica_DeviceDrivers.HardwareIO.Comedi;

parameter Real sampleTime = 0.01 "Sample time of block";
parameter Modelica.SIunits.Period sampleTime = 0.01 "Sample time of block";
parameter Comedi comedi "Handle to comedi device";
parameter Integer subDevice=0 "Subdevice";
parameter Integer channel=0 "Channel";
Expand Down Expand Up @@ -122,7 +122,7 @@ package HardwareIO
import Modelica_DeviceDrivers.Blocks.HardwareIO.Comedi.Types;
import Modelica_DeviceDrivers.HardwareIO.Comedi;

parameter Real sampleTime = 0.01 "Sample time of block";
parameter Modelica.SIunits.Period sampleTime = 0.01 "Sample time of block";
parameter Comedi comedi "Handle to comedi device";
parameter Integer subDevice=1 "Subdevice";
parameter Integer channel=0 "Channel";
Expand Down Expand Up @@ -181,7 +181,7 @@ package HardwareIO
import Modelica_DeviceDrivers.Blocks.HardwareIO.Comedi.Types;
import Modelica_DeviceDrivers.HardwareIO.Comedi;

parameter Real sampleTime = 0.01 "Sample time of block";
parameter Modelica.SIunits.Period sampleTime = 0.01 "Sample time of block";
parameter Comedi comedi "Handle to comedi device";
parameter Integer subDevice=0 "Subdevice";
parameter Integer channel=0 "Channel";
Expand Down Expand Up @@ -243,7 +243,7 @@ package HardwareIO
import Modelica_DeviceDrivers.Blocks.HardwareIO.Comedi.Types;
import Modelica_DeviceDrivers.HardwareIO.Comedi;

parameter Real sampleTime = 0.01 "Sample time of block";
parameter Modelica.SIunits.Period sampleTime = 0.01 "Sample time of block";
parameter Comedi comedi "Handle to comedi device";
parameter Integer subDevice=2 "Subdevice";
parameter Integer channel=0 "Channel";
Expand Down Expand Up @@ -284,7 +284,7 @@ package HardwareIO
import Modelica_DeviceDrivers.Blocks.HardwareIO.Comedi.Types;
import Modelica_DeviceDrivers.HardwareIO.Comedi;

parameter Real sampleTime = 0.01 "Sample time of block";
parameter Modelica.SIunits.Period sampleTime = 0.01 "Sample time of block";
parameter Comedi comedi "Handle to comedi device";
parameter Integer subDevice=2 "Subdevice";
parameter Integer channel=0 "Channel";
Expand Down
15 changes: 7 additions & 8 deletions Modelica_DeviceDrivers/Blocks/InputDevices.mo
Expand Up @@ -5,7 +5,7 @@ package InputDevices
"Joystick input implementation for interactive simulations"
extends Modelica_DeviceDrivers.Utilities.Icons.BaseIcon;
import Modelica_DeviceDrivers.InputDevices.GameController;
parameter Real sampleTime = 0.01 "sample time for input update";
parameter Modelica.SIunits.Period sampleTime = 0.01 "sample time for input update";
parameter Real gain[6] = ones(6) "gain of axis output";
parameter Integer ID= 0
"ID number of the joystick (0 = first joystick attached to the system)";
Expand Down Expand Up @@ -36,7 +36,7 @@ package InputDevices
block KeyboardKeyInput
"Keyboard input implementation for interactive simulations"
extends Modelica_DeviceDrivers.Utilities.Icons.BaseIcon;
parameter Real sampleTime=0.01 "sample time for input update";
parameter Modelica.SIunits.Period sampleTime=0.01 "sample time for input update";
parameter Modelica_DeviceDrivers.Blocks.InputDevices.Types.keyCodes keyCode="Return"
"Monitored Key";
parameter Boolean useKeyKombination=false
Expand Down Expand Up @@ -96,7 +96,7 @@ package InputDevices
Integer keyStateInt(start=0, fixed=true);
Integer additionalKeyStateInt(start=0, fixed=true);
equation
when (sample(0, sampleTime)) then
when sample(0, sampleTime) then
keyStateInt = Modelica_DeviceDrivers.InputDevices.Keyboard.getKey(keyCodeInt); //getting the KeyCode
additionalKeyStateInt = Modelica_DeviceDrivers.InputDevices.Keyboard.getKey(additionalKeyCodeInt);
end when;
Expand Down Expand Up @@ -158,7 +158,7 @@ package InputDevices
block SpaceMouseInput
"SpaceMouse input implementation for interactive simulations"
extends Modelica_DeviceDrivers.Utilities.Icons.BaseIcon;
parameter Real sampleTime = 0.01 "sample time for input update";
parameter Modelica.SIunits.Period sampleTime = 0.01 "sample time for input update";
parameter Real gain[6] = ones(6) "gain of axis output";
Modelica.Blocks.Interfaces.RealOutput axes[6]
annotation (Placement(transformation(extent={{100,50},{120,70}})));
Expand All @@ -171,8 +171,7 @@ package InputDevices
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
origin={50,60})));
equation
when
(sample(0,sampleTime)) then
when sample(0,sampleTime) then
(AxesRaw,buttons) = Modelica_DeviceDrivers.InputDevices.SpaceMouse.getData();
end when;
firstOrder.u = AxesRaw/400 .*gain;
Expand All @@ -193,7 +192,7 @@ package InputDevices
block KeyboardInput
"Keyboard input implementation for interactive simulations"
extends Modelica_DeviceDrivers.Utilities.Icons.BaseIcon;
parameter Real sampleTime = 0.01 "sample time for input update";
parameter Modelica.SIunits.Period sampleTime = 0.01 "sample time for input update";
Modelica.Blocks.Interfaces.BooleanOutput keyUp
annotation (Placement(transformation(extent={{100,50},{120,70}})));
Modelica.Blocks.Interfaces.BooleanOutput keyDown
Expand All @@ -218,7 +217,7 @@ package InputDevices
protected
Integer KeyCode[10](each start=0, each fixed=true);
equation
when (sample(0,sampleTime)) then
when sample(0,sampleTime) then
KeyCode = Modelica_DeviceDrivers.InputDevices.Keyboard.getData();
//getting the KeyCode
end when;
Expand Down
2 changes: 1 addition & 1 deletion Modelica_DeviceDrivers/Blocks/OperatingSystem.mo
Expand Up @@ -76,7 +76,7 @@ package OperatingSystem
block RandomRealSource
extends Modelica_DeviceDrivers.Utilities.Icons.BaseIcon;
parameter Integer n=1 "Dimension of output vector";
parameter Real sampleTime = 0.01 "Sample time of random number generation";
parameter Modelica.SIunits.Period sampleTime = 0.01 "Sample time of random number generation";
input Real minValue[n]={0} "maximum Value of random output" annotation (Dialog = true);
input Real maxValue[n]={1} "maximum Value of random output" annotation (Dialog = true);

Expand Down
2 changes: 1 addition & 1 deletion Modelica_DeviceDrivers/Blocks/Packaging/SerialPackager.mo
Expand Up @@ -194,7 +194,7 @@ package SerialPackager "Blocks for constructing packages"
parameter Boolean useBackwardSampleTimePropagation = true
"true, use backward propagation for sample time (default!), otherwise switch to forward propagation"
annotation(Dialog(tab="Advanced"), choices(__Dymola_checkBox=true));
parameter Real sampleTime=0.01
parameter Modelica.SIunits.Period sampleTime=0.01
"Sample time if forward propagation of sample time is used" annotation (Dialog(enable = not useBackwardSampleTimePropagation, tab="Advanced"));

parameter Boolean useBackwardPropagatedBufferSize = true
Expand Down
1 change: 0 additions & 1 deletion Modelica_DeviceDrivers/ClockedBlocks/InputDevices.mo
Expand Up @@ -197,7 +197,6 @@ package InputDevices
"Keyboard input implementation for interactive simulations"

extends Modelica_DeviceDrivers.Utilities.Icons.BaseIcon;
parameter Real sampleTime = 0.01 "sample time for input update";
Modelica.Blocks.Interfaces.BooleanOutput keyUp
annotation (Placement(transformation(extent={{100,50},{120,70}})));
Modelica.Blocks.Interfaces.BooleanOutput keyDown
Expand Down
2 changes: 1 addition & 1 deletion Modelica_DeviceDrivers/Incubate/Blocks/Communication.mo
Expand Up @@ -9,7 +9,7 @@ package Communication
import Modelica_DeviceDrivers.Packaging.SerialPackager;
import Modelica_DeviceDrivers.Packaging.alignAtByteBoundary;
import Modelica_DeviceDrivers.Communication.UDPSocket;
parameter Real sampleTime=0.01 "Sample time for input update";
parameter Modelica.SIunits.Period sampleTime=0.01 "Sample time for input update";
parameter Boolean autoBufferSize = true
"true, buffer size is deduced automatically, otherwise set it manually"
annotation(Dialog(group="Incoming data"), choices(__Dymola_checkBox=true));
Expand Down
8 changes: 3 additions & 5 deletions Modelica_DeviceDrivers/Incubate/Blocks/Logging.mo
Expand Up @@ -4,16 +4,14 @@ package Logging "a collection of logging blocks"
model LogVector "Logs a vector to disk in csv format"
extends Modelica_DeviceDrivers.Utilities.Icons.BaseIcon;
parameter String filename = "result.log" "Filename for the logging file";
parameter Real sampleTime = 0.01 "Sample time of logging";
parameter Modelica.SIunits.Period sampleTime = 0.01 "Sample time of logging";
parameter Integer n=1 "Vector size";

Modelica.Blocks.Interfaces.RealInput u[n]
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
equation
when
(sample(0,sampleTime)) then
Modelica.Utilities.Streams.print(Modelica_DeviceDrivers.Incubate.Utilities.Functions.vectorToString(
u),filename);
when sample(0,sampleTime) then
Modelica.Utilities.Streams.print(Modelica_DeviceDrivers.Incubate.Utilities.Functions.vectorToString(u),filename);
end when;
annotation (Icon(graphics={Ellipse(extent={{-80,0},{80,-60}}, lineColor={0,0,
255},
Expand Down

0 comments on commit 0b327f8

Please sign in to comment.