---
title: "DALI group"
canonical: "https://docs.cuesystem.com/space/CVCHELP/522682369/DALI%20group"
format: markdown
---
> Macro (toc)

---

This object can represent one DALI Group in the CVC project. The group can be controlled using commands of this object. This object can also be set to receive and react to commands coming from the DALI bus. 

# Properties

- **The group Address** is the DALI Group address. It is in the range of 0-63.
- **Event Raising Commands **
  - **Command1   -** ID of DALI Command causing the generation of OnCommand event
  - **Command2   -** ID of DALI Command causing the generation of OnCommand event
  - **Command3   -** ID of DALI Command causing the generation of OnCommand event
  - **Command4   -** ID of DALI Command causing the generation of OnCommand event

For further info concerning Event Raising Command selection, see section <u>DALI Group event</u> and <u>Table1</u> below

# Down

This command executes the DALI command "Down" (according to IEC-60929): Dim down for 200ms using the selected FADE RATE. No change if the arc power output is already at the MIN LEVEL. 

#### Syntax 

```visualbasic
Function Down()
```

#### Example 

```visualbasic
// Dim down for 200ms all ballasts in the group
DALI_group1.Down()    
```

# GetMyGroupAddress

This command returns DALI GroupAddress as set in object property.  

#### Syntax 

```visualbasic
Function GetMyGroupAddress() As Byte
```

#### Return value 

[<u>Byte</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte) – group address in range  0- 15 

#### Example 

```visualbasic
// Dim down for 200ms all ballasts in the group
addr := DALI_group1.GetMyGroupAddress() 
```

# GoToScene

This command executes the DALI command "GoToScene": it sets the actual arc power level to the level stored for the required scene using the actual predefined FADE TIME. If the ballast does not belong to the required scene, the arc power level remains unchanged. If the lamp is off, it shall be ignited with this command. If the level stored for the required scene is 0 and the lamp is lit on - then the lamp shall be switched off by this command after the predefined FADE TIME. 

#### Syntax 

```visualbasic
Function GoToScene(scene As Byte)
```

#### Parameters 

scene 

[<u>Byte</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte) scene 0-15  

A function [<u>GetLastError</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError) returns the error number that occurred while executing the command. The error that can happen: [<u>10105</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10105) 

#### Example 

```visualbasic
//set scene 6 for all ballasts in the group
DALI_group1.GoToScene(6) 
```

# Off

This command executes the DALI command "Off": extinguish the lamp immediately without fading  

#### Syntax 

```visualbasic
Function Off()
```

#### Example 

```visualbasic
//set ballasts in the group to Off state
DALI_group1.Off() 
```

# OnAndStepUp

This command executes the DALI command "OnAndStepUp":  it sets the actual arc power level one step up immediately without fading. If the lamp is switched off, the lamp shall be ignited with this command and shall be set to the MIN LEVEL. 

#### Syntax 

```visualbasic
Function OnAndStepUp()
```

#### Example 

```
//set all ballasts in the group one level Up
DALI_group1.OnAndStepUp()  
```

# RecallMaxLevel

This command executes the DALI command "RecallMaxLevel": set the actual arc power level to the MAX LEVEL without fading. If the lamp is off it shall be ignited with this command. 

#### Syntax 

```visualbasic
Function RecallMaxLevel()
```

#### Example 

```visualbasic
//set all ballasts in the group to MaxLevel
DALI_group1. RecallMaxLevel ()  
```

# RecallMinLevel

This command executes the DALI command "RecallMinLevel": set the actual arc power level to the MIN LEVEL without fading. If the lamp is off it shall be ignited with this command. 

#### Syntax 

```visualbasic
Function RecallMinLevel()
```

#### Example 

```visualbasic
//set all ballasts in the group to MinLevel
DALI_group1. RecallMinLevel()  
```

# SetFadeRate

This command sets the FADE RATE parameter in all ballasts in the group. The FADE RATE parameter is used by the Up and Down commands. FADE RATE is stored in each ballast and it remains valid until it is rewritten by the next SetFadeRate() or is changed by the DALI configuration process or it is changed by another DALI controller. 

#### Syntax 

```visualbasic
Function SetFadeRate(stepspersecond As Double)
```

#### Parameter 

stepspersecond 

[<u>Double</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)  The FADE RATE parameter is set in several steps per second. It can be set to one of 15 possible values. The available values are: 

If the parameter stepspersecond is different than any from the table above, then the nearest from the table is used 

#### Example 

```visualbasic
//set all ballasts in the group to the new FADE RATE value 
// the nearest value of 16 will be set as nearest to the required value
DALI_group1.SetFadeRate(15) 
```

# SetFadeTime

This command sets the FADE TIME parameter in all ballasts in the group. The FADE TIME parameter is used by SetLevel and SetLevelBin (so called DALI directarc commands). FADE TIME is stored in each ballast and it remains valid until it is rewritten by the next SetFadeTime() is changed by the DALI configuration process or it is changed by another DALI controller. 

#### Syntax 

```visualbasic
Function SetFadeTime(fadetime As Time)
```

#### Parameter 

fadetime 

[<u>Time</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Time)  The FADE TIME can be set to one of 16 time values. The available times are: 

If the parameter fadetime is set to a different time than any from the table above, then the nearest time from the table is used. 

#### Example 

```visualbasic
//set all ballasts in the group to a new FADE TIME value 
// the nearest value of :1.4 will be set as nearest to the required value
DALI_group1.SetFadeTime(:1.5) 
```

# SetLevel

This command executes the DALI arc power control command. Arc power control commands received during a running fading Process will stop the fading process and shall be executed immediately. Predefined FADE TIME specifies the time for changing the arc power level from the actual level to the requested level. If a burning lamp shall be switched off, the step from MIN LEVEL To "OFF" shall be taken into consideration for the calculation of the FADE TIME. If a lamp shall be ignited and dimmed to a certain value, the step from "OFF" to MIN LEVEL shall not be taken into consideration for the calculation of the FADE TIME. When the target level is below the minimum then it shall be applied as if the target was the minimum level. When the target level is above the maximum then it shall be applied as if the target was the maximum level. 

The parameter *percent* serves to specify the desired target level. Note that not all levels in the range 00.00% to 100.00% can be set by DALI exactly as the actual level is set in 255 levels (0-254) using a logarithmic scale. In such a case, the nearest possible DALI arc level is taken as the target level. 

#### Syntax 

```visualbasic
Function SetLevel(percent As Double)
```

#### Parameter 

percent 

[<u>Double</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Double)  target level in percent 00-100 

A function [<u>GetLastError</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError) returns the error number that occurred while executing the command. The error that can happen: [<u>10104</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10104) 

#### Example 

```visualbasic
//fade all ballasts in the group to level 50% using predefined  
//FADE TIME value 
DALI_group1.SetLevel(50.0)
```

# SetLevelBin

This command executes the same as the command SetLevel above but the target level in parameter *level* is to be specified as a binary value in the range 0-254 as defined in DALI arc level commands. 

The relation between the level in percent and the bin  is approx:  

bin := 253 * Log((percent * 1000) / percentmax) / 3  

#### Syntax 

```visualbasic
Function SetLevel(level As Byte)
```

#### Parameters 

level 

[<u>Byte</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte)  target level in DALI arc level value 0-254 

A function [<u>GetLastError</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError) returns the error number that occurred while executing the command. The error that can happen: [<u>10104</u>](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#10104) 

#### Example 

```visualbasic
//fade all ballasts in the group to level 228 using predefined  
//FADE TIME value 
DALI_group1.SetLevelBin(228)
```

# StepDown

This command executes the DALI command "StepDown": it sets the actual arc power level one step lower immediately without fading. Lamps shall not be switched off via this command. No change if the arc power output is already at the MIN LEVEL. 

#### Syntax 

```visualbasic
Function StepDown()
```

#### Example 

```visualbasic
//set all ballasts in the group one arc level down
DALI_group1.StepDown()   
```

# StepDownAndOff

This command executes the DALI command "StepDownAndOff":  it sets the actual arc power level one step lower immediately without fading. The lamp shall be switched off by this command if the arc power output is already at the MIN LEVEL. 

#### Syntax 

```visualbasic
Function StepDownAndOff()
```

#### Example 

```visualbasic
//set all ballasts in the group one arc level down  
DALI_group1.StepDownAndOff( )
```

# StepUp

This command executes the DALI command "StepUp":  it sets the actual arc power level one step up immediately without fading. No change if the arc power output is already at the MAX LEVEL. This command shall only affect ballasts with burning lamps. No lamp shall be ignited with it. 

#### Syntax 

```visualbasic
Function StepUp()
```

#### Example 

```visualbasic
//set all ballasts in the group one arc level Up
DALI_group1.StepUp( ) 
```

# Up

This command executes the DALI command "Up": dim up for 200ms using the selected FADE RATE. No change if the arc power output is already at the MAX LEVEL.` ` 

#### Syntax 

```visualbasic
Function Up()
```

#### Example 

```visualbasic
// Dim Up for 200ms all ballasts in the group
DALI_group1.Up( ) 
```

# DALI group event

The DALI system allows multiple DALI controllers on one bus and thus each ballast or group can be operated from all the controllers in the system.  The DALI Group Object can also react to commands coming from other DALI controllers. It can be done by generating OnCommand() event. The DALI Group object allows to the specification of up to four different DALI command types to generate such event. The Event Raising Commands can be specified using object properties either in CVC Configuration or by using Set/GetEventRaisingCommand() functions.  

If the Event Raising Commands are properly set as well as the object group address is set, then whenever such command with its group address appears on the DALI bus - then the OnCommand() event is generated.  

> 📝 Important notes: 
> 📝 
> 📝 1. Events are generated only from commands coming from external controllers. The system is not generating events on its commands.
> 📝 2. Events are generated only from commands with the appropriate group address. It is not generating events on commands with the BROADCAST address.

# OnCommand

This event is risen when any command of Event Raising Commands(specified in properties) with the corresponding group address was received from the DALI bus. 

#### Syntax 

```visualbasic
Event OnCommand As Process(commandId As Long, data As Byte)
```

#### Parameters 

comandId 

[<u>Long</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) in this parameter, the system gives commandId causing the event. The predefined constants are available for actual values to see <u>Table1</u> 

data 

[<u>Byte</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte) additional data - meaning is dependent on type command causing the event -see <u>Table1</u> below 

**Table1** 

|  |  |  |  |
| --- | --- | --- | --- |
| DALI Command according to IEC-60929 | Value | Predefined Constant | “data” parameter |
| no command | &H0FF | COMMAND_NONE | no meaning |
| “SET LEVEL” | &H100 | COMMAND_SETLEVEL | Level |
| “OFF” | &H000 | COMMAND_OFF | no meaning |
| “UP” | &H001 | COMMAND_UP | no meaning |
| “DOWN” | &H002 | COMMAND_DOWN | no meaning |
| “STEP UP” | &H003 | COMMAND_STEPUP | no meaning |
| “STEP DOWN” | &H004 | COMMAND_STEPDOWN | no meaning |
| “RECALL MAX LEVEL” | &H005 | COMMAND_RECALLMAXLEVEL | no meaning |
| “RECALL MIN LEVEL” | &H006 | COMMAND_RECALLMINLEVEL | no meaning |
| “STEP DOWN AND OFF” | &H007 | COMMAND_ STEPDOWNANDOFF | no meaning |
| “ON AND STEP UP” | &H008 | COMMAND_ONANDSTEPUP | no meaning |
| “GOTO SCENE” | &H010 | COMMAND_GOTOSCENE | Scene |

#### Example 

```visualbasic
Private Process DALI_Group2_OnCommand( commandId As Long, newdata As Byte ) Link DALI_Group2.OnCommand 
  Select commanded 
    Case DALI_Group2.COMMAND_NONE //&HFF  
      // do whatever… 
    Case DALI_Group2.COMMAND_SETLEVEL //&H100  
      levelBin := newdata 
    Case DALI_Group2.COMMAND_OFF //0 
      // do whatever… 
    Case DALI_Group2.COMMAND_UP //1 
      // do whatever… 
    Case DALI_Group2.COMMAND_DOWN //2  
      // do whatever… 
    Case DALI_Group2.COMMAND_STEPUP //3  
      // do whatever… 
    Case DALI_Group2.COMMAND_STEPDOWN //4  
      // do whatever… 
    Case DALI_Group2.COMMAND_RECALLMAXLEVEL //5  
      // do whatever… 
    Case DALI_Group2.COMMAND_RECALLMINLEVEL //6 
      // do whatever… 
    Case DALI_Group2.COMMAND_STEPDOWNANDOFF //7  
      // do whatever… 
    Case DALI_Group2.COMMAND_ONANDSTEPUP //8  
      // do whatever… 
    Case DALI_Group2.COMMAND_GOTOSCENE //&H10 
      sceneNumber :=newdata 
  End Select 
  DebugPrintFormat("**DALI_Group2_OnCommand(  command ID: {nH}, data: {nH} )", commandId, newdata ) 
End Process
```

# GetEventRaisingCommand

This command allows reading actual values of properties Command1, Command2, Command3 and Command4 

#### Syntax 

```visualbasic
Function GetEventRaisingCommand(number As Byte) As Long
```

number 

[<u>Byte</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte) – target property: value  1 for pro Command1, 2 for Command2, 3 for  Command3 and 4 for Command4 

#### Return value 

[<u>Long</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) – ID of DALI command causing the event. The predefined constants are available. For actual values see the see <u>Table1</u>  

#### Example 

```visualbasic
//read property Command1 of DALI_group1 object
Cmd1 := DALI_group1.GetEventRaisingCommand(1) 
```

# SetEventRaisingCommand

This command allows setting values of properties for Command1, Command2, Command3, and Command4 

#### Syntax 

```visualbasic
Function SetEventRaisingCommand(number As Byte, commandId As Long)
```

number 

[<u>Byte</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Byte) – target property: value 1 for pro Command1, 2 for Command2, 3 for  Command3 and 4 for Command4 

commandId 

[<u>Long</u>](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Long) – ID of DALI command causing the event. The predefined constants are available. For actual values see the see <u>Table1</u>  

#### Example 

```visualbasic
//set property Command1 of DALI_group1 object for command UP 
DALI_group1.SetEventRaisingCommand(1, DALI_group1.COMMAND_UP)
```