Archive for the 'Uncategorized' Category

Node Offline Responses

When a Client Node on the FieldServer goes offline the corresponding data objects on the FieldServer are also marked offline. If a client polls a virtual FieldServer node for this particular data, an offline response will be returned by the FieldServer. If the client then requests the FieldServer to identify itself, a valid response will be provided in spite of the data being offline. This results in status toggle, with the Server side Client receiving no replies to data requests and marking the Node offline and then again marking the node online after a successful identification poll, then again receiving no replies to data requests and marking the node offline and so on.

The Server Node must therefore be capable of deciding the nature of its response based on the status of relevant Client Nodes. This can be accomplished using responsible Map Descriptors (RDBC, WRBX, and WRBC). In case no acknowledgement of these functions is received, the device is identified as offline and a flag is placed at the data array offset. The virtual FieldServer can be configured using the Offline_Method option to respond to identification requests in one of the following ways:

  1. Ignore_Clients/No Setting (default) – The kernel ignores the status of Client side Nodes and uses only the online/offline status of relevant data objects to decide on the type of response.
  2. Any_Offline – If any relevant Client Node is offline the Server Node will respond with a node offline message as defined by the Server protocol. This option is available for selected drivers only.
  3. All_Offline – If all relevant Client Nodes are offline the Server Node will respond with a node offline message as defined by the Server protocol. This option is available for selected drivers only.
  4. Always_Respond – A response with data currently in the FieldServer is always sent, without considering the online/offline status of the relevant Client Nodes. This option is available for all drivers.

Offline Server Nodes are treated differently by different protocols. Some protocols will have an explicit offline response, while others will simply not respond.

If configured, the node offline response will take priority over the data offline response.<-->

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Tags v/s Categories

Earlier, WordPress.com used only categories and no tags. A tag is a new breed of search engine optimization i.e. SEO. Tags are fundamentally keywords for each page or article created by us. It is a non-hierarchical keyword or term assigned to a piece of information such as an internet bookmark, digital image, or computer file. This type of metadata helps depict an item and facilitates it to be found again by browsing or searching. Tags are chosen easily and personally by the item’s creator or by its viewer, depending on the system. Tags are “free-form” words means there is no formal restriction on tags we attach.

Long tag lists should be generally avoided. Tag pages are somewhat like category pages.  We can assign related posts the same tag, and then all those posts appear on the same tag page. During the design stages of the site, make a list on a piece of paper of all the tags we want to use on our site.  These will be the most important keywords for the niche, but they should be keywords that are different to the categories which we have setup for the site.  Tags can be considered as additional pages that Wordpress will create offering us a secondary way of filing our posts.

Although, usage of tags made broad grouping of post topics possible yet to describe a post in more specific terms, more categories are needed. A category is an exclusively defined division in a system of classification. A system of classification here refers to a highly structured, possibly hierarchical system. For example, to borrow from the classification system for living things, we have a tree like “Animals -> Vertebrates -> Mammals -> Horses”. Any of these terms can be considered to be a category, and they fall into a strict structure.

The basic difference between categories and tags is that categories are structured and tags are unstructured. Categories organize, hierarchically. Tags need not. Tags provide meta-information, Categories need not. Tags cross-connect, Categories do not. <–>

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Google Page Rank

PageRank is a link analysis algorithm used by the Google Internet search engine that assigns a numerical weighting to each element of a hyperlinked set of documents, such as the World Wide Web. The purpose behind this is to measure the relative importance of the element within the set. It is a probability distribution check which represents the possibility that a person randomly clicking on links will arrive at any particular page.

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Get to know your Power Meter – What is Real, Apparent and Reactive Power

First – a simple question

  Right or Wrong? Power = Voltage x Current

That statement is correct for DC systems but there are two major complications for AC systems.

  • The value of current and voltage keeps changing. Which value do you use ?
  • The voltage and the current may not be in phase. Multiplying the current and the voltage when they are not in phase requires and adjustment to compensate for the phase. It is this phase shift that forces us to define Real, Apparent and Reactive Power.
    This phase shift occurs when a power source feeds an inductive or capacitve load”. Most loads are either inductive (motors) or resistive (heaters) and therefore the phase shift is typically in one direction.

    • A motor has a winding. A wound conductor essentially defines an inductor. Thus the winding presents the resistance of the wound wire and the inductance resulting from the winding.

 

 

 

RMS or Effective Value

  Peak values in the alternating voltage or current curves only lasts a short instant. They are not really representative of the ability of the voltage and current to do work and thus they are not used in Power Calculations.Scientists use a statistical method to define the effective values. It is called the RMS or Root-Mean-Square values. The result of the definition is that:Veff / rms = 0.707 x Vpeak

The same applies to current too.

TIP: You can reasonably assume that all the Voltages and Currents reported by a Power Meter are reported as RMS or Effective values unless otherwise indicated.

TIP: Most multi meters report RMS values

 

 

 

Apparent Power

  Apparent Power is the power delivered by a power source to a load like a motor. In almost all real world situations that use AC, you need to supply more power (Apparent Power) to a device than it will do work (Real Power).The (vector) difference between the two represents the work done to overcome the inductive and capacitive effects of the load.Apparent Power is measured in units of VA – Volt-amperes. These are actually Watts but we use the new unit name to reduce confusion. Thus when you see VA on a data sheet you can reasonably conclude that they are talking about Apparent Power.

Apparent Power is calculated:

S(Common symbol for Apparent Power) = Veff / rms x Ieff / rms – Single Phase Calc

 

 

Power Factor and Phase

  Power Factor is calculated: PF = Cosine ( phase angle in radians)Power factor has no engineering units.The value of PF ranges from -1 to 0 to 1 (lagging – none – leading)

Loads that only present a resistive load (no capacitance or inductance) have a PF of 1.

Inductive Loads

 
Current phase lags the VoltageTypical – Transformers and motors (wound conductors) 

Capacitive Loads

 
Current phase leads the VoltageTypical – Buried Cables, capacitor banksThere is nothing ‘wrong’ with having a power factor that isn’t 1.0.

 

 

Real Power and Reactive Power

  Think of Real Power as useful power – a measure of how much work is being done.The units of Real Power are Watts.Real Power is calculated : P(Real) = S(Apparent Power) x pf

Reactive Power is the (vector) difference between Apparent Power and Real Power. The energy used to produce the Reactive Power is stored in the magnetic/electrical field of the Inductive Load. In the case of the capacitive load the magnetic/electrical field of the Inductive Load produces the Reactive Power. Reactive Power cannot be harnessed to do useful work.

Reactive Power is identified by the symbol : Q

The engineering units of Reactive Power are VAR – Volt-amperes Reactive. These are also Watts but we use VAR so that we know we are talking about Reactive Power.

 

 

Diagram: RMS measurement

diag11

Diagram: Leading / Lagging

diag21

THD – Total harmonic Distortion (also called Distortion)

  In simple terms THD is a measure of distortion reported as %. If a device (any active device but think of rectifiers, variable speed drives … as practical examples) is given a sine wave as in input the output is never a faithful 100% reproduction of the input. A series of harmonics of the original wave distort the original wave form. The THD % is an attempt to ‘numberize’ the degree of distortion to allow for comparison. The % number is somewhat controversial because some harmonics are more important than others and there is no weighting.THD(%) = 100 * SQRT[(V22 + V32 + V42 + ... + Vn2)] / VtWhere V2, V3 are the RMS values of each voltage harmonic and Vt is the total RMS output voltage.

 

 

 

Sag / Swell or Dip / Surge

  Duration is 0.5 cycle and greater. Voltage sags are the most common power disturbance. Voltage sags can arrive from the utility. In most cases, sags are generated inside a building. For example, in residential wiring, the most common cause of voltage sags is the starting current drawn by refrigerator and air conditioning motors.Sags do not generally disturb incandescent or fluorescent lighting. motors, or heaters. However, some electronic equipment lacks sufficient internal energy storage and, therefore, cannot ride through sags in the supply voltage. Equipment may be able to ride through very brief, deep sags, or it may be able to ride through longer but shallower sags. 

 

 

Under / Over Voltage

  Over Voltage is an increase in effective voltage to more than 110% for longer than one minute. Under Voltage is a decrease in effective voltage to less than 90% for longer than one minute. Take care with this definition because it tends to change from vendor to vendor.  

 

Transient Voltages / Spikes / Surges

  Refers to short duration (less than 1 cycle) events. Low frequency transients are often called “capacitor switching transients”. High frequency transients are often called impulses, spikes, or surges. They can be caused when a discharged power-factor-correction capacitor is switched on across the line.High frequency transients are caused by lightning, and by inductive loads turning off. Typical rise times are on the order of a microsecond; typical decay times are on the order of a tens to hundreds of microseconds. Often, the decay will be an exponential damped ringing waveform, with a frequency of approximately 100 kHz.Extremely fast transients, or EFT’s, have rise and fall times in the nanosecond region. They are caused by arcing faults, such as bad brushes in motors, and are rapidly damped out by even a few meters of distribution wiring. Standard line filters, included on almost all electronic equipment, remove EFT’s.

 

 

 

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Hubs vs Switches – Using WireShark to sniff network packets

Gotcha #1 : Use a hub not a switch

 
Why: Switches don’t copy all messages to all ports. They try and optimize traffic so when they learn which port a device is connected to they send all messages intended for that device to that port and stop copying to all ports. (The jargon they use for this function is ‘learning mode’)

How do you know it’s a hub: Just because it calls itself a hub doesn’t mean it is one.

  • If it says full-duplex in the product description it’s probably not a hub.
  • A switch that allows you to turn off the learning mode is effectively a hub.  
  • A switch with a monitored port copies all messages to the monitored port and thus you can use that port as if it were a hub. 
  • If it says ‘switch’ and you cant turn off learning mode and it doesn’t have a monitor port then it is not a hub. 
  • A router is never a hub.

 

Gotcha #2 : Mixing 10 and 100 mbits/sec can cause problems.

 
Not all hubs copy 10mbit messages to 100mbit ports and vice versa.Use a 10mbit/sec hub if you are on a mixed network – almost all other faster devices are speed sensing and will downgrade themselves to 10mbits/sec and thus you will see all the packets. This is not true of some building automation engines where the speed of the port is configured.

You can work around this problem by connecting higher speed devices to a self sending switch/hub and then connect that switch/hub to the 10mbit hub.

Recommended Hubs

  • 10Mbit/sec Networks – DX-EHB4 – 4 Port 10 Mbps HUB
  • Netgear – DS104 Dual Speed HUB
  • 10Mbit/sec Networks – D-LINK DE-805TP
Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

The dangers of XML for System Intergators

Just because a system has an XML interface does not mean you can use it. There are some very important questions you must ask in evaluating the usefulness of an XML interface.
XML provides a syntax and structure but imposes no obligation on how it must be used.

Consider the example of spoken language. English imposes rules on syntax and structure but does not oblige you to say anything useful or comprehensible to other people.

Data Transfer using English

  • “Give me the data!” is a valid instruction in English
  • “Please email me the 2007 sales figures, grouped by territory with a monthly breakdown in tabular format” is also a valid instruction.

Your assistant is likely to respond well to the 2nd instruction and not know how to respond to the first.

 

The same considerations apply to XML. Now consider an XML example:

Data Transfer using XML

Format example 1

	< Data Xfer >
		< Send data now ! >
	< /Data Xfer >

Format example 2

	< poll >
		< source >
			< nodeId > 22 < /nodeId >
		< dest >
			< nodeId > 11 < /nodeId >
			< nodeName > node_A < /nodeName >
		< /dest >
		< responseRequirement > dataOnly < /responseRequirement >
		< query >
			< action > read < /action >
			< tableName > Setpoints < /tableName >
			< address > 10 < /address >
			< length > 3 < /length >
		< /query >
	< /poll >

 

Its not hard to see that the success of the query is dependent on the ability of the system to understand the query. Just because it complies with the rules of the XML syntax does not mean the interface will understand it.

Here are some key questions to ask:

1. Is the XML interface implemented using TCP/IP or UDP?

2. What is the XML Schema? The schema provides the structure of the XML packets used to query and respond with system data. It shows how the messages must be formatted and defines the data types of the various message fields (in the world or protocols the schema is equivalent to the protocol specification).

3. All the other normal questions you would ask of an interface – What data is available? How much can be transferred at once? What is the scaling? How are data objects addressed? etc…

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

How to end a telnet session (Windows)

This article assumes that you’ve started a telnet conection through the Windows command prompt. (you can do so by typing: “telnet address port“)

To end your current telnet session you must reach the telnet prompt and type quit.

Here are the steps for doing so:

 
1. Open the telnet prompt by holding down the ‘Ctrl’ key and push the ‘]’ key. (prompt: Microsoft Telnet>)

2. Type quit.

3. Push the ‘Enter’ key.

 

You can change this default telnet prompt key by starting telnet like this:
 
telnet –e p  192.168.1.81 (this will change the telnet prompt key to lowercase ‘p’)

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Resistor Color Codes

Resistor Color Code for 4 and 5 band resitors:



Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

Beer and Vodka Can Help You Select a Terminating Resistor

Try this mnemonic if you are trying to remember the resistor color codes:


Bad         (0) Black
Beer         (1) Brown
Rots         (2) Red
Our         (3) Orange
Young         (4) Yellow
Guts         (5) Green
But         (6) Blue
Vodka         (7) Violet
Goes         (8) Grey
Well         (9) White
        (0.1) Gold
        (0.01) Silver



Note: If you’re missing a tolerance band that implies that the tolerance is 20%.

Which end do you start reading the color bands?

There are usually two ways:

1) If one of the bands at the end of the sequence is further apart then that is the tolerance band – start from the opposite end.
2) If all the bands are closer to one side of the resistor then start from that end – the tolerance band is the last one your read.

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have

How Real (Floating Point) and 32-bit Data is Encoded in Modbus RTU Messages

The article discusses some of the typical difficulties encountered when handling 32-bit data types via Modbus RTU and offers practical help for solving these problems.

The point-to-point Modbus protocol is a popular choice for RTU communications if for no other reason that it’s basic convenience. The protocol itself controls the interactions of each device on a Modbus network, how device establishes a known address, how each device recognizes its messages and how basic information is extracted from the data. In essence, the protocol is the foundation of the entire Modbus network.

Such convenience does not come without some complications however, and Modbus RTU Message protocol is no exception. The protocol itself was designed based on devices with a 16-bit register length. Consequently, special considerations were required when implementing 32-bit data elements. This implementation settled on using two consecutive 16-bit registers to represent 32 bits of data or essentially 4 bytes of data. It is within these 4 bytes of data that single-precision floating point data can be encoded into a Modbus RTU message.

The Importance of Byte Order

Modbus itself does not define a floating point data type but it is widely accepted that it implements 32-bit floating point data using the IEEE-754 standard. However, the IEEE standard has no clear cut definition of byte order of the data payload. Therefore the most important consideration when dealing with 32-bit data is that data is addressed in the proper order.

For example, the number 123456.00 as defined in the IEEE 754 standard for single-precision 32-bit floating point numbers appears as follows:

The affects of various byte orderings are significant. For example, ordering the 4 bytes of data that represent 123456.00 in a “B A D C” sequence in known as a “byte swap”. When interpreted as an IEEE 744 floating point data type, the result is quite different:

Ordering the same bytes in a “C D A B” sequence is known as a “word swap”. Again, the results differ drastically from the original value of 123456.00:

Furthermore, both a “byte swap” and a “word swap” would essentially reverse the sequence of the bytes altogether to produce yet another result:

Clearly, when using network protocols such as Modbus, strict attention must be paid to how bytes of memory are ordered when they are transmitted, also known as the ‘byte order’.

Determining Byte Order

The Modbus protocol itself is declared as a ‘big-Endian’ protocol, as per the Modbus Application Protocol Specification, V1.1.b:

“Modbus uses a “big-Endian” representation for addresses and data items. This means that when a numerical quantity larger than a single byte is transmitted, the most significant byte is sent first.”

Big-Endian is the most commonly used format for network protocols – so common, in fact, that it is also referred to as ‘network order’.

Given that the Modbus RTU message protocol is big-Endian, in order to successfully exchange a 32-bit datatype via a Modbus RTU message, the endianness of both the master and the slave must considered. Many RTU master and slave devices allow specific selection of byte order particularly in the case of software-simulated units. One must merely insure that both all units are set to the same byte order.

As a rule of thumb, the family of a device’s microprocessor determines its endianness. Typically, the big-Endian style (the high-order byte is stored first, followed by the low-order byte) is generally found in CPUs designed with a Motorola processor. The little-Endian style (the low-order byte is stored first, followed by the high-order byte) is generally found in CPUs using the Intel architecture. It is a matter of personal perspective as to which style is considered ‘backwards’.

If, however, byte order and endianness is not a configurable option, you will have to determine the how to interpret the byte. This can be done requesting a known floating-point value from the slave. If an impossible value is returned, i.e. a number with a double-digit exponent or such, the byte ordering will most likely need modification.

Practical Help

The FieldServer Modbus RTU drivers offer several function moves that handle 32-bit integers and 32-bit float values. More importantly, these function moves consider all different forms of byte sequencing. The following table shows the FieldServer function moves that copy two adjacent 16-bit registers to a 32-bit integer value.


Function Keyword Swap Mode Source Bytes Target Bytes
2.i16-1.i32 N/A [ a b ] [ c d ] [ a b c d ]
2.i16-1.i32-s byte and word swap [ a b ] [ c d ] [ d c b a ]
2.i16-1.i32-sb byte swap [ a b ] [ c d ] [ b a d c ]
2.i16-1.i32-sw word swap [ a b ] [ c d ] [ c d a b ]

The following table shows the FieldServer function moves that copy two adjacent 16-bit registers to a 32-bit floating point value:


Function Keyword Swap Mode Source Bytes Target Bytes
2.i16-1.ifloat N/A [ a b ] [ c d ] [ a b c d ]
2.i16-1.ifloat-s byte and word swap [ a b ] [ c d ] [ d c b a ]
2.i16-1.ifloat-sb byte swap [ a b ] [ c d ] [ b a d c ]
2.i16-1.ifloat-sw word swap [ a b ] [ c d ] [ c d a b ]

The following table shows the FieldServer function moves that copy a single 32-bit floating point value to two adjacent 16-bit registers:


Function Keyword Swap Mode Source Bytes Target Bytes
1.float-2.i16 N/A [ a b c d ] [ a b ][ c d ]
1.float-2.i16-s byte and word swap [ a b c d ] [ d c ][ b a ]
1.float-2.i16-sb byte swap [ a b c d ] [ b a ][ d c ]
1.float-2.i16-sw word swap [ a b c d ] [ c d ][ a b ]

Given the vairous FieldServer function moves, the correct handling of 32-bit data is dependent on choosing the proper one. Observe the following behavior of these FieldServer function moves on the known single-precision decimal float value of 123456.00:


16-bit Values Function Move Result Function Move Result
0×2000 0×47F1 2.i16-1.float 123456.00 1.float-2.i16 0×2000 0×47F1
0xF147 0×0020 2.i16-1.float-s 123456.00 1.float-2.i16-s 0xF147 0X0020
0×0020 0xF147 2.i16-1.float-sb 123456.00 1.float-2.i16-sb 0×0020 0xF147
0×47F1 0×2000 2.i16-1.float-sw 123456.00 1.float-2.i16-sw 0×47F1 0×2000

Notice that different byte and word orderings require the use of the appropriate FieldServer function move. Once the proper function move is selected, the data can be converted in both directions.

Of the many hex-to-floating point converters and calculators that are available in the Internet, very few actually allow manipulation of the byte and word orders. One such utility is located at www.61131.com/download.htm where both Linux and Windows versions of the utilities can be downloaded. Once installed, the utility is run as an executable with a single dialog interface. The utility presents the decimal float value of 123456.00 as follows:

One can then swap bytes and/or words to analyze what potential endianness issues may exist between Modbus RTU master and slave devices.

Did you like this post?

Subscribe To The RSS Feed!
To catch many more articles like this in the future, make it easy on yourself and subscribe to me via RSS. You will not regret it!

Do you have a question?
We will do our best to try and solve any building automation, protocol, integration problem you may have