0300037EN
0300037EN
0300037EN
1 1 / 70
INDEX:
Exercise 1 - Thermostat ...................................................................................................................................................................... 3
Exercise 2 – Thermostat (only exercise) ............................................................................................................................................. 5
Exercise 2 – Uploading the application into the pCO.......................................................................................................................... 7
Exercise 3 – Setpoint modifiable ......................................................................................................................................................... 9
Exercise 4 – Setpoint ‘lateral’- Fixed Offset and Differential constant ............................................................................................. 11
Exercise 5 - Heating device ............................................................................................................................................................... 13
Exercise 6 - New mask and Key function .......................................................................................................................................... 15
Exercise 7 –Loop of masks ................................................................................................................................................................ 17
Exercise 8 –Enable devices................................................................................................................................................................ 19
Exercise 9 –Customizing field text (e.g. 0/1>>>OFF/ON) .................................................................................................................. 21
Exercise 10 – Virtual Key ................................................................................................................................................................... 23
Exercise 11 – Block Execution Order ................................................................................................................................................. 25
Exercise 12 – Unit status by keyboard .............................................................................................................................................. 27
Exercise 13 – Unit status by Digital Input (switch) ............................................................................................................................ 31
Exercise 14 –Cooling and Heating Valve ........................................................................................................................................... 33
Exercise 15 – Alarms management – Creating the alarm status variables ....................................................................................... 35
Exercise 16 –Alarms management – Builtin alarm management ..................................................................................................... 37
Exercise 17 – Alarms management – Alarm key ............................................................................................................................... 39
Exercise 18 – pLAN - Introduction..................................................................................................................................................... 41
Exercise 19 – pLAN - Shared terminal ............................................................................................................................................... 43
Exercise 20 – pLAN - Sending variable among pCO (Link) ................................................................................................................. 45
Exercise 21 – pLAN - Solving problem of conflict .............................................................................................................................. 47
Exercise 22 – pLAN - Miscellaneous .................................................................................................................................................. 51
Exercise 23 – BMS - Introduction ...................................................................................................................................................... 53
Exercise 24 – BMS – Port config. and Variables selection................................................................................................................. 55
Exercise 25 – BMS - Miscellaneous ................................................................................................................................................... 59
Exercise 26 – Working with blocks and Library ................................................................................................................................. 61
Exercise 27 – Creating a new Macroblocks-block ............................................................................................................................. 62
Exercise 28 – Working with Modules ................................................................................................................................................ 63
Exercise 29 – Default Values ............................................................................................................................................................. 64
Exercise 30 – Images ......................................................................................................................................................................... 65
Exercise 31 – TextFont and ImageText ............................................................................................................................................. 66
Exercise 32 – Language support and Translations ............................................................................................................................ 67
Exercise 33 – Commissioning Tool .................................................................................................................................................... 68
Exercise 34 – Miscellaneous ............................................................................................................................................................. 69
Appendix_A_HowToConfigurePlan................................................................................................................................................... 70
NOTE:
The odd-numbered pages contain the description of the exercise.
The even-numbered pages contain the solution of the exercises
1tool BASIC course - Exercise book Ver.3.1 2 / 70
Exercise 1 - Thermostat
Strategy Editor:
Programming languages: FBD – Function Block Diagram (blocks) and ST -
Structured Text (textual): in all exercises will be used FB.
Library view: Atoms library(very simple blocks) & Macroblocks library (more
complex/specific blocks)
How to place blocks (Drag & Drop from the LibraryView)
New blocks: Ain_Conf, GrdCmp, Dout (Atoms library)
How to create CONSTANT
How to create VARIABLES
Datatype of values/variables in FBD: Boolean, Integer, Analog
How to connect object (‘autorouting’)
Mask Editor
Concept of ‘MASK’ (display page, screen page)
How to place TEXT and FIELD (variables)
How to compile
Simulator
How to Start/Stop simulation
How to Simulate physical input/outputs
How to show the values of the variables using Watch windows
How to open a StrategyPage (ReadOnly)
How to show instant value of Input/Output of the blocks
How to go back in Editing
pCO manager
How to connect pCO to PC (RS485 to USB converter)
How to configure the communication between pCO and PC
How to upload the application into the pCO
Backup
How to create the backup of the application
8)Select files to be
uploaded to the device
Target How to convert a CONSTANT value into a PARAMETER the user can modify
Since the GrdCmp block needs the central value of the stage and the half of the
width, you have to calculate them.
NOTE: Div block performs the ‘integer’ division (e.g. 14:5=2, remainder 4 is lost)
A typical mistake is divide the differential by “2.0” instead of “2” (block 050-Div). It
is a mistake since in the FBD-Strategy editor the Analog values are Integer values
where the editor shows the “.” before the last figure, therefore “2.0” = “20”.
Target To make practice with current knowledge and learn some new functions.
Description Add the management of an ON-OFF heating stage, according to the following
Specifications operating chart.
Add in the mask a Text and Field for the Heating.
Now make sense the previous exercise (lateral setpoint): changing only one
operating parameter (the Setpoint) both stages moves accordingly.
Note that the Heating stage is ‘Reversed’ (Cooling is ‘Direct’). Since the only block we
know that manages a stage is the GrdCmp and it manages a ‘Direct’ stage, it is
necessary to reverse it using the Not block (there are other better blocks in the
library managing stages, but in this exercise we prefer to use the GrdCmp block).
Note:
since the new stage is at the other side of the Setpoint, the Add and Sub must be
reversed (block number 040/070 and 130/140)
Note:
• It is evident that the strategy regarding the heating is similar to the one
regarding the cooling, therefore it is recommended to duplicate the existing
strategy and then make all the necessary modifications.
• The new variable “Heating” must be ‘after’ the Not block (i.e. ‘before’ the Dout
block) because the meaning of the Heating variable should be “Status of the
heating relay”. Since the status of the relay is defined by the variable connected
to the Dout block/Val pin, the Heating variable must be connected to it.
Description Create a new mask specific for the operating parameters (currently only Setpoint).
Specifications Use meaningful names for mask names.
Move all object regarding the Setpoint (Texts and Field) into the new mask.
Use the ESC key to show the mask regarding RoomTemp/Cooling/Heating and the
PRG key to show the new mask regarding Setpoint.
Note:
• Press CTRL+SPACE to open the list of Statements/Collectors
• Remember to click the background of the Worksheet grid (in order to select the
Global level) before to write code in the Key Function Editor.
• To change the mask name:
o click the mask
o open the Property window
o Insert new name in the ObjectName property
Description Create two news masks specific for the cooling and heating devices. Place them
Specifications together (same group) with MainMask.
Mask content
Note:
• Drag the small icon in at the left of the mask (see red circle) in order to move the
mask in another position (same loop or different loop)
Target To know some new items of the languages through a typical need of an application:
enable masks and devices.
What’s new Mask Editor: How to create a new Key combination (e.g. ESC+PRG)
Mask Editor: EnableOn property
Strategy Editor: And block
(all): How to create a new variable from the Variable List
Description Create a new Configuration mask where is possible to modify two new variables
Specifications (En_Cooling, En_Heating) defining the ‘enable’ of the cooling/heating mask/device.
Enable the Cooling/Heating mask/relays according to the variables.
Enter in the Configuration mask/loop using the Key combination ESC+PRG
Enable the Cooling/Heating masks using the EnableOn property (Mask level)
Enable the Cooling/Heating devices using the And block (Atom library)
Target How to show in a FIELD a text instead of the value of the variable.
(e.g. ‘OFF’/’ON’, ‘NO’/’YES’, ‘DISABLED’/’ENABLED’, …)
Description Show in all Boolean field a meaningful text instead of the numbers ‘0’ and ‘1’
Specifications ‘OFF’/’ON’ in the Cooling/Heating masks
‘NO’/’YES’ in the Configuration mask
‘DIS’/’EN’ in the Enable cooling FIELD of the Configuration mask.
1. Click the background of the grid in order to select the GLOBAL level
2. Assign to the ResourceUsedOnBool the texts ‘OFF’/’ON’
IMPORTANT!
• The properties and KeyFunction defined at GLOBAL level is used
in all field of all masks
• The properties and KeyFunction defined at MASK level is used
in all field that mask.
• The properties and KeyFunction defined at FIELD level is used
only in that mask.in all field of all masks
FIELD level overrides MASK level, and MASK level overrides the GLOBAL level.
Target How to execute a KFE statement (e.g. Goto_loop) by the application instead of
pressing a physical key.
Description Show the main mask after 60s of inactivity of the keyboard.
Specifications
Goto
main mask
Time
60s
En_VK_GotoMainMask 1
0
Time
60s
Note:
• A System Variable is a variable where the Name, Meaning, DataType,
MemoryType are pre-defined.
The most used System Variable are the ones regarding the Real Time Clock
(CURRENT_HOUR, CURRENT_MINUTE, etc) and regarding protocols
(COM_PROTOCOL_BMS, COM_BAUDRATE_BMS, etc)
• For this strategy is very important the execution order of the block defined by the
number above the block (‘010’, ‘020’, ‘030’): the Move_BX block must be last of
the group. For further details see next exercise.
The “execution order” is used also by textual languages. In this case the execution
order of the lines is intuitive: from TOP to BOTTOM.
Example 1 and 2 are perfectly equivalent. Doesn’t matter if ‘B’ is initialized before ‘A’,
the important is that when they are used (C=A+B) they already have the correct
value.
Example 3: the code is not ideal. The program prints “0” and then “6” because in the
first program cycle the variable “C” doesn’t have yet the correct value.
Example 4 is even worse than Example 3. The program prints “0”“0”“6” because the
PRINT statement takes two program cycles before to use the correct value of “C”.
NOTE: You can notice that in some strategies the execution order is equivalent, in
others is not critical (it might work but with worse performance), in other is critical,
that is the program doesn’t work (like the exercise).
It is strongly recommended to take care of the Block Execution order
after place down and connect the blocks!
General rule: if the block “A” uses a value defined by the block “B”, then “B” should
be calculated after “A” (number of “B” higher than number of “A”)
In the following snippet of code the Sub block shoud be executed after Add/Div
CORRECT WRONG
Description Manage the ‘unit status’. It changes pressing the ESC+UP keys.
Specifications Enable the cooling/heating devices according to the units status.
Draft code:
Key ESC+UP
IF UNIT_STATUS = 0 THEN
UNIT_STATUS = 1
IF UNIT_STATUS = 1 THEN
UNIT_STATUS = 0
3. Define the function ESC_UP of the key at GLOBAL level (so the status od the unit
will change regardless the FIELD and MASK wher is the cursor)
Solution 1: (recommended)
Create a new support user variable (e.g. New_Unit_Status)
if (UserVarList.Unit_Status == 0)
{
UserVarList.New_Unit_Status = 1;
}
if (UserVarList.Unit_Status == 1)
{
UserVarList.New_Unit_Status = 0;
}
UserVarList.Unit_Status = UserVarList.New_Unit_Status;
Solution 2:
Create a new support user variable (e.g. flag)
Flag = 0;
if (UserVarList.Unit_Status == 0)
{
UserVarList.Unit_Status = 1;
Flag = 1;
}
if (UserVarList.Unit_Status == 1 && Flag == 0)
{
UserVarList.Unit_Status = 0;
}
or
Description Use the Digital Input (switch) n.1 as remote Unit Status.
Specifications Contact OPEN units OFF all devices forced OFF
Contact CLOSED units ON devices can be switched ON according to other
conditions (temperature, device enable, Unit Status by keyboard)
Now there are 4 conditions that enable the devices (the screenshot shows only the
program regarding the Heating device)
The Not block is very important. Without it the Digital Input n.1 with have the
opposite effect than expected: when the contact is CLOSED (Val=0) the Heating
device is forced OFF while the specification require “Contact CLOSED units ON
devices can be switched ON according to other conditions (temperature, device
enable, Unit Status by keyboard)”
Here below a better solution: the General_Unit_Status variable takes care of ‘all units
status’: by keyboard and by digital input. In case the application has to manage also
the unit status by BMS, scheduler, … it is sufficient to add those condition to the
And(120). It is not necessary to modity the rest of the program (like And_3(320))
Description Add the management of a Cooling and Heating valve according to the operating
Specifications graph here below. Drive the Analog Outputs n.1 and 2 respectively.
Show the opening value of the valves in the Cooling and Heating mask. The values
must be expressed in percentage (neither 0/1000 nor 0/10)
Important:
• If the value need more figures than the ones defined in the FIELD format then
the display shows the less significant figures
Example: Value= 1234, Field format=”iii” the display shows “234”
Example: Value= -1234, Field format=”-iii” the display shows “-234”
• If the value is negative but the FIELD format is unsigned then the display shows a
‘random’ value (random for the end user)
Example: Value= -33, Field format=”aaa.a” the display shows “550.3”
The value comes from: 2^16+(-33)=65536+(-33)=65503,
…since the FIELD is ‘Analog’ the display shows “6550.3”,
…since the FIELD has only 4 figures the display shows “550.3”
What’s new Strategy Editor: GE, GT, LE, LT, NE, EQ (atom), Hyst_Dir_Set2Diff,
Hyst_Dir_OnOff , Hyst_Rev_Set2Diff, Hyst_Rev_OnOff, Delay_On
macroblocks.
Description Step1: Create two variables representing the High/Low temperature alarm status.
Specifications Alarm condition not active variable = 0
Alarm condition active variable = 1
The only new blocks are the comparison blocks here below. All blocks works in the
same way: the output is 1 when the comparison of the 1st and the 2nd input is TRUE.
The only new blocks are the ‘hysteresis’ blocks here below
Step2:
Step3:
Step4:
Important:
Take care of the Block Execution Order!
Description Define the KFE code of the ALARM key in order to manage the 3 conditions shown in
Specifications the following slide.
It is recommended to create a mask to show when there are no alarms: the user
wants a feedback when he press a key!
Description Create a pLAN composed by two pCO running the COURSE project and one SHARED
Specifications terminal. pLAN addresses are respectively 1-2-32.
To use the ESC+DOWN key combination to switch (connect) the terminal to the next
pCO, you have to assign to the system variable PLAN_KEY_SWITCH the code of
the key/s you want to use.
Description Send the value of Room_Temp of unit address 1 to Room_Temp of unit address 2.
Specifications This allows to install only one temperature probe.
The solution of this exercise is very simple, but there is an issue. See next exercise.
The figure below shows the part of the program involved in the issue.
• The Ain_Conf block: every program cycle the block ‘reads’ the analog input
n.1 (that it is not connected) and write the correspondent value into the
variable Room_Temp.
This is wrong. Unit 2 has not the probe connected. This block is not
necessary.
2. Place a Sel_I block between the Ain_Conf block and the variable
Room_Temp in order to select the value coming from the Ain_Conf or the
pLAN according to the pLAN address.
The project can be the same in the two units.
3. Exclude the Ain_Conf block from program cycle when the program runs in
the unit 2.
The project can be the same in the two units.
This is the solution you have to implement in the exercise.
This is the solution used in all Carel Standard application!
IMPORTANT!: The issue discussed in this exercise is not present for all variables sent
between pCO, it depends on the specifics strategy!
EQ EQ
Jump_Start Jump_Start
Ain_Conf Ain_Conf
Jump_End Jump_End
GrdCmp GrdCmp
Dout Dout
Description The project has to exchange the following variables in Carel Slave and Modbus Slave
Specifications protocol through the BMS port.
Create a new mask in the Configuration loop where to set the address of the pCO in
the network, the communication speed and the communication protocol.
Variables to exchange:
Place a FIELD with a new support user variable BAUDRATE variable(I, T, range 0-4).
You can’t use COM_BAUDRATE_BMS because it is in X-RAM memory.
Place a FIELD with a new support user variable PROTOCOL variable(I, T, range 1-4).
You can’t use COM_PROTOCOL_BMS because it is in X-RAM memory.
• Blocks.
Example:
This property will create at compile time an hidden strategy page containing blocks
like the ones shown in the first alternative. For this reason in order to avoid conflict
you should not use both alternatives.
DTEST: tool developed by CAREL suitable to test CAREL SLAVE LOCAL protocol.
Download it from KSA.
MODSCAN: tool developed by third parties suitable to test MODBUS SLAVE protocol.
Search it on the internet.
What’s new How to set the address of the pGD terminal using system mask
How to set the address of the pCO using system mask
How to set the address of the pCO using bush button and 2 digit display
How to show the diagnostic mask (NetStat)