DSM

Version 5 (Roman Köhler, 02/17/2010 11:36 am)

1 1 Roman Köhler
h1. dSM
2 1 Roman Köhler
3 1 Roman Köhler
The dSM is the main entry for accessing the hardware for the dSS. It is somekind of master for one singular circuit, it hosts the handling of the behavior of one or more room. It is not a classical master, because it received buttonpresses from "Taster"-Slaves, and make a broadcast to all slaves with a command which scene has been called. It is in the responsibility for the slaves, what exacly a specfic scene call means to them. The dSM do not know, what a slave will do on a scene-call.
4 1 Roman Köhler
5 1 Roman Köhler
In real world, there are many constellations of circuit wireing in any building. For that reason, a dSM drives the concept of virtual rooms, called here "Zone". Each dSM can actualy have up to 15 different zones, each with a individual, not-iterative ZoneID. 
6 1 Roman Köhler
All dSMs are connected through a rs485 bus, where a token-bus protocol named "dS485" handles the routing of singular telegrams. That telegrams are commands or requests from and to the dSMs. When a Buttonpress has been issued by a dSID-"Tasterslave", the dSM for that circuit receives it, then determine with the properties of that buttonpress, the properties of a slave and the current state of a zone which new state for that zone has to be. That command will be send throught the powerline to his slave and also throught dS485 to all other dSM, because there might be other dSMs/circuit which has also slaves in the same zone (two dSMs can share a Zone with the same ZoneID). Since that dS485-telegram is sended as a broadcast to all dSMs, a dSS can also "sniff" that telegram and knows about the zone-states without any further requesting the dSMs.
7 1 Roman Köhler
8 1 Roman Köhler
h2. dSM-datamodel Classes (conceptional)
9 1 Roman Köhler
10 1 Roman Köhler
From a conceptional view, a digitalSTROM-System at hardware-level with multiple dSMs and slaves has 4 classes of "things":
11 1 Roman Köhler
12 1 Roman Köhler
* dSM/Circuit
13 1 Roman Köhler
* Device/dSID
14 1 Roman Köhler
* Zone
15 1 Roman Köhler
* Group
16 1 Roman Köhler
17 1 Roman Köhler
Each dSM has a number of Devices, which are pluged into his circuit.
18 1 Roman Köhler
Each dSM can provide a measurement of the current powerconsumption (in Watt), which the circuit is currendly drained, and a energy-counter (in kWh).
19 1 Roman Köhler
Each dSM can have up to 15 different Zones.
20 1 Roman Köhler
21 1 Roman Köhler
Each Device is a Member of one Circuit and a Member of one Zone.
22 1 Roman Köhler
Each Device can be in multipe "User"-Groups, but is always Member of one singular "Standard-group"
23 1 Roman Köhler
Each Device have a scene-memory, where his behavior on a specific Scenecall is saved.
24 1 Roman Köhler
Each Device has (beside some other Information) a function-ID, which defines what behavior is called thought the dSM, when a event has been issued by that device (a light device has function-id 0x1***, so when a button-press-event comes from that device, the dSM know, that a scenecall for light must be issued)
25 1 Roman Köhler
26 1 Roman Köhler
Each Zone has multipe Devices and can be hosted on one or many dSMs.
27 5 Roman Köhler
Each Zone has 9 "Standard"-Groups: "light", "shadow", "climate", "audio", "video", "security", "access", "white-ware", "joker" (in dSS they are encoded by the marketing-given colors: "yellow", "gray", "blue", "cyan", "violet", "red", "green", "white" and "black") 
28 5 Roman Köhler
Each Zone has up to 54 "User"-Groups.
29 1 Roman Köhler
Each Zone has a individual 16-Bit ZoneID.
30 5 Roman Köhler
ZoneID "0" is reserved as broadcast-address, so it represents all zones in a installation
31 1 Roman Köhler
32 1 Roman Köhler
Each Group, regardless of a "Standard" or "User"-group has multipe devices, and is member of one Zone.
33 1 Roman Köhler
Each Group has a property "last scene call", which represens the current state of a Group in a Zone.
34 5 Roman Köhler
GroupID "0" is reserved as broadcast-address, so it represents all devices in a zone.
35 1 Roman Köhler
36 1 Roman Köhler
h2. dSM-API
37 2 Roman Köhler
38 4 Roman Köhler
One Command for a dSM is a dS485 Telegram with (beside typical Headerinformation) one 8-Bit MessageID for identifying the command and up to 7 16-Bit Parameter.
39 4 Roman Köhler
From all possible commandtypes, in the api only "request", "response" and "event" is important, all other commandtypes for dS485 are mainly for bus-handling purposes.
40 2 Roman Köhler
41 1 Roman Köhler
The commands can be separeted in some differend kinds:
42 2 Roman Köhler
43 4 Roman Köhler
* data-model (read out the dSM,Devices,Zones,Groups and administate it)
44 4 Roman Köhler
* action requests (scene-calls, direct setting output value, dSLink-commands)
45 4 Roman Köhler
* events (new devices found, devices lost, getting HW-event which the dSM can't handle because no behavior model has been provided of a specific functionID of the sending device)
46 4 Roman Köhler
* sensoric / measurement (powerconsumption dSM, powerconsumption device, sensoric data)
47 2 Roman Köhler
(details comming soon)
48 2 Roman Köhler
49 2 Roman Köhler
50 2 Roman Köhler
h2. typical Usecases for dSM-API
51 3 Roman Köhler
52 1 Roman Köhler
h3. fire a action request
53 1 Roman Köhler
54 5 Roman Köhler
A typical actionrequest can be a scene-call or a direct setting of the outputvalue. The best way is to issue a scenecall to a group of a zone, that request should be send as a broadcast to all dSMs. All dSM receives the command at the same time and will send the command throught powerline when he is member of that zone. The group-call is set on powerline as a singular command and not as a series of commands for each devices which are members of that group, so a scenecall to Zone/Group is the best and well optimized way of issuing a command. The system is optimized for calls to virtual addressing though zones and groups.
55 1 Roman Köhler
You can also call individual devices which is not so optimized, so it can take up to 4 times longer. 
56 5 Roman Köhler
You can also set a defined output value, which naturally overrides the scene-logic of a device and is also not in the focus of optimization, so it would also take more responce-time than the scene-calls.
57 5 Roman Köhler
Be aware, that addressing of multiple devices or broadcasting is possible and can be very efficient. Zone xy and Group 0 is the fastet way to make a call to all Devices in a Zone; Zone 0 and Group 1 is the fastet way to turn on lighting in the whole installation; Zone 0 and Group 0 targets all Devices in a installation.
58 5 Roman Köhler
59 2 Roman Köhler
60 2 Roman Köhler
h3. query actual powerconsumption
61 3 Roman Köhler
62 2 Roman Köhler
The powerconsumption of a dSM is stored internally with a one-second precision, so you can get the powerconsumption of the last second. Querying that value from one dSM cost one comlete token-roundtrip, so if you want to get only one value, querying one dSM is ok. If you want the powerconsumption of all dSM, it would be wise to issue a singular broadcast request. all dSM will answer as soon as they get the token, so the receiver can gather all information while waiting for getting the token. if you call the dSM individual, each singular request must wait for a complete token-roundtrip.