We want to emulate a temperature control system, where the set point (ie the desired temperature) changes during the day - with colder temperatures at night and warmer temperatures in the morning and afternoon.
|time of day||set point|
Step 1. Understanding the timer subcomponent
We will use a timer in the supervisor to determine when to send set points to the servant (via required changed).
The timer subcomponent that we also used in tutorial (step 4 and 7) contain many different methods that can be used to implement different timings. Open the subcomponent PD 4404 Timer_subcomponent and read the explanations about the different methods.
Pay special attention to the method "Run_timermethod_at_time_of_day" as this is the one we will use for our temperature control system.
Note that all time in VIGO6 is expressed in UTC (coordinated universal time).
The method "Run_timermethod_at_time_of_day" makes sure that the timermethod runs every day at a specific amount of seconds after midnight.
Let us take an example:
We want our method to run at 06.30 Danish summertime, which is UTC+2.
Hence the time in UTC is 04.30. This corresponds to 4,5 hours*60 minutes/hour*60 seconds/minute = 16200 seconds.
For your convenience, here is the full list of seconds we will need for our temperature control system
|time of day||UTC time seconds||set point|
Video on the way
Step 2. Creating an array of time and set point pairs.
We need to build a structure that can hold 4 instances of time/set point pairs.
First we build a record containing two fields: time and set point, and then we will create an array of this record type.
Create a new record - rename to "temperature_control_data_rec". Add a record field of type "float 32", rename to "set point and set quantity type to "Absolute temperature". Add another record field of type "float32", rename to time and set quantity type to "TimeOfDay".
Create a new array of type "array". We wil learn about explandable arrays, adaptable arrays and subcomponent arrays later.
Rename the array to "temperature_control_data_array". Right click and set element type to "temperature_control_data_rec". Set "no of elements" to 4.
Click on the set_point record and set maximum limit to 100 degrees celcius and minimum to 0 degrees celcius.
We now have an array containing 4 records that we can use in our temperature control system.
Video on the way
Step 3. Creating visualisation of the array
Now let us create a visualisation of the array.
This is done by first creating a visualisation of the record.
Open your record type "temperature_control_data_rec". Right click and select "Create new view for this type based on" - "PD 3171 record view". Add views for value (PD 12097) and unit (PD2158) for both time and set point.
Your view list should look something like this:
Arrange the view elements via the graphical editor:
Now open your array type "temperature_control_data_array". Right click and select "Create new view for this type based on" - "PD 6185 Dataarray_view". In the view list, add one instance of the view for your record.
Video on the way
Step 4. Adding our array to the master control component
Now we need to add an instance of the array to our component.
Fill in the array with the default values for the regulation times and corresponding set points.