Difference between revisions of "Exercise - Using Simulation Macros"
JohnVerrill (talk | contribs) |
JohnVerrill (talk | contribs) |
||
Line 16: | Line 16: | ||
The data sheet for the PIR shows that it is sensitive to a range of 10 metres, within a cone of angle 100 degrees. | The data sheet for the PIR shows that it is sensitive to a range of 10 metres, within a cone of angle 100 degrees. | ||
− | + | On the System Panel, create: | |
− | + | * a brick wall, represented by a red rectangle, 15mm wide, 120mm high and 120mm deep, | |
:: located at coordinates x = 10, y = 0, z = 60, | :: located at coordinates x = 10, y = 0, z = 60, | ||
:: with rotation settings X = 0, Y = o, Z = 180; | :: with rotation settings X = 0, Y = o, Z = 180; | ||
− | + | * a path, represented by a grey rectangle, 240mm wide, 100mm high and 0mm deep, | |
:: located at coordinatesx = 140mm, y = 0mm, z = 0mm, | :: located at coordinatesx = 140mm, y = 0mm, z = 0mm, | ||
:: with rotation settings of X = -180, Y = 0, Z = -180; | :: with rotation settings of X = -180, Y = 0, Z = -180; | ||
− | + | * a cone, couloured light blue, representing the sensing region of the PIR, with width = 70mm, height = 250mm, depth 95mm, | |
:: located at coordinates x = 55mm, y = 0mm, z = 80mm, | :: located at coordinates x = 55mm, y = 0mm, z = 80mm, | ||
:: with rotation settings of X = 0, Y = 55, Z = 180. | :: with rotation settings of X = 0, Y = 55, Z = 180. | ||
Line 29: | Line 29: | ||
− | + | Also on the System Panel, create an intruder, by: | |
: adding four spheres, and configuru=ing the properties as follows: | : adding four spheres, and configuru=ing the properties as follows: | ||
:: sphere 1 (the head) | :: sphere 1 (the head) |
Revision as of 18:00, 23 August 2013
Simulation macros are a form of Component macros. Their purpose is to make simulation more realistic by adding physical components to the electronic devices.
When the Flowcode program is compiled and downloaded to a microcontroller, they are ignored - hence the name Simulation macros.
Even a cursory glance at the dialogue box used to configure them shows that they are very powerful devices, with a huge range of possible effects.
This exercise uses two of them to illustrate the use of a PIR (passive infra-red sensor) to operate an intruder sensor.
The physical background
The scene depicts the front of a house. A PIR sensor is mounted on the wall of the house, above the path leading across the garden. The data sheet for the PIR shows that it is sensitive to a range of 10 metres, within a cone of angle 100 degrees.
On the System Panel, create:
- a brick wall, represented by a red rectangle, 15mm wide, 120mm high and 120mm deep,
- located at coordinates x = 10, y = 0, z = 60,
- with rotation settings X = 0, Y = o, Z = 180;
- a path, represented by a grey rectangle, 240mm wide, 100mm high and 0mm deep,
- located at coordinatesx = 140mm, y = 0mm, z = 0mm,
- with rotation settings of X = -180, Y = 0, Z = -180;
- a cone, couloured light blue, representing the sensing region of the PIR, with width = 70mm, height = 250mm, depth 95mm,
- located at coordinates x = 55mm, y = 0mm, z = 80mm,
- with rotation settings of X = 0, Y = 55, Z = 180.
- Drag the mouse cursor over these three elements and group them together.
Also on the System Panel, create an intruder, by:
- adding four spheres, and configuru=ing the properties as follows:
- sphere 1 (the head)
- Flowcode
- Experienced
- Students
Adding supplementary code
This feature
Definitions and function declarations:
This is
Function implementations: