BRPI0806143A2 - multi-channel electricity measuring apparatus - Google Patents

multi-channel electricity measuring apparatus Download PDF

Info

Publication number
BRPI0806143A2
BRPI0806143A2 BRPI0806143A BRPI0806143A2 BR PI0806143 A2 BRPI0806143 A2 BR PI0806143A2 BR PI0806143 A BRPI0806143 A BR PI0806143A BR PI0806143 A2 BRPI0806143 A2 BR PI0806143A2
Authority
BR
Brazil
Prior art keywords
operable
pic
communication
meter head
electricity
Prior art date
Application number
Other languages
Portuguese (pt)
Inventor
Sayre A Swarztrauber
Doron Shafrir
Siddharth Malik
Robert Hayward
Original Assignee
Quadlogic Controls Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Quadlogic Controls Corp filed Critical Quadlogic Controls Corp
Priority to BRPI0806143-2A priority Critical patent/BRPI0806143B1/en
Publication of BRPI0806143A2 publication Critical patent/BRPI0806143A2/en
Publication of BRPI0806143B1 publication Critical patent/BRPI0806143B1/en

Links

Landscapes

  • Arrangements For Transmission Of Measured Signals (AREA)
  • Remote Monitoring And Control Of Power-Distribution Networks (AREA)

Abstract

APARELHOS PARA MEDIçãO DE MULTI-CANAL DE ELETRICIDADE. Em um aspecto, a invenção inclui um dispositivo para medir uso de eletricidade, incluindo: meio para desconexão remota por comunicação de linha de potência; meio para detecção de roubo de eletricidade; meio para detecção de fraude; e meio para detecção de tensão inversa. Em outro aspecto, a invenção inclui um aparelho para medição de multi-canal de eletricidade, incluindo: (a) uma cabeça de medidor operável para medir uso de eletricidade para uma pluralidade de linhas de consumidor de eletricidade; (b) um transponder operável para transmitir dados recebidos da cabeça de medidor por comunicação de linha de potência para um computador localizado remotamente, e para transmitir dados recebidos por comunicação de linha de potência do computador localizado remotamente para a cabeça de medidor; e (c) um módulo de controle de carga operável para atuar conexão e desconexão de cada um de uma pluralidade de relés, cada relé da pluralidade de relés correspondendo a uma da pluralidade de linhas de consumidor de eletricidade.MULTI-CHANNEL ELECTRICITY MEASURING DEVICES. In one aspect, the invention includes a device for measuring electricity usage, including: means for remote disconnection by power line communication; means for detecting theft of electricity; means for detecting fraud; and means for reverse voltage detection. In another aspect, the invention includes an apparatus for measuring multi-channel electricity, including: (a) an operable meter head for measuring electricity usage for a plurality of electricity consumer lines; (b) a transponder operable to transmit data received from the meter head by power line communication to a computer located remotely, and to transmit data received by power line communication from the computer remotely located to the meter head; and (c) a load control module operable to actuate connection and disconnection of each of a plurality of relays, each relay of the plurality of relays corresponding to one of the plurality of electricity consumer lines.

Description

"APARELHOS PARA MEDIÇÃO DE MULTI-C ANAL DE ELETRICIDADE""MULTI-C ANAL ELECTRICITY MEASURING APPLIANCES"

Referência Cruzada a Pedidos RelacionadosCross Reference to Related Requests

Este pedido reivindica o benefício de Pedido de Patente Provisório US N0 60/737.580, depositado em 15 de novembro de 2005, Pedido de Patente Provisório US N0 60/739.375, depositado em 23 de novembro de 2005, e Pedido Provisório N0 60/813.901, depositado em 15 de junho de 2006, e é uma continuação em parte de Pedido de Patente US N0 11/431.849, depositado em 9 de maio de 2006, que é uma parte de Pedido de Patente US N0 11/030.417, depositado em 6 de janeiro de 2005 (agora Patente No. 7.054.770), que é uma parte de Pedido de Patente US N0 09/795.838, depositado em 28 de fevereiro de 2001 (agora Patente US N0 6.947.854). Os conteúdos inteiros de cada um desses pedidos estão incorporados aqui por referência.This application claims the benefit of US Provisional Patent Application No. 60 / 737,580, filed November 15, 2005, US Provisional Patent Application No. 60 / 739,375, filed November 23, 2005, and Provisional Application No. 60 / 813,901, filed June 15, 2006, and is a continuation in part of US Patent Application No. 11 / 431,849, filed on May 9, 2006, which is a part of US Patent Application No. 11 / 030,417, filed on December 6, 2006. January 2005 (now Patent No. 7,054,770), which is a part of US Patent Application No. 09 / 795,838, filed February 28, 2001 (now US Patent No. 6,947,854). The entire contents of each of these applications are incorporated herein by reference.

Fundamento e ResumoRationale and Summary

Uma concretização da presente invenção inclui um dispositivo de medição que está relacionado à família de medidores baseada em ASIC Quadlogic (veja Patente US N0 6.947.854, e Publicação de Pedido de Patente US N0 20060036388, os conteúdos inteiros de quais estão incorporados aqui por referência). Especificamente, esta concretização (referida aqui para conveniência como "Guarda de Energia") é um medidor de multi-canal que preferivelmente é capaz de prover muita da funcionalidade da família supracitada de medidores, e ademais provê as melhorias, características e componentes listados abaixo.One embodiment of the present invention includes a measuring device that is related to the ASIC Quadlogic family of meters (see US Patent No. 6,947,854, and US Patent Publication No. 20060036388, the entire contents of which are incorporated herein by reference. ). Specifically, this embodiment (referred to herein for convenience as the "Energy Guard") is a multi-channel meter that is preferably capable of providing much of the functionality of the aforementioned meter family, and furthermore provides the enhancements, features and components listed below.

Usado em pelo menos uma concretização, um 'MiniCloset' é um dispositivo de medição de 24 canais que pode medir uso elétrico para até 24 clientes monofásicos, 12 clientes bifásicos, ou 8 clientes trifásicos. Preferivelmente conectado ao MiniCloset estão um ou mais Módulos de Controle de Carga (LCMs), discutidos abaixo. Guarda de energia inclui preferivelmente um módulo de cabeça de medidor de MiniCloset e dois LCMs montados em uma caixa de aço. Relês que permitem para um cliente de eletricidade ser remotamente desconectado e reconectado, junto com transformadores de corrente, também estão montados na caixa. Veja a Figura 1.Used in at least one embodiment, a 'MiniCloset' is a 24-channel metering device that can measure electrical usage for up to 24 single-phase customers, 12 two-phase customers, or 8 three-phase customers. Preferably connected to the MiniCloset are one or more Load Control Modules (LCMs), discussed below. Power Guard preferably includes a MiniCloset Meter Head Module and two LCMs mounted in a steel case. Relays that allow an electricity customer to be remotely disconnected and reconnected, along with current transformers, are also box mounted. See Figure 1.

Na instalação, a linha de provisão de eletricidade de um cliente de eletricidade é derivada do alimentador elétrico principal, passado pelo aparelho de Guarda de Energia, e corre diretamente à casa do cliente. A construção e uso do Guarda de Energia serão aparentes àqueles qualificados na arte na revisão da descrição abaixo e figuras relacionadas. Código de fonte é provido no Apêndice anexo.At the facility, a customer's electricity supply line is derived from the main power supply, passed through the Energy Guard appliance, and runs directly to the customer's home. The construction and use of the Energy Guard will be apparent to those skilled in the art by reviewing the description below and related figures. Source code is provided in the attached Appendix.

Medidores de Guarda de Energia preferivelmente são operáveis para prover:Energy Guard Meters are preferably operable to provide:

(A) Desconexão/Reconexão Remota: O medidor suporta comunicação duplex total (bidirecional) por comunicação de linha de potência ("PLC") e pode ser equipado com relês operados remotamente (60 A, 100 A, ou 200 A) que permitem desconexão e reconexão de usuários elétricos remotamente.(A) Remote Disconnect / Reconnect: The meter supports full duplex (bidirectional) communication by power line ("PLC") communication and can be equipped with remotely operated relays (60 A, 100 A, or 200 A) that allow disconnection. and reconnect electrical users remotely.

(B) Prevenção de Roubo: O sistema é projetado com três características específicas para prevenir roubo. Primeira, um aparelho de Guarda de Energia preferivelmente é instalado em um poste de utilidade acima das linhas de média tensão, fazendo difícil para clientes alcançarem e fraudarem. Segunda, porque não há nenhum fio de sinal adicional com o sistema (isto é, toda a comunicação é pela linha de potência), quaisquer fios de comunicação cortados são imediatamente detectáveis. Quer dizer, se um fio de comunicação for cortado, o serviço é cortado, que é prontamente aparente. Uma terceira característica de prevenção de roubo é que o medidor pode ser usado para medir a energia de transformador a fim de validar os totais medidos de clientes individuais. Discrepâncias podem indicar roubo de energia.(B) Theft Prevention: The system is designed with three specific features to prevent theft. First, an Energy Guard appliance is preferably installed on a utility pole above medium voltage lines, making it difficult for customers to reach and defraud. Second, because there is no additional signal wire with the system (ie all communication is by the power line), any cut communication wires are immediately detectable. That is, if a communication wire is cut, the service is cut, which is readily apparent. A third theft prevention feature is that the meter can be used to measure transformer energy to validate the measured totals of individual customers. Discrepancies may indicate power theft.

(C) Detecção de Fraude: O Guarda de Energia preferivelmente provê dois modos de detecção de fraude óptica. Cada unidade contém uma luz que reflete contra um pequeno adesivo como espelho. A ausência desta luz reflexiva indica que a caixa foi aberta. Esta detecção desconectará automaticamente todos os clientes medidos por aquela unidade de Guarda de Energia. Além disso, se o invólucro de Guarda de Energia for aberto e luz ambiente entrar, isto também desconectará automaticamente todós os clientes medidos por aquela unidade de Guarda de Energia. Estes dois modos de detecção de fraude são comprometidos continuamente e múltiplas vezes alternadas por segundo para segurança máxima.(C) Fraud Detection: Energy Guard preferably provides two modes of optical fraud detection. Each unit contains a light that reflects against a small mirror-like sticker. The absence of this reflective light indicates that the box has been opened. This detection will automatically disconnect all clients measured by that Power Guard unit. In addition, if the Energy Guard enclosure is opened and ambient light comes in, it will also automatically disconnect all clients measured by that Energy Guard unit. These two fraud detection modes are continuously compromised and multiple times alternated per second for maximum security.

(D) Detecção de Tensão Inversa: Em alguns casos, uma companhia de utilidade pode desconectar energia a um cliente individual e esse cliente é capaz de obter energia por uma alimentação alternativa. Se a utilidade fosse reconectar energia sob estas condições, dano poderia ocorrer ao equipamento de medição e/ou ao sistema de distribuição. Guarda de energia preferivelmente é capaz de detectar esta condição de falha. O Guarda de Energia pode detectar qualquer tensão que realimenta na desconexão aberta pelas linhas que conectam às instalações dos clientes. Se tensão for detectada, o firmware do Guarda de Energia prevenirá automaticamente a reconexão.(D) Reverse Voltage Detection: In some cases, a utility company may disconnect power to an individual customer and that customer is able to obtain power from an alternate power supply. If utility were to reconnect power under these conditions, damage could occur to the metering equipment and / or the distribution system. Energy guard is preferably capable of detecting this fault condition. Power Guard can detect any voltage that feeds into the disconnect opened by the lines that connect to customer premises. If voltage is detected, the Power Guard firmware will automatically prevent reconnection.

(E) Pré-pagamento: Pré-pagamento por energia pode ser feito por telefone, transação eletrônica, ou pessoalmente. A quantidade de kWh comprada é transmitida ao medidor e armazenada em sua memória. O medidor contará abaixo, mostrando quanta energia ainda está disponível antes de alcançar zero e desconectar. Contanto que o cliente continue comprando energia, não haverá nenhuma interrupção no serviço, e a companhia de utilidade terá um relatório de atividade diário.(E) Prepayment: Prepayment for energy may be made by telephone, electronic transaction, or in person. The amount of kWh purchased is transmitted to the meter and stored in its memory. The meter will count below, showing how much power is still available before reaching zero and disconnecting. As long as the customer continues to buy energy, there will be no interruption in service, and the utility company will have a daily activity report.

(F) Limitação de Carga: Como uma alternativa à desconexão por não pagamento ou parte de um sistema de pré-pagamento, medidores de Guarda de Energia podem permitir a utilidade limitar remotamente a potência entregue a um nível fixo, desconectando quando essa carga é excedida. Se o cliente exceder essa carga e for desconectado, o cliente pode reajustar um botão na unidade de exibição remota opcional para restabelecer carga contanto que a carga conectada seja menos do que o limite prefixado.(F) Load Limiting: As an alternative to disconnection for nonpayment or part of a prepayment system, Power Guard meters may allow the utility to remotely limit the power delivered to a fixed level by disconnecting when that load is exceeded. . If the customer exceeds this load and is disconnected, the customer may reset a button on the optional remote display unit to re-establish the load as long as the connected load is less than the preset limit.

Alternativamente, clientes podem chamar uma linha de serviço de utilidade elétrica por telefone para ter o serviço restabelecido. Esta característica permite a utilidades elétricas proverem eletricidade para sistemas críticos até mesmo, por exemplo, no caso de um cliente não pagante.Alternatively, customers can call a utility line by telephone to have the service restored. This feature allows utilities to provide electricity to critical systems even, for example, in the case of a non-paying customer.

(G) Limitação de Consumo Mensal: Alguns clientes se beneficiam de taxas subsidiadas e são dados um consumo total máximo por mês. O firmware de Guarda de Energia é capaz de interromper energia quando um certo nível de consumo é alcançado. Porém, este tipo de programa é implementado melhor quando notificação avançada para clientes é provida.(G) Monthly Consumption Limitation: Some customers benefit from subsidized rates and are given a maximum total consumption per month. Power Guard firmware is capable of stopping power when a certain level of consumption is reached. However, this type of program is best implemented when advanced notification to clients is provided.

Isto pode ser alcançado tanto com uma exibição na casa, por meio de que uma mensagem ou série de mensagens notifica os clientes que sua taxa de consumo está chegando ao consumo projetado para o mês. Alternativamente (ou em conjunto), interrupções de serviço temporizadas podem ser programadas de forma que quando o limite está se aproximando, energia seja desconectada para períodos de tempo com incrementos cada vez mais longos para notificar os residentes. Estas interrupções planejadas em serviço atuam como uma advertência para clientes que seu limite está se aproximando de forma que eles tenham tempo para alterar seus padrões de consumo.This can be achieved with either a home view, whereby a message or series of messages notifies customers that their consumption rate is reaching the projected consumption for the month. Alternatively (or in combination), timed service interruptions may be programmed so that when the limit is approaching, power will be disconnected for ever longer increments to notify residents. These planned outages serve as a warning to customers that their limit is approaching so that they have time to change their consumption patterns.

(H) Validação de Medidor: O módulo integrado do sistema preferivelmente é removível. Isto permite re-validação de laboratório fácil de precisão de medidor no evento de disputas de fatura de cliente.(H) Meter Validation: The integrated system module is preferably removable. This allows easy lab re-validation of meter accuracy in the event of customer invoice disputes.

(I) Benefícios Operacionais para Utilidade: O Guarda de Energia tem registros de evento e funções de diagnóstico a bordo, provendo os técnicos de campo com uma riqueza de dados para comissionar e reparar os sistemas elétrico e de comunicação. Parâmetros de não faturamento incluem: ampères, volts, temperatura, distorção harmônica total, freqüência, valores instantâneos de Watts, VARs e volt-ampères, V2 horas, 12 horas, fator de potência, e ângulo de fase.(I) Operational Benefits for Utility: The Energy Guard has event logs and diagnostic functions on board, providing field technicians with a wealth of data to commission and repair electrical and communication systems. Non-billing parameters include: Amps, Volts, Temperature, Total Harmonic Distortion, Frequency, Instantaneous Watts, VARs and Volt-Amps, V2 Hours, 12 Hours, Power Factor, and Phase Angle.

Estas características e outras serão aparentes àqueles qualificados na arte depois de revisar as descrições anexas, código de software e esquemas.These features and others will be apparent to those skilled in the art after reviewing the accompanying descriptions, software code and schematics.

Em um aspecto, a invenção inclui um dispositivo para medir uso de eletricidade, incluindo: meio para desconexão remota por comunicação de linha de potência; meio para detecção de roubo de eletricidade; meio para detecção de fraude; e meio para detecção de tensão inversa.In one aspect, the invention includes a device for measuring electricity usage, including: means for remote disconnection by power line communication; means for detecting electricity theft; means for detecting fraud; and half for reverse voltage detection.

Em outro aspecto, a invenção inclui um aparelho para medição de multi-canal de eletricidade, incluindo: (a) uma cabeça de medidor operável para medir uso de eletricidade para uma pluralidade de linhas de consumidor de eletricidade; (b) um transponder em comunicação com a cabeça de medidor e operável para transmitir dados recebidos da cabeça de medidor por comunicação de linha de potência a um computador localizado remotamente, e para transmitir dados recebidos por comunicação de linha de potência do computador localizado remotamente à cabeça de medidor; e (c) um módulo de controle de carga em comunicação com a cabeça de medidor e operável para atuar conexão e desconexão de cada um de uma pluralidade de relês, cada relê da pluralidade de relês correspondendo a uma da pluralidade de linhas de consumidor de eletricidade.In another aspect, the invention includes an apparatus for multi-channel electricity metering, including: (a) an operable meter head for measuring electricity use for a plurality of electricity consumer lines; (b) a transponder in communication with the meter head and operable to transmit data received from the meter head by power line communication to a remotely located computer, and to transmit data received by power line communication from the remotely located computer to meter head; and (c) a charge control module in communication with the meter head and operable to connect and disconnect each of a plurality of relays, each relay of the plurality of relays corresponding to one of the plurality of electricity consumer lines. .

Em várias concretizações: (1) o aparelho ademais inclui um detector de fraude em comunicação com a cabeça de medidor; (2) o detector de fraude inclui uma luz e uma superfície reflexiva, e a cabeça de medidor é operável para instruir o módulo de controle de carga para desconectar todas as linhas de cliente se o detector de fraude prover notificação que a luz não é detectada refletindo da superfície reflexiva; (3) o aparelho ademais inclui uma caixa contendo a cabeça de medidor, o módulo de controle de carga e os relês, e em que o detector de fraude inclui um detector de luz ambiente entrando na caixa; (4) o aparelho ademais inclui uma caixa contendo a cabeça de medidor, o módulo de controle de carga e os relês, e em que a caixa é instalada em um poste de utilidade; (5) o aparelho ademais inclui meio para comparar energia de transformador à energia total usada pelas linhas de consumidor; (6) o aparelho ademais inclui meio para detectar fluxo de tensão inversa pelas linhas de consumidor; (7) o aparelho ademais inclui uma memória legível por computador em comunicação com a cabeça de medidor e um contador em comunicação com a cabeça de medidor, o contador correspondendo a uma linha de cliente e operável para contar abaixo uma quantidade de energia armazenada na memória, e a cabeça de medidor operável para enviar um sinal de desconexão ao módulo de controle de carga para desconectar a linha de cliente quando o contador alcança zero; (8) o aparelho ademais inclui uma memória legível por computador em comunicação com a cabeça de medidor, a memória operável para armazenar um limite de carga para uma linha de cliente, e a cabeça de medidor operável para enviar um sinal de desconexão ao módulo de controle de carga para desconectar a linha de cliente quando o limite de carga é excedido; (9) o aparelho ademais inclui uma memória legível por computador em comunicação com a cabeça de medidor, a memória operável para armazenar um limite de uso para uma linha de cliente, e a cabeça de medidor operável para enviar um sinal de desconexão ao módulo de controle de carga para desconectar a linha de cliente quando o limite de uso é excedido; (10) o transponder é operável para se comunicar com o computador localizado remotamente através de linhas de potência de média tensão; (11) o aparelho ademais inclui uma unidade de exibição em comunicação com a cabeça de medidor e operável para exibir dados recebidos da cabeça de medidor; (12) a unidade de exibição é operável para exibir informação relativa a consumo de energia de um cliente; (13) a unidade de exibição é operável para exibir advertências relativas a uso de energia de um cliente ou roubo de energia suspeito; e (14) a unidade de exibição é operável para transmitir para dita cabeça de medidor informação entrada por um usuário.In various embodiments: (1) the apparatus further includes a fraud detector in communication with the meter head; (2) The fraud detector includes a light and a reflective surface, and the meter head is operable to instruct the load control module to disconnect all customer lines if the fraud detector provides notification that the light is not detected. reflecting from the reflective surface; (3) the apparatus further includes a housing containing the meter head, charge control module and relays, and wherein the fraud detector includes an ambient light detector entering the housing; (4) The apparatus further includes a housing containing the meter head, load control module and relays, and wherein the housing is mounted on a utility pole; (5) the apparatus further includes means for comparing transformer energy to the total energy used by consumer lines; (6) the apparatus further includes means for detecting reverse voltage flow through consumer lines; (7) The apparatus further includes a computer readable memory in communication with the meter head and a meter in communication with the meter head, the meter corresponding to a customer line and operable to count down an amount of energy stored in the memory. , and the meter head operable to send a disconnect signal to the load control module to disconnect the customer line when the counter reaches zero; (8) The apparatus further includes a computer readable memory in communication with the meter head, the operable memory for storing a load limit for a customer line, and the operable meter head for sending a disconnect signal to the meter module. load control to disconnect the client line when the load limit is exceeded; (9) The apparatus further includes a computer readable memory in communication with the meter head, the memory operable to store a usage limit for a customer line, and the meter head operable to send a disconnect signal to the meter module. load control to disconnect the client line when the usage limit is exceeded; (10) the transponder is operable to communicate with the remotely located computer over medium voltage power lines; (11) the apparatus further includes a display unit in communication with the meter head and operable to display data received from the meter head; (12) the display unit is operable to display energy consumption information of a customer; (13) the display unit is operable to display warnings concerning a customer's energy use or suspected power theft; and (14) the display unit is operable to transmit to said meter head information input by a user.

Breve Descrição dos DesenhosBrief Description of the Drawings

Figura 1 é um diagrama de bloco/fiação mostrando a conexão de concretizações preferidas.Figure 1 is a block / wiring diagram showing the connection of preferred embodiments.

Figura 2 é um diagrama de bloco mostrando a configuraçãoFigure 2 is a block diagram showing the configuration

física de concretizações preferidas.physics of preferred embodiments.

Figuras 3A-3B são diagramas esquemáticos de uma placa de CPU preferida de um Transponder de Varredura e MiniCloset.Figures 3A-3B are schematic diagrams of a preferred CPU board of a Scan and MiniCloset Transponder.

Figura 4 é um diagrama esquemático de uma fonte de energia de Transponder de Varredura preferida.Figure 4 is a schematic diagram of a preferred Scan Transponder power source.

Figura 5 é um diagrama esquemático de uma fonte de energia de MiniCloset preferida.Figure 5 is a schematic diagram of a preferred MiniCloset power source.

Figura 6 é um diagrama esquemático de uma placa de circuito preferida para retornar informação de transformador de corrente a uma cabeça de medidor de MiniCloset.Figure 6 is a schematic diagram of a preferred circuit board for returning current transformer information to a MiniCloset meter head.

Figuras 7A-7C são diagramas esquemáticos de uma placa de circuito de Módulo de Controle de Carga preferida.Figures 7A-7C are schematic diagrams of a preferred Load Control Module circuit board.

Figuras 8A-8D são diagramas esquemáticos de uma placa de fonte de energia preferida que provê detecção de fraude óptica.Figures 8A-8D are schematic diagrams of a preferred power supply board providing optical fraud detection.

Figuras 9A-9C são diagramas esquemáticos de uma placa de conexão de Guarda de Energia preferida.Figures 9A-9C are schematic diagrams of a preferred Energy Guard connection plate.

Figura 10 é um diagrama esquemático para uma placa de circuito de controle operável para prover controle de relé.Figure 10 is a schematic diagram for a control circuit board operable to provide relay control.

Figura 11 é um diagrama de montagem de base de Guarda de Energia preferida. Figuras 12 e 13 são diagramas de barramentos de fase preferidos e construção dos mesmos.Figure 11 is a preferred Energy Guard base assembly diagram. Figures 12 and 13 are preferred phase bus diagrams and construction thereof.

Figura 14 é um diagrama descrevendo construção e montagem de estrutura de barra de neutro preferida.Figure 14 is a diagram depicting construction and assembly of preferred neutral bar structure.

Figura 15 descreve barras de transição preferidas;Figure 15 depicts preferred transition bars;

Figura 16 descreve colocação preferida de barras de transição.Figure 16 depicts preferred placement of transition bars.

Figuras 17 e 18 descrevem construção de módulo de aceitante preferido.Figures 17 and 18 depict preferred acceptor module construction.

Figura 19 descreve um módulo sensor de corrente e relê integrado preferido.Figure 19 depicts a preferred integrated current and relay sensor module.

Figura 20 descreve uma vista explodida de um módulo sensor de corrente e relê integrado preferido.Figure 20 depicts an exploded view of a preferred integrated current and relay sensor module.

Figura 21 mostra vistas explodidas de módulos de medição preferidos.Figure 21 shows exploded views of preferred measurement modules.

Figura 22 mostra os módulos de medição colocados em uma montagem de estrutura de EG e módulo de aceitante.Figure 22 shows the measurement modules placed in an EG frame and acceptor module assembly.

Figura 23 mostra uma vista explodida de uma concretização preferida de Guarda de Energia.Figure 23 shows an exploded view of a preferred embodiment of Energy Guard.

Figura 24 mostra uma vista explodida de uma montagem de EG preferida e montagem de base.Figure 24 shows an exploded view of a preferred EG assembly and base assembly.

Figura 25 mostra uma disposição de EG preferida.Figure 25 shows a preferred EG arrangement.

Figuras 26 e 27 são esquemas de módulo de medição preferidos.Figures 26 and 27 are preferred measurement module diagrams.

Figura 28 tem esquemas preferidos para uma placa de lugar traseiro.Figure 28 has preferred schematics for a rear seat plate.

Figura 29 tem esquemas preferidos para uma placa de potência.Figure 29 has preferred schematics for a power board.

Figura 30 tem esquemas preferidos para uma placa de extensão de I/O. Figura 31 tem esquemas preferidos para uma placa de CPU.Figure 30 has preferred schemes for an I / O extension board. Figure 31 has preferred schemes for a CPU board.

Figura 32 tem esquemas preferidos para um módulo de controle.Figure 32 has preferred schemes for a control module.

Figura 33 tem esquemas preferidos para circuitos de medição e fonte de energia para um módulo de exibição de cliente;Figure 33 has preferred schematics for metering circuits and power supply for a customer display module;

Figura 34 tem esquemas preferidos para uma placa de exibição para o CDM.Figure 34 has preferred schematics for a display board for CDM.

Figura 35 é um diagrama de bloco de uma extremidade dianteira analógica preferida para medição.Figure 35 is a block diagram of a preferred analog front end for measurement.

Figuras 36 e 37 descrevem implementações de DSP preferidas.Figures 36 and 37 depict preferred DSP implementations.

Figura 38 ilustra características de resposta a impulso e freqüência de filtro em fase preferidas.Figure 38 illustrates preferred pulse phase response and frequency filter characteristics.

Figura 39 ilustra injetar sinais de PLC a harmônicos meio- ímpares de 60 Hz.Figure 39 illustrates injecting PLC signals into 60 Hz half-odd harmonics.

Figura 40 descreve 12 possíveis modos nos quais um quadro de FFT recebido por um medidor pode estar fora de fase com um quadro de FFT transmitido por transponder de varredura.Figure 40 depicts 12 possible modes in which an FFT frame received by a meter may be out of phase with an FFT frame transmitted by scan transponder.

Figura 41 ilustra especificações de filtro de FIR preferidas.Figure 41 illustrates preferred FIR filter specifications.

Figura 42 descreve tensão e corrente resultando de uma FFT preferida.Figure 42 depicts voltage and current resulting from a preferred FFT.

Descrição Detalhada de Concretizações PreferidasDetailed Description of Preferred Embodiments

Em uma concretização, um aparelho de medição de Guarda de Energia inclui um MiniCloset (quer dizer, um aparelho de medição operável para medir uma pluralidade de linhas de cliente); um Transponder de Varredura; um ou mais relês operáveis para desconectar serviço para clientes selecionados; um Módulo de Controle de Carga; e meio de detecção de fraude óptica.In one embodiment, an Energy Guard metering apparatus includes a MiniCloset (i.e. a metering apparatus operable for measuring a plurality of customer lines); a scan transponder; one or more relays operable to disconnect service for selected customers; a Load Control Module; and optical fraud detection means.

O MiniCloset e Transponder de Varredura referidos aqui são em grande parte os mesmos como descritos na Patente US N0 6.947.854. Quer dizer, embora cada um tenha sido melhorado através dos anos, a funcionalidade e estrutura pertinentes a esta descrição podem ser tomadas para serem as mesmas como descrito nessa patente.The MiniCloset and Scan Transponder referred to herein are largely the same as described in US Patent No. 6,947,854. That is, although each has been improved over the years, the functionality and structure pertinent to this description may be taken to be the same as described in that patent.

Um aspecto da invenção inclui tomar a funcionalidade de medição de multicanal existente achada no MiniCloset e adicionar conexão e desconexão remotas por PLC. Prover tal funcionalidade adicional requerida adicionando novo hardware e software. O hardware adicionado inclui um Módulo de Controle de Carga (LCM) e relês de conexão/desconexão. Também adicionado eram circuitos de suporte para dirigir rastros de sinal para e do processador de medidor principal - a Cabeça de Medidor de MiniCloset. As adições de software incluem módulos de código que se comunicam com o hardware adicionado, como descrito nas tabelas abaixo. Figura 1 é um diagrama de bloco de conexões de uma concretização preferida. Linhas de potência de média tensão A, B, C e N (neutro) alimentam em Transformador de Distribuição 110. Linhas de baixa tensão conectam (por transformadores de corrente 120) o Transformador de Distribuição 110 à unidade de Guarda de Energia 140. A unidade de Guarda de energia 140 monitora os transformadores de corrente 120, e alimenta linhas de cliente monofásicas 1-24.One aspect of the invention includes taking the existing multichannel measurement functionality found in the MiniCloset and adding remote PLC connection and disconnection. Provide such additional functionality as required by adding new hardware and software. Added hardware includes a Load Control Module (LCM) and connection / disconnect relays. Also added were support circuits for directing signal trails to and from the main meter processor - the MiniCloset Meter Head. Software additions include code modules that communicate with added hardware, as described in the tables below. Figure 1 is a block diagram of connections of a preferred embodiment. Medium voltage power lines A, B, C and N (neutral) feed into Distribution Transformer 110. Low voltage lines connect (via current transformers 120) Distribution Transformer 110 to Power Guard unit 140. Unit Power Guard 140 monitors current transformers 120, and supplies single-phase customer lines 1-24.

Figura 2 é um diagrama de bloco de estrutura preferida de uma unidade de Guarda de Energia 140.Figure 2 is a preferred structure block diagram of an Energy Guard unit 140.

Transponder de Varredura 210 é o coletor de dados preferido para a unidade 140, pode estar localizado externo ou dentro do MiniCloset, e pode ser o coletor de dados principal para mais de um MiniCloset de cada vez. O Transponder de Varredura 210 preferivelmente: (a) verifica dados (cada comunicação preferivelmente começa com a verificação de relógio e identidade de medidor para assegurar integridade de dados); (b) coleta dados (coleta periodicamente um bloco de dados de cada unidade de medidor, com cada bloco contendo leituras de medidor previamente coletadas, leituras de intervalo, e registros de evento); (c) armazena dados (preferivelmente os dados são armazenados em memória não volátil por um período especificado (por exemplo, 40 dias)); e (d) relata dados (tanto por PLC, modem de telefone, conexão de RS-232, ou outro meio).Scan Transponder 210 is the preferred data collector for unit 140, may be located outside or within the MiniCloset, and may be the primary data collector for more than one MiniCloset at a time. Scan Transponder 210 preferably: (a) verifies data (each communication preferably begins with clock and meter identity verification to ensure data integrity); (b) collects data (periodically collects a block of data from each meter unit, with each block containing previously collected meter readings, interval readings, and event logs); (c) stores data (preferably the data is stored in nonvolatile memory for a specified period (eg 40 days)); and (d) reports data (either via PLC, telephone modem, RS-232 connection, or other means).

A placa de deslizamento 280 inclui uma cabeça de medidor de Minicloset e um módulo de controle de carga 240, que provê os sinais de controle para ativar os relês. Toda a eletrônica preferivelmente é energizada por fonte de energia 250. A montagem de placa traseira 270 inclui múltiplos (por exemplo, 24) Transformadores de corrente e relês - agrupados, neste exemplo, como três conjuntos de 8 TCs e relês. Cabos de cliente são conectados por fios pelos TCs e se conectam ao circuito nas instalações de cliente 290. O Transponder de Varredura remotamente localizado 210 acessa a cabeça de medidor de Guarda de Energia e se comunica de modo bidirecional usando comunicação de portadora de linha de potência.The slip plate 280 includes a Minicloset gauge head and a load control module 240, which provides the control signals to activate the relays. All electronics are preferably powered by power source 250. Backplate assembly 270 includes multiple (e.g. 24) Current Transformers and Relays - grouped in this example as three sets of 8 TCs and relays. Customer cables are wired by the CTs and connect to the circuit at customer premises 290. The remotely located Scan Transponder 210 accesses the Power Guard meter head and communicates bidirectionally using power line carrier communication. .

O fluxo de sinal mostrado nas Figuras 1 e 2 ê preferivelmente realizado implementando módulos de código de software diferentes que trabalham simultaneamente para habilitar a habilidade de conexão/desconexão remota no Minicloset. Estes módulos de software, providos no Apêndice abaixo, são:The signal flow shown in Figures 1 and 2 is preferably realized by implementing different software code modules that work simultaneously to enable the remote connect / disconnect ability in Minicloset. These software modules, provided in the Appendix below, are:

<table>table see original document page 12</column></row><table><table> table see original document page 12 </column> </row> <table>

Figuras 3-10 são esquemas de componentes preferidos, como descrito abaixo. Os relês de conexão/desconexão preferidos são relês de série K850 KG, mas aqueles qualificados na arte reconhecerão que outros relês podem ser usados sem partir da extensão da invenção.Figures 3-10 are preferred component schematics as described below. Preferred connection / disconnection relays are K850 KG series relays, but those skilled in the art will recognize that other relays may be used without departing from the scope of the invention.

<table>table see original document page 12</column></row><table> <table>table see original document page 13</column></row><table><table> table see original document page 12 </column> </row> <table> <table> table see original document page 13 </column> </row> <table>

Em outra concretização, a implementação de Guarda de Energia tira vantagem da semelhança de arquitetura de painéis de disjuntor tradicionais, com o ambiente de medição de multicanal. Em um painel de disjuntor, eletricidade é alimentada ao painel e distribuída entre vários circuitos de cliente por disjuntores que provêem a habilidade para conectar ou desconectar os circuitos de cliente.In another embodiment, the Energy Guard implementation takes advantage of the architectural similarity of traditional breaker panels with the multi-channel metering environment. In a breaker panel, electricity is fed to the panel and distributed between various customer circuits by circuit breakers that provide the ability to connect or disconnect customer circuits.

No MiniCloset/Guarda de Energia, múltiplos transformadores de corrente medem a corrente em circuitos de cliente e trazem estes dados de volta a uma unidade de processamento central, onde as quantidades de medição são calculadas. Porém, o MiniCloset/Guarda de Energia tem várias diferenças principais com um painel de disjuntor. Por exemplo, enquanto os disjuntores são achados perto de instalações de cliente, o Guarda de Energia tipicamente é instalado perto do transformador de distribuição de utilidade. As vantagens oferecidas por esta concretização alternada serão aparentes àqueles qualificados na arte. Por exemplo, esta concretização oferece dimensões melhoradas e tamanho global sobre as concretizações discutidas acima. Espaço é sempre um constrangimento quando adições de equipamento são feitas a instalações elétricas existentes. Esta versão do Guarda de Energia ("EG"), com dimensões preferidas de 71,12 cm X 55,88 cm X 27,94 cm provê uma vantagem significativa em situações onde constrangimentos volumétricos existem.In MiniCloset / Power Guard, multiple current transformers measure current in customer circuits and bring this data back to a central processing unit, where the measurement quantities are calculated. However, the MiniCloset / Power Guard has several major differences with a breaker panel. For example, while circuit breakers are found near customer premises, the Energy Guard is typically installed near the utility distribution transformer. The advantages offered by this alternate embodiment will be apparent to those skilled in the art. For example, this embodiment offers improved dimensions and overall size over the embodiments discussed above. Space is always a constraint when equipment additions are made to existing electrical installations. This version of the Energy Guard ("EG"), with preferred dimensions of 71.12 cm X 55.88 cm X 27.94 cm provides a significant advantage in situations where volumetric constraints exist.

A descrição seguinte inclui detalhes de construção preferidos, esquemas detalhados, e descrições de software. Como com as concretizações discutidas acima, esta concretização é operável para prover operações de desconexão/conexão remotas, prevenir roubo, detectar fraude, detectar tensão inversa, executar pré-pagamento e limitar carga, e executar validação de medidor.The following description includes preferred construction details, detailed schematics, and software descriptions. As with the embodiments discussed above, this embodiment is operable to provide remote disconnect / connect operations, prevent theft, detect fraud, detect reverse voltage, perform prepayment and load limiting, and perform meter validation.

Detalhes de Construção de EG PreferidosPreferred EG Build Details

Nesta concretização, componentes primários do EG são:In this embodiment, primary components of EG are:

1. Montagem de Base de Guarda de Energia1. Power Guard Base Mounting

2. Montagem de Guarda de Energia2. Energy Guard Assembly

a. Barramentos de Fase e Barramentos de NeutroThe. Phase Buses and Neutral Buses

b. Barras de transiçãoB. Transition bars

c. Módulo de Aceitanteç. Acceptor Module

3. Módulos de Medição de Guarda de Energia3. Energy Guard Measurement Modules

a. Módulos de MediçãoThe. Measurement Modules

i. Módulos de Sensor de Corrente e Relê Integradosi. Integrated Current and Relay Sensor Modules

4. Eletrônica de Guarda de Energia4. Power Guard Electronics

a. PCB 203The. PCB 203

b. PCB 204B. PCB 204

c. PCB 234ç. PCB 234

d. PCB 235d. PCB 235

e. PCB 202and. PCB 202

f. PCB 210f. PCB 210

g. PCB 230g. PCB 230

h. PCB 206H. PCB 206

Base de Montagem de EGEG Mounting Base

A base de EG inclui um fundo de invólucro com parafusos e arruelas de retenção como um mecanismo de travamento para a cobertura de topo de EG, que está conectada em um lado por dobradiças. Veja Figura 11. O fundo de invólucro provê roteamento para os cabos de cliente.The EG base includes a screw housing bottom and retaining washers as a locking mechanism for the EG top cover, which is connected on one side by hinges. See Figure 11. The enclosure bottom provides routing for the customer cables.

Montagem de EG - Barramentos de Fase Três barramentos de fase de alumínio são colocados para o centro da montagem de Guarda de Energia e alternados. Veja Figuras 12 e 13. Estes provêem conexão aos módulos de medição de cliente pelo uso de barras de transição. Uma disposição de barramento alternada é descrita na Figura 13. Barramentos são mostrados em preto.EG Assembly - Phase Buses Three aluminum phase buses are placed to the center of the Energy Guard assembly and alternated. See Figures 12 and 13. These provide connection to customer measurement modules by use of transition bars. An alternate bus arrangement is described in Figure 13. Buses are shown in black.

Barras de NeutroNeutral Bars

O EG preferivelmente inclui 4 barras de neutro que formam um quadro para montagem de EG, por esse meio provendo um caminho para a corrente de neutro. Isto é mostrado na Figura 14. O borne na barra cruzada provê a alimentação de neutro do transformador de distribuição de utilidade. Também, há 2 barras de neutro de placa-mãe que levam a corrente de neutro ao módulo de controle.The EG preferably includes 4 neutral bars forming a frame for mounting EG, thereby providing a path for the neutral current. This is shown in Figure 14. The crossbar terminal provides the neutral supply of the utility distribution transformer. Also, there are 2 motherboard neutral bars that carry the neutral current to the control module.

Barras de TransiçãoTransition Bars

As barras de transição completam a conexão mecânica e elétrica entre os módulos de medição de cliente e os barramentos de fase. Veja a Figura 15. Uma barra de transição para fase A e C é mostrada na Figura 15A; uma barra de transição para fase B é mostrada na Figura 15B. Figura 16 mostra as barras de transição em preto.Transition bars complete the mechanical and electrical connection between customer measuring modules and phase buses. See Figure 15. A transition bar for phase A and C is shown in Figure 15A; a phase B transition bar is shown in Figure 15B. Figure 16 shows the transition bars in black.

Módulo de AceitanteAcceptor Module

Um módulo de aceitante preferivelmente é feito de plástico e aceita mecanicamente os módulos de medição que podem ser encaixados facilmente na montagem de EG. Cada EG tem 4 módulos de aceitante que são empilhados juntos e podem acomodar tanto 12 módulos de medição bifásicos ou 8 trifásicos. Veja Figura 17. O módulo de aceitante também provê uma rota mecânica para a barra neutra de placa-mãe que conecta ao módulo de controle. Veja Figura 18.An acceptor module is preferably made of plastic and mechanically accepts measuring modules that can be easily fitted into the EG assembly. Each EG has 4 acceptor modules that are stacked together and can accommodate either 12 two-phase or 8 three-phase measuring modules. See Figure 17. The acceptor module also provides a mechanical route to the motherboard neutral bar that connects to the control module. See Figure 18.

Módulos de Medição de ClienteCustomer Measurement Modules

Módulos de medição de cliente preferidos provêem a metrologia requerida para medir o consumo para um cliente monofásico, bifásico ou trifásico. Um módulo individual funciona como um medidor independente completo que pode ser testado e avaliado como uma unidade de medição separada. Cada módulo preferivelmente inclui um módulo de sensor de corrente e relê integrado e eletrônica de metrologia, e provê uma conexão entre o circuito de cliente e os barramentos de fase. Figura 19 descreve um módulo de sensor de corrente e relê integrado preferido. Figura 20 descreve uma vista explodida de um módulo de sensor de corrente e relê integrado preferido.Preferred customer metering modules provide the metrology required to measure consumption for a single phase, two phase or three phase customer. An individual module functions as a complete independent meter that can be tested and evaluated as a separate unit of measurement. Each module preferably includes an integrated current and relay sensor module and metrology electronics, and provides a connection between the customer circuit and the phase buses. Figure 19 depicts a preferred integrated current and relay sensor module. Figure 20 depicts an exploded view of a preferred integrated current and relay sensor module.

Figura 21 mostra vistas explodidas de módulos de medição preferidos. Figura 22 mostra os módulos de medição (mostrados em preto) colocados na montagem de quadro de EG e módulo de aceitante.Figure 21 shows exploded views of preferred measurement modules. Figure 22 shows the measurement modules (shown in black) placed on the EG board and acceptor module assembly.

Figura 23 mostra uma vista explodida de Guarda de Energia, eFigure 23 shows an exploded view of Energy Guard, and

Figura 24 mostra uma vista explodida de uma Montagem de EG e Montagem de Base de EG preferidas.Figure 24 shows an exploded view of a preferred EG Mount and EG Base Mount.

EletrônicaElectronics

As caixas de Módulo de Controle preferivelmente incluem várias PCBs que funcionam simultaneamente para coletar dados de medição dos módulos de medição individuais e comunicar através de linhas de potência para transmitir estes dados a um dispositivo mestre, tal como um Transponder de Varredura ("ST").Control Module housings preferably include multiple PCBs that function simultaneously to collect measurement data from individual measurement modules and communicate across power lines to transmit this data to a master device, such as a Scan Transponder ("ST"). .

Figura 25 mostra uma disposição de Guarda de Energia preferida para esta concretização. Cada linha de cliente tem um Módulo de Medição correspondente (PCB 203 e PCB 204, discutido abaixo) (esquemas mostrados nas Figuras 26 e 27).Figure 25 shows a preferred Energy Guard arrangement for this embodiment. Each customer line has a corresponding Measurement Module (PCB 203 and PCB 204, discussed below) (schemes shown in Figures 26 and 27).

Uma Placa de Colocação Atrás 2510 mostrada na Figura 25 (PCB 234; veja Figura 28 para diagrama de construção e esquemático) é o barramento comum que dirige sinais dentro do EG. Há dois tipos de opções de comunicação na Placa de Colocação Atrás 2510 para habilitar transferência de dados de Módulo de Controle 2520 para Módulos de Medição individuais PCB 203. Isto pode ser feito tanto usando a opção de I2C de 2 fios ou a opção serial de 1 fio.A Backward Placement Board 2510 shown in Figure 25 (PCB 234; see Figure 28 for construction and schematic diagram) is the common bus that directs signals within the EG. There are two types of communication options on the Backplate 2510 to enable data transfer from 2520 Control Module to individual PCB 203 Measurement Modules. This can be done using either the 2-wire I2C option or the 1-serial serial option. thread.

O Módulo de Controle 2520 inclui uma Placa de Potência (PCB 210; veja Figura 29 para esquemático) é a placa de fonte de energia que também tem os circuitos de transmissão e recepção de PLC nela. A Placa de Potência provê energia à placa de CPU e às placas de eletrônica 203. O Módulo de Controle 2520 também inclui uma Placa de Extensão de I/O (PCB 230; veja Figura 30 para esquemático) é uma placa com várias opções de extensão de I/O que habilitam comunicação de Módulos de Medição à placa de CPU.The 2520 Control Module includes a Power Board (PCB 210; see Figure 29 for schematic) is the power supply board that also has PLC transmit and receive circuits on it. The Power Board provides power to the CPU board and 203 electronics boards. The 2520 Control Module also includes an I / O Extension Board (PCB 230; see Figure 30 for schematic) is a board with several extension options. I / O devices that enable Measurement Modules communication to the CPU board.

Módulo de Controle 2520 também inclui uma Placa de CPU (PCB 202; veja Figura 31 para esquemático), que tem um processador de Processamento de Sinal Digital (DSP) a bordo.Control Module 2520 also includes a CPU Board (PCB 202; see Figure 31 for schematic), which has an on-board Digital Signal Processing (DSP) processor.

Finalmente, Módulo de Controle 2520 inclui uma placa de roteamento (PCB 235; veja Figura 32 para esquemático) com trilhas e um coletor sem componentes eletrônicos nele.Finally, Control Module 2520 includes a routing board (PCB 235; see Figure 32 for schematic) with tracks and a collector with no electronics on it.

Cada Módulo de Exibição de Cliente (CDM) 2530 é instalado nas instalações do cliente e pode se comunicar de modo bidirecional com o EG instalado no transformador de distribuição servindo o cliente. PLC bidirecional habilita comunicação de utilidade-cliente através de linhas de potência de baixa tensão e permite a utilidade enviar informação regular, advertências, informação especial sobre interrupções, etc., para o cliente. Cada CDM 2530 inclui uma combinação selecionada de medição e fonte de energia junto com circuitos de PLC na mesma placa (PCB 240; veja Figura 33 para esquemático). Cada CDM preferivelmente também tem uma placa de exibição de 9 dígitos (PCB 220; veja Figura 34 para esquemático). Esta exibição se comunica com EG e mostra informação sobre consumo, precauções, advertências e outras mensagens de utilidade.Each 2530 Client Display Module (CDM) is installed on the client premises and can communicate bidirectionally with the EG installed on the distribution transformer serving the client. Bidirectional PLC enables utility-client communication across low voltage power lines and allows the utility to send regular information, warnings, special interrupt information, etc., to the customer. Each CDM 2530 includes a selected combination of metering and power supply along with PLC circuits on the same board (PCB 240; see Figure 33 for schematic). Each CDM preferably also has a 9 digit display board (PCB 220; see Figure 34 for schematic). This display communicates with EG and displays information on consumption, precautions, warnings and other utility messages.

Implementação de Hardware Em uma concretização, o Guarda de Energia implementa Transformada de Fourier Rápida (FFT) no sinal de comunicação de PLC ambos no ST e no medidor, e para propósitos de medição executa análise de harmônico detalhada. Esta seção discute um esquema de implementação dos Módulos de Medição, comunicação com Módulos de Controle e comunicação de PLC do Módulo de Controle com um Transponder de Varredura remotamente localizado.Hardware Implementation In one embodiment, Energy Guard implements Fast Fourier Transform (FFT) on the PLC communication signal both on the ST and meter, and for measurement purposes performs detailed harmonic analysis. This section discusses a schematic implementation of the Measurement Modules, communication with Control Modules, and Control Module PLC communication with a remotely located Scan Transponder.

O Módulo de Controle 2520 inclui fonte de energia e circuitos de PLC (PCB 210; veja Figuras 25 e 29); extensão de I/O (PCB 230; veja Figura 30) e placa de CPU nomeada Medidor D (PCB 202; veja Figura 31). A fonte de energia provê energia ao medidor D e extensão de I/O e contém os circuitos de transmissor e receptor de PLC. PCB 235 provê um roteamento de trilha e conexão de coletor entre várias placas.Control Module 2520 includes power supply and PLC circuits (PCB 210; see Figures 25 and 29); I / O extension (PCB 230; see Figure 30) and CPU board named Meter D (PCB 202; see Figure 31). The power supply provides power to the D meter and I / O extension and contains the PLC transmitter and receiver circuits. PCB 235 provides track routing and collector connection between multiple cards.

O Módulo de Medição pode ter duas versões: bifásica ou trifásica. A versão bifásica pode ser programada por software para funcionar como um único medidor bifásico ou dois medidores monofásicos. A versão bifásica inclui um medidor B2 (PCB 203, esquemático mostrado na Figura 26), enquanto a versão trifásica inclui um medidor B3 (PCB 204 esquemático mostrado na Figura 27). Os medidores B atuam como escravos para o medidor D no Módulo de Controle 2520. Os medidores DeB podem se comunicar por um protocolo de ASCII serial.The Measurement Module can have two versions: two-phase or three-phase. The two-phase version can be programmed by software to function as a single two-phase meter or two single-phase meters. The two-phase version includes a B2 meter (PCB 203, schematic shown in Figure 26), while the three-phase version includes a meter B3 (schematic PCB 204 shown in Figure 27). B meters act as slaves for meter D in the 2520 Control Module. DeB meters can communicate over a serial ASCII protocol.

Os vários medidores B são interconectados por BPB 2510 a 2520, que provê energia, uma referência de 1 Hz e comunicações seriais para o medidor D. A máquina de DSP preferida para o medidor B é o chip 56F8014VFAE Freescale. O microprocessador preferido usado para implementar a CPU no medidor D é o entre a família de ColdFire Integrated Microprocessadores, MCF5207. O uso de um processador específico é determinado por requisitos de RAM e Flash ditados pela versão de medidor. Uma fonte de energia separada e placa de LCD completam a porção eletrônica do medidor D como um produto. À parte de atuar como um mestre para medidores Β, o medidor D também é um medidor trifásico e mede a saída de transformador total em que o EG está instalado. Como uma característica anti-roubo, este total é comparado com o consumo total relatado pelos vários medidores B.The various B meters are interconnected by BPB 2510 to 2520, which provides power, a 1 Hz reference, and serial communications for meter D. The preferred DSP machine for meter B is the 56F8014VFAE Freescale chip. The preferred microprocessor used to implement the CPU on meter D is among the ColdFire Integrated Microprocessor family, MCF5207. The use of a specific processor is determined by RAM and Flash requirements dictated by the meter version. A separate power supply and LCD board complete the electronic portion of meter D as a product. Aside from acting as a meter master Β, meter D is also a three-phase meter and measures the total transformer output on which the EG is installed. As an anti-theft feature, this total is compared to the total consumption reported by the various B meters.

<formula>formula see original document page 19</formula><formula> formula see original document page 19 </formula>

A constituição de fluxos de sinal é como segue:The constitution of signal flows is as follows:

B2: Duas tensões, Duas correntes e Nenhum Canal de Portadora de Linha de Potência (PLC).B2: Two voltages, Two currents and No Power Line Carrier (PLC) Channel.

B3: Três tensões, Três correntes e Nenhum Canal de PLC.B3: Three voltages, Three currents and No PLC Channel.

D: Três tensões, Três correntes e um Canal de PLC.D: Three voltages, Three currents and one PLC Channel.

Cada fluxo tem um circuito associado para efetuar amplificação analógica e 'antialiasing'.Each stream has an associated circuitry for analog amplification and antialiasing.

Específico para o medidor D é a implementação preferida de:Specific to meter D is the preferred implementation of:

• Uma Malha Travada por Fase (PLL) para travar a amostragem dos fluxos de sinal a um múltiplo da linha de A/C entrante (amostragem síncrona para a linha de potência).• One Phase Locked Loop (PLL) to lock signal flow sampling to a multiple of the incoming A / C line (synchronous power line sampling).

• Um Oscilador Controlado por Tensão (VCO) a 90-100 MHz controlado por processador de DSP por dois módulos de PWM acionando diretamente o relógio de sistema, conseqüentemente fazendo o DSP coerente com o PLL.• A 90-100 MHz DSP processor controlled voltage oscillator (VCO) controlled by two PWM modules directly driving the system clock, thereby making the DSP consistent with the PLL.

• Um detector de fase síncrono que só responde ao fundamental da onda de freqüência de linha entrante e não a seus harmônicos.• A synchronous phase detector that responds only to the fundamental of the incoming line frequency wave and not to its harmonics.

• Opção para executar esquemas de modulação de FSK e PSK.• Option to execute FSK and PSK modulation schemes.

Cada canal de medição e comunicação preferivelmente inclui circuitos analógicos de extremidade dianteira seguidos pelo processamento de sinal. Único aos circuitos analógicos é um filtro 'anti-aliasing' com ganho fixo que provê rastreamento de temperatura de primeira ordem, conseqüentemente eliminando a necessidade para recalibrar medidores quando derivas de temperatura são encontradas. Isto é discutido a seguir, e então uma implementação de processamento de sinal preferida é discutida.Each metering and communication channel preferably includes front end analog circuits followed by signal processing. Unique to analog circuits is a fixed gain anti-aliasing filter that provides first-rate temperature tracking, thereby eliminating the need to recalibrate meters when temperature drift is encountered. This is discussed below, and then a preferred signal processing implementation is discussed.

Cadeia de Sinal Analógico de Tensão e CorrenteVoltage and Current Analog Signal Chain

A extremidade dianteira analógica para canais de tensão (corrente) inclui elementos sensores de tensão (corrente) e um atenuador programável, seguido por um filtro 'antialiasing'. O atenuador reduz o nível de sinal entrante de forma que nenhum corte ocorra depois do filtro 'anti- aliasing1. O filtro 'anti-aliasing' de ganho constante restabelece o sinal a valor total na entrada do Conversor Analógico para Digital (ADC). Para medição, o filtro 'anti-aliasing' corta fora freqüências acima de 5 kHz. As entradas são então alimentadas no ADC que faz parte do DSP. Veja Figura 35, que é um diagrama de bloco de uma extremidade dianteira analógica preferida para medição.The analog front end for voltage (current) channels includes voltage (current) sensing elements and a programmable attenuator, followed by an antialiasing filter. The attenuator reduces the incoming signal level so that no cuts occur after the anti-aliasing filter. The constant gain anti-aliasing filter restores the full-value signal to the Analog to Digital Converter (ADC) input. For measurement, the anti-aliasing filter cuts out frequencies above 5 kHz. The inputs are then fed into the ADC that is part of the DSP. See Figure 35, which is a block diagram of a preferred analog front end for measurement.

Enquanto uma implementação típica incluiria um Amplificador de Ganho Programável (PGA) seguido por um filtro 'anti- aliasing' de baixo ganho, a invenção, nesta concretização, implementa um atenuador programável seguido por um filtro de ganho fixo grande. Além disso, a implementação de ambos os filtros 'anti-aliasing' em um único chip é a mesma usando os mesmos Amplificadores Operacionais Quádruplos junto com resistores de 25 ppm e capacitores de NPO/COG. Esta implementação única casando os filtros 'anti-aliasing' assegura que as derivas de fase encontradas em ambos os canais de tensão e corrente sejam exatamente idênticas e conseqüentemente precisão do cálculo de potência (dado pelo produto de V e I) não é comprometido. Isto provê um meio para ambos canais de V e I rastrearem derivas de temperatura até primeira ordem sem recalibrar o medidor.While a typical implementation would include a Programmable Gain Amplifier (PGA) followed by a low gain anti-aliasing filter, the invention in this embodiment implements a programmable attenuator followed by a large fixed gain filter. In addition, the implementation of both anti-aliasing filters on a single chip is the same using the same Quad Operational Amplifiers along with 25 ppm resistors and NPO / COG capacitors. This unique implementation by matching the anti-aliasing filters ensures that the phase drift found in both voltage and current channels is exactly identical and consequently power calculation accuracy (given by the product of V and I) is not compromised. This provides a means for both V and I channels to track temperature drifts to first order without recalibrating the meter.

Em contraste, usando um PGA junto com um filtro de ganho baixo não pode rastrear o deslocamento de fase nos sinais VeI introduzidos devido à temperatura. Isto é porque o deslocamento de fase introduzido por PGA é uma função do ganho.In contrast, using a PGA together with a low gain filter cannot track the phase shift in VeI signals input due to temperature. This is because the phase shift introduced by PGA is a function of gain.

Cadeia de Sinal Digital de Tensão, Corrente e PLCVoltage, Current and PLC Digital Signal Chain

Figura 36 é um diagrama de bloco da placa de PCB 202; as funções de cada bloco serão aparentes àqueles qualificados na arte. Figura 36 mostra uma implementação de DSP preferida.Figure 36 is a block diagram of PCB board 202; The functions of each block will be apparent to those skilled in the art. Figure 36 shows a preferred DSP implementation.

Esta concretização preferivelmente usa uma PLL para travar a amostragem dos fluxos de sinal a um múltiplo da freqüência de linha de A/C entrante. Na concretização discutida acima, a amostragem é a uma taxa assíncrona à linha de potência. No medidor D, há um VCO a 90-100 MHz que é controlado pela máquina de DSP por dois módulos de PWM. O VCO excita diretamente o relógio de sistema do chip de DSP (desabilitando a PLL interna), assim o DSP se torna uma parte integrante da PLL. Travar o relógio de sistema do DSP à linha de potência facilita o alinhamento da amostragem para a forma de onda da linha de potência. O detector de fase deveria funcionar assim para só responder ao fundamental da onda de 60Hz entrante e não a seus harmônicos. Figura 37 é um diagrama de bloco desta implementação de DSP preferida.This embodiment preferably uses a PLL to lock the sampling of signal streams to a multiple of the incoming A / C line frequency. In the embodiment discussed above, sampling is at an asynchronous rate to the power line. On meter D, there is a 90-100 MHz VCO that is controlled by the DSP machine by two PWM modules. VCO directly excites the DSP chip system clock (disabling internal PLL), so DSP becomes an integral part of PLL. Locking the DSP system clock to the power line facilitates alignment of the sampling to the power line waveform. The phase detector should work like this to respond only to the fundamental of the incoming 60Hz wave and not to its harmonics. Figure 37 is a block diagram of this preferred DSP implementation.

Um DSP BIOS ou código de comutação de contexto voluntário provê três pilhas, cada uma para fundo, comunicações de PLC e comunicações seriais. O pequeno micro se comunica com o DSP usando um excitador I2C. O circuito integrado MSP430F2002 mede as fontes de energia, porta de fraude, temperatura e tensão de bateria. As tarefas do MSP430F2002 incluem:A DSP BIOS or voluntary context switching code provides three stacks, each for background, PLC communications, and serial communications. The small computer communicates with the DSP using an I2C driver. The MSP430F2002 integrated circuit measures power sources, cheat gate, temperature and battery voltage. MSP430F2002 tasks include:

i. manter um RTC;i. maintain an RTC;

ii. medir a tensão de bateria;ii. measure battery voltage;

iii. medir a temperatura;iii. measure the temperature;

iv. medir a fonte de energia +U;iv. measure the power source + U;

v. reajustar o DSP na interrupção parcial; vi. prover um circuito de vigilância adicional; ev. readjust the DSP at partial interruption; saw. provide an additional surveillance circuit; and

vii. prover uma referência de 1 segundo para entrar no DSP para uma referência de tempo para medir a referência de 1 segundo contra o relógio de sistema do VCO.vii. provide a 1 second reference to enter the DSP for a time reference to measure the 1 second reference against the VCO system clock.

Cadeia de Sinal de Comunicação de PLC de Medidor D Uma instalação típica consiste em múltiplos EGs e STs se comunicando através das linhas de potência. O medidor D se comunica de modo bidirecional com um Transponder de Varredura localizado remotamente pelo transformador de distribuição. Para habilitar isto, esta concretização usa uma banda de 10-25 kHz para comunicação de PLC. O sinal de PLC é amostrado a cerca de 240 kHz (212 * 60), síncrono com tensão de linha, seguindo o que um filtro de Resposta a Impulso Finita (FIR) é aplicado para dizimar os dados. Especificações de FIR preferidas são dadas abaixo: Banda de 10-25 kHzMeter PLC Communication Signal Chain A Typical installation consists of multiple EGs and STs communicating across power lines. Meter D communicates bidirectionally with a Scan Transponder located remotely by the distribution transformer. To enable this, this embodiment uses a 10-25 kHz band for PLC communication. The PLC signal is sampled at about 240 kHz (212 * 60), line voltage synchronous, following which a Finite Impulse Response (FIR) filter is applied to decimate the data. Preferred FIR specifications are given below: 10-25 kHz band

<table>table see original document page 22</column></row><table><table> table see original document page 22 </column> </row> <table>

Veja Figura 38 para características preferidas de resposta de freqüência de filtro em fase e resposta a impulso.See Figure 38 for preferred characteristics of phase filter frequency response and impulse response.

Depois que a dizimação é feita a 60 kHz (2^11 * 30), uma FFT de 2048 pontos é então executada nos dados dizimados. A taxa de dados é assim determinada ser 30 baud dependendo da escolha de filtros de FIR. Toda FFT produz dois bits aproximadamente a todo 66 ms ao usar FER na banda de 10-25 kHz para se comunicar por transformadores de distribuição.After decimation is done at 60 kHz (2 ^ 11 * 30), a 2048-point FFT is then performed on the decimated data. The data rate is thus determined to be 30 baud depending on the choice of FIR filters. Every FFT produces two bits approximately every 66 ms when using FER in the 10-25 kHz band to communicate over distribution transformers.

Para evitar o problema de se comunicar na presença de ruído de linha, esta concretização preferivelmente implementa uma técnica única para comunicação robusta e segura. Isto é feito injetando sinais de PLC a freqüências que são harmônicos meio-ímpares da freqüência de linha (60Hz). Isto é discutido abaixo, para uma concretização usando um espectro de ruído típico achado em linhas de CA na gama de 12-12,2 kHz. Figura 39 ilustra injetar sinais de PLC a harmônicos meio-ímpares de 60 Hz. Desde que FFT é feita a todo 30 Hz e os harmônicos são separados por 60 Hz, os bits de dados residem na caixa correspondendo ao 201,5° e 202,5° harmônico de 60 Hz na Figura 39. O algoritmo considera estas duas caixas de freqüências e compara a amplitude do sinal nos dois para determinar 1 ou 0. Este esquema de FSK usa duas freqüências e produz uma taxa de dados de 30 baud. Alternativamente, QFSK, que usa 4 freqüências, pode ser implementado para produzir 60 baud.To avoid the problem of communicating in the presence of line noise, this embodiment preferably implements a unique technique for robust and secure communication. This is done by injecting PLC signals at frequencies that are half-odd line frequency harmonics (60Hz). This is discussed below for an embodiment using a typical noise spectrum found on AC lines in the range 12-12.2 kHz. Figure 39 illustrates injecting PLC signals into 60 Hz half-odd harmonics. Since FFT is made at all 30 Hz and the harmonics are separated by 60 Hz, the data bits reside in the box corresponding to 201.5 ° and 202, 5th 60 Hz harmonic in Figure 39. The algorithm considers these two frequency boxes and compares the signal amplitude on both to determine 1 or 0. This FSK scheme uses two frequencies and produces a data rate of 30 baud. Alternatively, QFSK, which uses 4 frequencies, can be implemented to produce 60 baud.

Ao atravessar por transformadores, preferivelmente ambos STs e medidores D executam FFT no PLC e sinais de dados a todo 30 Hz em uma gama de 10-25 kHz. Porque as Malhas Travadas em Fase (PLLs) implementadas ambos no ST e no medidor D estão travadas à linha, os quadros de dados estão sincronizados à freqüência de linha (60 Hz) igualmente. Porém, os quadros de dados podem se deslocar em fase devido a:When traversing transformers, preferably both STs and D meters perform FFT on the PLC and data signals at all 30 Hz in a range of 10-25 kHz. Because the Phase Locked Loops (PLLs) implemented on both the ST and meter D are line locked, the data frames are synchronized to the line frequency (60 Hz) equally. However, data frames may shift in phase due to:

1. várias configurações de transformador que podem existir no caminho entre o ST e medidor (delta -ípsilon, etc.); e1. various transformer configurations that may exist in the path between ST and meter (delta-epsilon, etc.); and

2. um deslocamento em fase devido ao fato que STs estão travados em uma fase particular, enquanto medidores mono e polifásicos podem ser energizados por outras fases.2. a phase shift due to the fact that STs are locked in a particular phase, while single and polyphase meters can be energized by other phases.

A relação de sinal para ruído (SNR) é maximizada quando o quadro de dados de medidor e quadros de dados de ST estão alinhados perto de perfeição. Do ponto de vista de um medidor, isto requer receber sinal de PLC de todos os possíveis STs que pode "ouvir", decodificar o sinal, verificar por SNR alinhando quadros de dados, e então responder ao ST que está produzindo SNR máxima. Figura 40 descreve os 12 possíveis modos nos quais o quadro de FFT recebido pelo medidor pode estar fora de fase com quadro de FFT de ST. Linhas pontilhadas correspondem a uma rotação de 30 graus considerando um transformador delta no caminho de sinal entre ST e o medidor.Signal to Noise Ratio (SNR) is maximized when the meter data frame and ST data frames are aligned close to perfection. From a meter standpoint, this requires receiving PLC signal from all possible STs that can "hear", decoding the signal, checking for SNR aligning data frames, and then responding to the ST producing maximum SNR. Figure 40 depicts the 12 possible modes in which the FFT frame received by the meter may be out of phase with ST FFT frame. Dotted lines correspond to a 30 degree rotation considering a delta transformer in the signal path between ST and the meter.

Além disso, porque os quadros de dados estão disponíveis a todo 30 Hz em uma linha de 60 Hz5 há duas possibilidades correspondendo às 2 possíveis fases obtidas dividindo 60 Hz por 2. Conseqüentemente, há 24 modos que os quadros de dados de medidor podem estar desalinhados com quadros de dados de ST.In addition, because data frames are available at all 30 Hz on a 60 Hz line5 there are two possibilities corresponding to the 2 possible phases obtained by dividing 60 Hz by 2. Therefore, there are 24 modes that meter data frames may be misaligned. with ST data frames.

Em cada quadro do ST, há um número integral ímpar de ciclos da freqüência de portadora. Desde que o esquema de modulação preferido é Chaveamento por Deslocamento de Freqüência (FSK), se houver η ciclos para transmitir bit 1, bit 0 é transmitido usando n+2 ciclos da freqüência de portadora. Fica vital para o medidor reconhecer seus próprios 2 ciclos de 60 Hz a fim de ser capaz de decodificar seus bits de dados que estão disponíveis a todo 1/30 de um segundo.In each ST frame, there is an odd integral number of carrier frequency cycles. Since the preferred modulation scheme is Frequency Shift Switching (FSK), if there are η cycles to transmit bit 1, bit 0 is transmitted using n + 2 carrier frequency cycles. It is vital for the meter to recognize its own 2 60 Hz cycles in order to be able to decode its data bits that are available every 1/30 of a second.

Se o medidor D decodificar sinais com quadros de dados desalinhados, há energia que transborda nas freqüências adjacentes (meio- ímpares separadas). Se o nível de sinal que cai na caixa de freqüência "adjacente" for menos do que o fundo de ruído, o sinal pode ser decodificado corretamente. Porém, se o derramamento for mais do que o fundo de ruído, a habilidade para distinguir entre IeO diminui, e conseqüentemente a SNR global cai, resultando em um erro em decodificação. Em conclusão:If meter D decodes signals with misaligned data frames, there is energy overflowing at adjacent frequencies (separate half-odd). If the signal level falling in the "adjacent" frequency box is less than the background noise, the signal may be decoded correctly. However, if the spill is more than the background noise, the ability to distinguish between IeO decreases, and consequently the overall SNR drops, resulting in a decoding error. In conclusion:

a. Se os quadros estiverem desalinhados, contaminação de bits de dados ocorre e a SNR degrada.The. If frames are misaligned, data bit contamination occurs and SNR degrades.

b. No evento que a freqüência muda e há quadros de dados desalinhados, há uma quantia significativa de energia que transborda nas caixas de FFT adjacentes, conseqüentemente interferindo com os outros STs no sistema que se comunicam usando freqüências nessas caixas específicas. Uma vez que o deslocamento de relógio seja determinado correspondendo à SNR mais alta, o medidor então se trava até que uma mudança significante em relação de SNR seja encontrada pelo medidor, em qual caso o processo repete.B. In the event that the frequency changes and there are misaligned data frames, there is a significant amount of energy overflowing in the adjacent FFT boxes, consequently interfering with the other STs in the system that communicate using frequencies in these specific boxes. Once the clock offset is determined corresponding to the highest SNR, the meter then locks up until a significant change in SNR ratio is encountered by the meter, in which case the process repeats.

Implementação de Medição em Medidor DeB usando FFTDeB Meter Measurement Implementation using FFT

Enquanto versões do medidor B e do medidor D executam medição, o medidor D também é responsável por coletar a informação de medição dos vários medidores B por PCB 234. Cada fluxo de dados nos medidores tem um circuito associado para efetuar amplificação analógica e anti-aliasing. Cada uma das seções de extremidade dianteira analógica tem um atenuador programável que é controlado pelo código de nível mais alto. O fluxo de dados é amostrado a 60 kHz (210 * 60) e então um filtro de FIR é aplicado para dizimar o fluxo de dados a ~15 kHz (28 * 60). Especificações de filtro preferidas são mostradas na tabela abaixo e Figura 41.While versions of meter B and meter D perform measurement, meter D is also responsible for collecting measurement information from the various B meters by PCB 234. Each data stream in the meters has an associated circuitry for analog amplification and anti-aliasing. . Each of the analog front end sections has a programmable attenuator that is controlled by the highest level code. The data stream is sampled at 60 kHz (210 * 60) and then an FIR filter is applied to decimate the data stream at ~ 15 kHz (28 * 60). Preferred filter specifications are shown in the table below and Figure 41.

<table>table see original document page 25</column></row><table><table> table see original document page 25 </column> </row> <table>

Desde que só os dados até 3 kHz são de interesse, preferivelmente uma faixa de 3-12 kHz no FIR de dizimação é usada com taxa de amostra de -15KHZ. As freqüências de 0-3 kHz ou 12-15 kHz são mapeadas em 0-3 kHz. Uma FFT real é executada para produzir 2 fluxos de dados que podem ser decompostos ademais em 4 fluxos de dados: Tensão Real e Imaginária e Corrente Real e Imaginária. Isto é alcançado adicionando e subtraindo freqüências de espelho positivas e negativas para as partes real e imaginária, respectivamente. Desde que o sinal 'aliased' na gama de 12-15 kHz cai abaixo de 80 dB, a precisão é alcançada usando o filtro de FIR acima discutido. Alternativamente, uma FFT complexa de 256 pontos pode ser executada em toda fase do fluxo de dados dizimado. Isto produz 2 pares de fluxos de dados: uma parte real, que é a tensão, e uma parte imaginária, que é a corrente. Esta abordagem requer uma FFT complexa de 256 pontos a todo 16,667 milissegundos.Since only data up to 3 kHz is of interest, preferably a 3-12 kHz range in decimation FIR is used with -15KHZ sample rate. The frequencies 0-3 kHz or 12-15 kHz are mapped to 0-3 kHz. A real FFT is performed to produce 2 data streams that can be further decomposed into 4 data streams: Real and Imaginary Voltage and Real and Imaginary Current. This is achieved by adding and subtracting positive and negative mirror frequencies to the real and imaginary parts, respectively. Since the aliased signal in the 12-15 kHz range falls below 80 dB, accuracy is achieved using the FIR filter discussed above. Alternatively, a complex 256-point FFT can be performed at every stage of the decimated data stream. This produces 2 pairs of data streams: a real part, which is the voltage, and an imaginary part, which is the current. This approach requires a complex 256-point FFT at all 16,667 milliseconds.

Os resultados de executar qualquer FFT são a tensão e corrente mostradas na Figura 42, onde a notação Vm,n denota o m-ésimo harmônico do n-ésimo número de ciclo. Por exemplo, V11 e I11 correspondem ao fundamental do primeiro ciclo, e V21 e I21 para o primeiro harmônico do primeiro ciclo, etc., como mostrado na Figura 42, que descreve quadros de FFT para tensão, indicando os harmônicos.The results of performing any FFT are the voltage and current shown in Figure 42, where the notation Vm, n denotes the mth harmonic of the nth cycle number. For example, V11 and I11 correspond to the fundamental of the first cycle, and V21 and I21 to the first harmonic of the first cycle, etc., as shown in Figure 42, which depicts FFT voltage frames indicating the harmonics.

As partes real e imaginária do conteúdo harmônico de qualquer k-ésimo ciclo são dadas por:The real and imaginary parts of the harmonic content of any kth cycle are given by:

Vmk = Re (Vmk) + iIm(Vmk); m = 1,..., M Imk = Re (Imk) + iIm(lmk); k = 1,..., ηVmk = Re (Vmk) + Im (Vmk); m = 1, ..., M Imk = Re (Imk) + Im (1mk); k = 1, ..., η

A parte imaginária de tensão é a medida de falta de sincronização entre a PLL e a freqüência de linha. A fim de calcular quantidades de medição, os cálculos são feitos no domínio de tempo. No domínio de tempo, a funcionalidade de FFT oferece a flexibilidade para calcular quantidades de medição tanto usando só o fundamental ou incluindo os harmônicos. Usando a forma complexa da tensão e corrente obtidas da FFT, as quantidades de medição são calculadas como:The imaginary part of voltage is the measure of lack of synchronization between PLL and line frequency. In order to calculate measurement quantities, calculations are made in the time domain. In the time domain, FFT functionality offers the flexibility to calculate measurement quantities using either the fundamental only or including the harmonics. Using the complex form of voltage and current obtained from the FFT, the measurement quantities are calculated as:

P Vmk * ImkPm * Imk

W = Re(P) = Re(Vmk * Re(Imk + Im(Imk) * Im(Vmk)W = Re (P) = Re (Vmk * Re (Imk + Im (Imk) * Im (Vmk)

Var = Im(P) = Re(Imk) * Im(Vmk) - Re(Vmk) * Im(Imk)Var = Im (P) = Re (Imk) * Im (Vmk) - Re (Vmk) * Im (Imk)

Fator de Potência = W/PPower Factor = W / P

Porém, nas fórmulas anteriores, quando os harmônicos estão incluídos (Vmk e Imk; m = 1, ... M; k = 1, ... n), todas as quantidades de medição incluem os efeitos de harmônicos. Por outro lado, quando só o fundamental é usado (Vlk e Ilk), todas as quantidades calculadas representam só a contribuição de 60 Hz. Como um exemplo, nós mostramos os cálculos só quando o fundamental é usado para executar cálculos. Só Vte I1 são usados de todos os quadros de dados de FFT. As quantidades seguintes são calculadas para um dado conjunto de N quadros e uma freqüência de linha de fune:However, in the previous formulas, when harmonics are included (Vmk and Imk; m = 1, ... M; k = 1, ... n), all measurement quantities include harmonic effects. On the other hand, when only the fundamental is used (Vlk and Ilk), all calculated quantities represent only the 60 Hz contribution. As an example, we show calculations only when the fundamental is used to perform calculations. Only Vte I1 are used from all FFT data frames. The following quantities are calculated for a given set of N frames and a funnel frequency:

<formula>formula see original document page 27</formula><formula> formula see original document page 27 </formula>

para N ciclos.for N cycles.

Esta flexibilidade para tanto incluir ou excluir os harmônicos ao calcular quantidades de medição se traduz a uma melhoria significante sobre as capacidades oferecidas pela concretização acima descrita. Ainda outra característica oferecida por esta concretização é o cálculo de Distorção Harmônica Total (THD). A THD é a medição da distorção harmônica presente, e é definida como a relação da soma das potências de todos os componentes harmônicos para a potência do fundamental. Para o n-ésimo ciclo, isto é avaliado como:This flexibility to either include or exclude harmonics when calculating measurement quantities translates to a significant improvement over the capabilities offered by the above described embodiment. Yet another feature offered by this embodiment is the Total Harmonic Distortion (THD) calculation. THD is the measurement of the present harmonic distortion, and is defined as the ratio of the sum of the powers of all harmonic components to the power of the fundamental. For the nth cycle, this is evaluated as:

<formula>formula see original document page 27</formula><formula> formula see original document page 27 </formula>

Vmn (Imn) é o m-ésimo harmônico do n-ésimo ciclo obtido da FFT, ondeVmn (Imn) is the mth harmonic of the nth cycle obtained from the FFT, where

<formula>formula see original document page 28</formula><formula> formula see original document page 28 </formula>

Módulo de Exibição de ClienteClient Display Module

O módulo de exibição de cliente é instalado nas instalações de cliente, se comunica com o Guarda de Energia perto do transformador, e inclui: PCB 240, fonte de energia e circuitos de PLC (veja a Figura 33); e PCB 220, mostrador de LCD (veja a Figura 34). Em uma concretização, a unidade de exibição de cliente instalada na residência do cliente é um unidade de PLC bidirecional que se comunica com EG. Por exemplo, não só pode a utilidade enviar mensagens, o cliente também pode pedir uma verificação de consumo com o EG instalado no poste.The customer display module is installed at the customer premises, communicates with the Energy Guard near the transformer, and includes: PCB 240, power supply and PLC circuits (see Figure 33); and PCB 220, LCD display (see Figure 34). In one embodiment, the customer display unit installed at the customer's residence is a bidirectional PLC unit that communicates with EG. For example, not only can the utility send messages, the customer can also request a consumption check with the EG installed on the pole.

Enquanto certas concretizações específicas da invenção foram descritas aqui para propósitos ilustrativos, a invenção não está limitada aos detalhes específicos, dispositivos representativos, e exemplos ilustrativos mostrados e descritos aqui. Várias modificações podem ser feitas sem partir do espírito ou extensão da invenção definida pelas reivindicações anexas e seus equivalentes. <table>table see original document page 29</column></row><table> <table>table see original document page 30</column></row><table> <table>table see original document page 31</column></row><table> <table>table see original document page 32</column></row><table> <table>table see original document page 33</column></row><table> mov !PORTC,#read_TRISC ; Switch C port bit 0-4 to input clrb ctl_port.driver_enable ; Disable output drivers, enable jumper read mov temp,#9 :loop djnz temp,:loop ; Wait at least 20 uSee mov W^PORTC ; Get inverse of jumpers in W mov Work_addr,W ; Savejumpervalue setb ctl_portdriver_enable ; Enable output drivers mov !PORTC,#init TRISC ; Restore C port status mov Jumper StatejWork addr ; Savejumper state and Work_addr,#03h ; Ignore ali but 2 LSBs add Work addr,#LCM base addr ; Add base offset cjne Work_addr,PIC_addr,Set_edge_wait Its_us mov Wstate,#Rcv_cmd ; point to next routine jmp Rcvnextword Rcv_cmd mov Command,Comm_bufFer ; save command jnb Command.4,Comm_get_fast ; Fast read command, skip Reg ID mov Wstate,#Rcv_regJE> ; point to next routine jmp Rcv_next_word Comm get fast ; point to next routine mov Wstate,#Rcv_tpar jmp Rcvnextword Rcv reg ID mov register_ID5Comm_buffer ; save register number mov Wstate,#Rcv_tpar ; point to next routine jnb Command .3 ,Rcv_next_word ; Ifno value, done mov word__count,#7 ; Init word count mov Wstate,#Rcv_value ; point to next routine jmp Rcv_next_word Rcv value rl CommJbuffer rl Comm_buffer rl Commbuffer ; Shifl rcvd bits to MSBs mov Comm__bit_count,#5 ; shift 5 bits :shift loop rl Comm_buffer rl Comm_buf+4 rl Comm__buf+3 rl Comm_buf+-2 rl Comm_buf+l rl Comm_buf ; Shift a bit from CommJbuf to comm_bui djnz Comm_bit_count,:shift_loop djnz word_count,Rcv_next_word; any more words? mov Wstate,#Rcv_tpar ; point to next routine jmp Rcv_next_word Rcv_tpar mov WjTpar ; Get result of parity calculations jnz Parityerror ; If not 0, parity error jmp Set_rcv_stop ; set up to receive stop bit ; Comm transmit word handler routinesWhile certain specific embodiments of the invention have been described herein for illustrative purposes, the invention is not limited to the specific details, representative devices, and illustrative examples shown and described herein. Various modifications may be made without departing from the spirit or scope of the invention defined by the appended claims and their equivalents. <table> table see original document page 29 </column> </row> <table> <table> table see original document page 30 </column> </row> <table> <table> table see original document page 31 < / column> </row> <table> <table> table see original document page 32 </column> </row> <table> <table> table see original document page 33 </column> </row> <table> mov! PORTC, # read_TRISC; Switch C port bit 0-4 to input clrb ctl_port.driver_enable; Disable output drivers, enable jumper read mov temp, # 9: loop djnz temp,: loop; Wait at least 20 uSee mov W ^ PORTC; Get inverse of jumpers in W mov Work_addr, W; Savejumpervalue setb ctl_portdriver_enable; Enable output drivers mov! PORTC, # init TRISC; Restore C port status mov Jumper StatejWork addr; Savejumper state and Work_addr, # 03h; Ignore ali but 2 LSBs add Work addr, # LCM base addr; Add base offset cjne Work_addr, PIC_addr, Set_edge_wait Its_us mov Wstate, # Rcv_cmd; point to next routine jmp Rcvnextword Rcv_cmd mov Command, Comm_bufFer; save command jnb Command.4, Comm_get_fast; Fast read command, skip Reg ID mov Wstate, # Rcv_regJE>; point to next routine jmp Rcv_next_word Comm get fast; point to next routine mov Wstate, # Rcv_tpar jmp Rcvnextword Rcv reg ID mov register_ID5Comm_buffer; save register number mov Wstate, # Rcv_tpar; point to next routine jnb Command .3, Rcv_next_word; Ifno value, done mov word__count, # 7; Init word count mov Wstate, # Rcv_value; point to next routine jmp Rcv_next_word Rcv value rl CommJbuffer rl Shifl rcvd bits to MSBs mov Comm__bit_count, # 5; shift 5 bits: shift loop rl Comm_buffer rl Comm_buf + 4 rl Comm__buf + 3 rl Comm_buf + -2 rl Comm_buf + l rl Comm_buf; Bit shift from CommJbuf to comm_bui djnz Comm_bit_count,: shift_loop djnz word_count, Rcv_next_word; any more words? mov Wstate, # Rcv_tpar; point to next routine jmp Rcv_next_word Rcv_tpar mov WjTpar; Get result of parity calculations jnz Parityerror; If not 0, parity error jmp Set_rcv_stop; set up to receive stop bit; Comm transmit word handler routines

99th

XmitwordhandIerXmitwordhandIer

djnz Comm_bit_count,Comm_retdjnz Comm_bit_count, Comm_ret

DoxmitwordDoxmitword

mov PCLATH,#$< mov W5Wstate jmp Wmov PCLATH, # $ <mov W5Wstate jmp W

; Ifword not complete, continue; Ifword not complete, continue

; Execute word handler routine; Run word handler routine

Send_addr mov mov jmpSend_addr mov mov jmp

Send_cmdSend_cmd

movmov

jnbjnb

movmov

Value_is_next mov jmpValue_is_next mov jmp

Send_reg_ID mov mov jmpSend_reg_ID mov mov jmp

Send_value mov movSend_value mov mov

Wstate,#Send_cmd> W,PIC_addr Send next wordWstate, # Send_cmd> W, PIC_addr Send next word

Wstate,#Send_value>Wstate, # Send_value>

Command.4,Value_is_nextCommand.4, Value_is_next

Wstate,#Send_reg_ID>Wstate, # Send_reg_ID>

WsCommand Send next wordWsCommand Send next word

Wstate,#Send_value> W,Register_ID Send next wordWstate, # Send_value> W, Register_ID Send next word

Wstate,#Next_value> Word_count,#7Wstate, # Next_value> Word_count, # 7

; point to next word routine ; get address; point to next word routine; get address

; point to send value; point to send value

; Is it fast read command? ; point to next word routine; Is it fast read command? ; point to next word routine

; get command; get command

; point to next word routine ; get Register ID; point to next word routine; get Register ID

; point to next word routine ; value is 7 words Iong; point to next word routine; value is 7 words Iong

Next valueNext value

:loop: loop

mov Comm_bit_count,#5mov Comm_bit_count, # 5

ri comm_buf+4laugh comm_buf + 4

rl comm_buf+3rl comm_buf + 3

ri Comm_buf+2laugh Comm_buf + 2

ri Comm_buf+llaugh Comm_buf + l

rl Comm_bufrl Comm_buf

rl Comm_bufferrl Comm_buffer

djnz Comm_bit_count,:Ioopdjnz Comm_bit_count,: Ioop

mov WjCommbuffermov WjCommbuffer

djnz word_count, S end_next_wor ddjnz word_count, S end_next_wor d

mov Wstate,#Send_Tpar>mov Wstate, # Send_Tpar>

mov W5Commbuffermov W5Commbuffer

jmp Send_next_wordjmp Send_next_word

; Get 5-bit word ; If not Iast word, ali set ; send parity next; Get 5-bit word; If not Iast word, set there; send parity next

Send_Tpar mov movSend_Tpar mov mov

Wstate,#Send_stop W.TparWstate, # Send_stop W.Tpar

; point to next word routine ; get transverse parity <table>table see original document page 36</column></row><table> <table>table see original document page 37</column></row><table> <table>table see original document page 38</column></row><table> <table>table see original document page 39</column></row><table> <table>table see original document page 40</column></row><table> PIC.DEF; point to next word routine; get transverse parity <table> table see original document page 36 </column> </row> <table> <table> table see original document page 37 </column> </row> <table> <table> table see original document page 38 </column> </row> <table> <table> table see original document page 39 </column> </row> <table> <table> table see original document page 40 </column> </row> <table> PIC.DEF

/*/ *

include file for serial communication with PIC chíps */include file for serial communication with pic chips * /

#pragma switch(ALL,FREQ)#pragma switch (ALL, FREQ)

switch (PIC_serial_status) {switch (PIC_serial_status) {

case sending_bits: case sending st5 bits:case sending_bits: case sending st5 bits:

#ifdef VATEST#ifdef VATEST

out_bit_value = (PICxmitBuf.bits.bufLong[0] and 0x80000000) != 0; /* out bit value = MSB */out_bit_value = (PICxmitBuf.bits.bufLong [0] and 0x80000000)! = 0; / * out bit value = MSB * /

PICxmitBuf.bits.bufLong[0] = PICxmitBuf.bits.bufLong[0] « 1; if (PICxmitBuf.bits.bufLong[l] and 0x80000000)PICxmitBuf.bits.bufLong [0] = PICxmitBuf.bits.bufLong [0] «1; if (PICxmitBuf.bits.bufLong [l] and 0x80000000)

PICxmitBuf.bits.bufLongCO]++; PICxmitBuf.bits.bufLongfl] = PICxmitBuf.bits.bufLong[l] « 1; if (PICxmitBuf.bits.bufLong[2] and 0x80000000)PICxmitBuf.bits.bufLongCO] ++; PICxmitBuf.bits.bufLongfl] = PICxmitBuf.bits.bufLong [1] «1; if (PICxmitBuf.bits.bufLong [2] and 0x80000000)

PICxmitBuf.bits.bufLong[l]++; PICxmitB uf.bits.bufLong[2] = PICxmitBuf.bits.bufLong[2] « 1; /* Shíft 96-bit buffer */PICxmitBuf.bits.bufLong [l] ++; PICxmitB uf.bits.bufLong [2] = PICxmitBuf.bits.bufLong [2] «1; / * Shift 96-bit buffer * /

#else#else

out_bit_value = 0;out_bit_value = 0;

shift_LSB_ptr = andPICxmitBuf.bits.bufByte[l 2]; /* point past least significant word of 96-bit register */shift_LSB_ptr = andPICxmitBuf.bits.bufByte [12]; / * point past least significant word of 96-bit register * /

asm(" MOVE.L _shift_LSB_ptr,A0" " ROXL.W -(AO)", " ROXL.W -(AO)", " ROXL.W -(AO)", " ROXL.W -(AO)", " ROXL.W -(AO)", " ROXL.W -(AO)",asm ("MOVE.L _shift_LSB_ptr, A0" "ROXL.W - (AO)", "ROXL.W - (AO)", "ROXL.W - (AO)", "ROXL.W - (AO)", "ROXL.W - (AO)", "ROXL.W - (AO)",

/* Get pointer to buffer, clear carry */ l* rotate Iefl and decrement pointer */ /* rotate Ieft and decrement pointer */ /* rotate Iefl and decrement pointer */ /* rotate Iefl and decrement pointer */ /* rotate Iefl and decrement pointer */ /* 96 bits have been shifted, MSB is in carry/ * Get pointer to buffer, clear carry * / l * rotate Iefl and decrement pointer * / / * rotate Ieft and decrement pointer * / / * rotate Iefl and decrement pointer * / / * rotate Iefl and decrement pointer * / / * rotate Iefl and decrement pointer * / / * 96 bits have been shifted, MSB is in carry

" ROXL.W"ROXL.W

););

out bit value"out bit value "

/* Put MSB in out bit value *// * Put MSB in out bit value * /

#endif#endif

break; case do_send_cmd: bitcouní = NUM_STARTJBITS-1; PIC_serial__status = sending_start; out_bit_value = 0; break; case do_PIC_start:break; case do_send_cmd: bitcouní = NUM_STARTJBITS-1; PIC_serial__status = sending_start; out_bit_value = 0; break; case do_PIC_start:

bit_count = 3 * BITS_PER_SEC; out_bit_value = I;bit_count = 3 * BITS_PER_SEC; out_bit_value = I;

PIC_serial_status = sending_PlC_start; break; case sending_start: out_bit_value = 0; break; case sending_stop: case sending start 1: out_bit_value — 1; break; default: out_bit_vaIue = 1;PIC_serial_status = sending_PlC_start; break; case sending_start: out_bit_value = 0; break; case sending_stop: case sending start 1: out_bit_value - 1; break; default: out_bit_vaIue = 1;

}}

if (out_bit_vaIue)if (out_bit_vaIue)

fsl004.io.pulse0ut20ff = 1; elsefs1004.io.pulse0ut20ff = 1; else

fsl004.io.pulsé0ut20ff = 0; /* Send bit out */fs1004.io.pulsé0ut20ff = 0; / * Send bit out * /

in_bit_value = fsl004.io.pulseInlState; /* Get rcvd bit value */ fsl004.io.pulse0utl0ff =1; /* Send clock rising edge */in_bit_value = fsl004.io.pulseInlState; / * Get rcvd bit value * / fsl004.io.pulse0utl0ff = 1; / * Send clock rising edge * /

switch (PIC_serial_status) {switch (PIC_serial_status) {

case waiting_for_start: if (in_bit_value = 0) zero_count++;case waiting_for_start: if (in_bit_value = 0) zero_count ++;

else {else {

if (zerocount = (NUM_START_BITS-1)) {if (zerocount = (NUM_START_BITS-1)) {

.PIC_seriaI_status = rcving_bits;.PIC_seriaI_status = rcving_bits;

bit_count = PICrcvBuf.bitCount + 1; }bit_count = PICrcvBuf.bitCount + 1; }

elseelse

zero_count = 0;zero_count = 0;

}}

break; case rcving bits:break; case rcving bits:

# ifdef VATEST# ifdef VATEST

PICrcvBuf.bits.bufLongfO] = PICrcvBuf.bits.bufLong[0] « 1; if (PÍCrcvBuf.bits.bufLong[l] and 0x80000000)PICrcvBuf.bits.bufLongfO] = PICrcvBuf.bits.bufLong [0] «1; if (PICrcvBuf.bits.bufLong [l] and 0x80000000)

PICrcvBuf.bits.bufLongfO]++; PlCrcvBuf.bits.bufLong[l] = PICrcvBuf.bits.bufLong[l] « 1; if (PlCrcvBuf.bits.bufLong[2] and 0x80000000)PICrcvBuf.bits.bufLongfO] ++; PlCrcvBuf.bits.bufLong [l] = PICrcvBuf.bits.bufLong [l] '1; if (PlCrcvBuf.bits.bufLong [2] and 0x80000000)

PICrcvBuf.bits.bufLong[l]++; PICrcvBuf.bfts.bufLong[2] = (PICrcvBuf.bits.bufLong[2] « 1) + inbitvalue;PICrcvBuf.bits.bufLong [l] ++; PICrcvBuf.bfts.bufLong [2] = (PICrcvBuf.bits.bufLong [2] «1) + inbitvalue;

#else#else

shift_LSB_ptr = andPICrcvBuf.bits.bufByte[12]; /* point past least significant word of 96-bit register */shift_LSB_ptr = andPICrcvBuf.bits.bufByte [12]; / * point past least significant word of 96-bit register * /

asm(" MOVE.L _shift_LSB_ptr,A0", /* Get pointer to buffer, clear carry */asm ("MOVE.L _shift_LSB_ptr, A0", / * Get pointer to buffer, clear carry * /

-(AO)", /* rotate Iefl and decrement pointer */- (AO) ", / * rotate Iefl and decrement pointer * /

-(AO)", /* rotate Ieft and decrement pointer */- (AO) ", / * rotate Ieft and decrement pointer * /

-(A0)"s /* rotate Ieft and decrement pointer */- (A0) "s / * rotate Ieft and decrement pointer * /

-(AO)", J* rotate Ieft and decrement pointer */- (AO) ", J * rotate Ieft and decrement pointer * /

-(AO)", /* rotate Ieft and decrement pointer */- (AO) ", / * rotate Ieft and decrement pointer * /

-(AO)" /* 96 bits have been shifted, LSb is unknown- (AO) "/ * 96 bits have been shifted, LSb is unknown

" ROXLAV " ROXL.W " ROXL.W ROXL.W " ROXL.W "* ROXL.W );"ROXLAV" ROXL.W "ROXL.W ROXL.W" ROXL.W "* ROXL.W);

PICrcvBuf.bits.bufByte[ 11] = (PICrcvBuf.bits.bufByte[l 1] and Oxfe) 1 in_bit_value; /* add in received bit */PICrcvBuf.bits.bufByte [11] = (PICrcvBuf.bits.bufByte [11] and Oxfe) 1 in_bit_value; / * add in received bit * /

#endif#endif

break;break;

default: {default: {

>>

>>

if (-bit_count <= O) {if (-bit_count <= O) {

switch (PIC_serial_status) {switch (PIC_serial_status) {

case rcving_bits: PIC_serial_status = rcvingjrtop; bit_count = 1; brsak; case sendingjbits: PlC_seri al_status = sending_stop; bit_count = 1; . break; case sending stop: if (PICxinitBuf.PIC_addr == GLOBAL_PIC_ADDR) PIC_serial_stalus = idle;case rcving_bits: PIC_serial_status = rcvingjrtop; bit_count = 1; brsak; case sendingjbits: PlC_seri al_status = sending_stop; bit_count = 1; . break; case sending stop: if (PICxinitBuf.PIC_addr == GLOBAL_PIC_ADDR) PIC_serial_stalus = idle;

else {else {

PIC_seriaI_status = waiting for start; bit_count = PIC_wait_limit;PIC_seriaI_status = waiting for start; bit_count = PIC_wait_limit;

zero_count = 0; >zero_count = 0; >

break; case sending_PIC_start: PlC_seriaI_status = idle; break; case sending_start: PIÇ_seria lstatus = sending_start_l; bit__count = 1; break; case sending Start 1: PIC_serial_status = sending_bíts; bit__count = PICxmitBuf.bitCount break; case waiting_for_start: PICrcvBuf.flags |= rcv_timeout_flag | rcv_data_ready_flag; PIC_seríal_status = idle; break; case rcving stop: if .(in_bit_value = 0)break; case sending_PIC_start: PlC_seriaI_status = idle; break; case sending_start: PIÇ_seria lstatus = sending_start_l; bit__count = 1; break; case sending Start 1: PIC_serial_status = sending_bits; bit__count = PICxmitBuf.bitCount break; case waiting_for_start: PICrcvBuf.flags | = rcv_timeout_flag | rcv_data_ready_flag; PIC_serial_status = idle; break; case rcving stop: if. (in_bit_value = 0)

PlCrcvBufilags |= rcv_bad_length_flag; PIC_serial_status = idle; PíCrcvBuf.flags J= rcv_data_ready_flag; bit^count = I; break;PlCrcvBufilags | = rcv_bad_length_flag; PIC_serial_status = idle; PCrcvBuf.flags J = rcv_data_ready_flag; bit ^ count = I; break;

default: PlC_serial_status = idle;default: PlC_serial_status = idle;

>>

}}

#pragma Switch(ALL3NOFREO) PULSE.C#pragma Switch (ALL3NOFREO) PULSE.C

Trinclude "mtrlink.def' f* #include "flash.def" */ # define PSTRU_DEFINED í/include "pulselink.defTrinclude "mtrlink.def 'f * #include" flash.def "* / # define PSTRU_DEFINED í / include" pulselink.def

#include "pulse.h" #include "ufloat.h"#include "pulse.h" #include "ufloat.h"

tfinclude "log.h"tfinclude "log.h"

tfinclude "alami.h"tfinclude "alami.h"

#include "copymem.h"#include "copymem.h"

#include "plcctrl.h"#include "plcctrl.h"

#include <stdio.h>#include <stdio.h>

#ifdeffakeMC5# ifdeffakeMC5

#undef NUMPH - #definc NUMPH 24 srendif#undef NUMPH - #definc NUMPH 24 srendif

/* define WDT flags for the PIC communication routine */ tfpragma region Cram=WDTFIags") shortint WDTpulseSec; #pragma region ("ram=ram")/ * set WDT flags for the PIC communication routine * / tfpragma region Cram = WDTFIags ") shortint WDTpulseSec; #pragma region (" ram = ram ")

#pragma region ("data=secondBack") void (*pulseSecondp)(void)=pulseSecond; tfpragma region ("data=data")#pragma region ("data = secondBack") void (* pulseSecondp) (void) = pulseSecond; tfpragma region ("date = date")

#ifndef IS_MC5#ifndef IS_MC5

#pragma region ("data=everySubsecond") í/ifdef ISRS M#pragma region ("data = everySubsecond") í / ifdef ISRS M

void (*pu!seSubsecp)(void)=pulseSubsecond; #elsevoid (* pu! seSubsecp) (void) = pulseSubsecond; #else

void (*pulseSubsecp)(void)=puIseService; ítendifvoid (* pulseSubsecp) (void) = puIseService; meaning

#pragma. region ("data=data") #endif#pragma. region ("data = date") #endif

#pragma region ("data=powerUp") void (*puIseStartupp)(void)=puIseStartup; tfpragma region ("data=data")#pragma region ("data = powerUp") void (* puIseStartupp) (void) = puIseStartup; tfpragma region ("date = date")

#pragma region ("data=dayBack") void (*pulseDayp)(void)=pulseDay; #pragma region ("data=data") /* clear out PIC */#pragma region ("data = dayBack") void (* pulseDayp) (void) = pulseDay; #pragma region ("data = data") / * clear out PIC * /

void pulseColdstartO.void pulseColdstartO.

r Ϊ.r Ϊ.

int i;int i;

for (i=0; i<num_PICs; H+)for (i = 0; i <num_PICs; H +)

if (PIC_status[i].software_type ==3) {if (PIC_status [i] .software_type == 3) {

PIC_status[i] .clear_pulse_regs = TRUE;PIC_status [i] .clear_pulse_regs = TRUE;

PIC_status[i] .getstatus = TRUE; >PIC_status [i] .getstatus = TRUE; >

. clear state = SEND_GLOBAL_CLR; }. clear state = SEND_GLOBAL_CLR; }

void pulseStartup(void)void pulseStartup (void)

t x.x

int i;int i;

#ifndef IS_RSM#ifndef IS_RSM

int work_PIC_addr; tfendifint work_PIC_addr; tfendif

#ifdefIS_MC5# ifdefIS_MC5

int work_num_puIses; #endifint work_num_puIses; #endif

#ifdef VATEST /* testlül! */#ifdef VATEST / * testlül! * /

temp_command = SYSTEM_CONTROL; tempregED = 0;temp_command = SYSTEM_CONTROL; tempregED = 0;

temp_command_data = READENCODERID; tempflags = rcv_data_ready_flag; tfendiftemp_command_data = READENCODERID; tempflags = rcv_data_ready_flag; tfendif

for (i=0;(!dont_clearJPIC_stats) andand (i<{2*NUMPH));i++) {for (i = 0; (! dont_clearJPIC_stats) andand (i <{2 * NUMPH)); i ++) {

puIseData[i].error_cnt = 0; pulseData[i].ID_fie]d[0]=0;puIseData [i] .error_cnt = 0; pulseData [i] .ID_fie] d [0] = 0;

pulscData[i].reading — 0; }pulscData [i] .reading - 0; }

for Ci=O; i<MAX_PICS; i++) PIC_statiis[i].PIC__addr = 0;for Ci = O; i <MAX_PICS; i ++) PIC_stable [i] .PIC__addr = 0;

hoId__num_puIse__ctrs = reIeaseÇodep->option.numPuIseCounters; if (hold_num_pulse_ctrs > NUMPH) num_pulse_ctrs = NUMPH; • elsehoId__num_puIse__ctrs = reIeaseÇodep-> option.numPuIseCounters; if (hold_num_pulse_ctrs> NUMPH) num_pulse_ctrs = NUMPH; • else

num_pulse_ctrs = hold_num_pulse_ctrs; num__PJCs = 1; tfifdef IS_MC5num_pulse_ctrs = hold_num_pulse_ctrs; num__PJCs = 1; tfifdef IS_MC5

. PIC_status[0].PIC_addr = MC5 JVTUXJPIC_ADDR; /* If MC5, add PDM PIC(s) to PIC table */ if (int_configltmessg.configLTM [PULSEI ] .accum) {. PIC_status [0] .PIC_addr = MC5 JVTUXJPIC_ADDR; / * If MC5, add PDM PIC (s) to PIC table * / if (int_configltmessg.configLTM [PULSE] .accum) {

work_num_pulses = num_pulse_ctrs; work_PIC_addr = 0;work_num_pulses = num_pulse_ctrs; work_PIC_addr = 0;

while (work_num_puIses > 0) {while (work_num_puIses> 0) {

PIC_status [numPICs++] .PICaddr = work_PIC_addr++; /* Pulse counters for Ql3PIC_status [numPICs ++] .PICaddr = work_PIC_addr ++; / * Pulse counters for Ql3

work_num_pulses -= 4; } * ·work_num_pulses - = 4; } * ·

}}

. if (int_confígltmessg.confígLTM[PULS E2] .accum). if (int_confígltmessg.confígLTM [PULS E2] .accum)

{ ■ · .. · · work_num_pulses = num_pulse_ctrs; work_PIC_addr = 6;{■ · .. · · work_num_pulses = num_pulse_ctrs; work_PIC_addr = 6;

while (work_num_pulses > 0) {while (work_num_pulses> 0) {

PTC_status[num_PICs++].PIC jiddr = \vork_PlC_addi-H-; /* Pulse counters for Q14PTC_status [num_PICs ++] PIC jiddr = \ vork_PlC_addi-H-; / * Pulse counters for Q14

work_num_pulses -= 4; >work_num_pulses - = 4; >

>>

num LCMs = releaseCodep->option.LCM_flags and 0x03; workPICaddr = LCMB A S EADDR;num LCMs = releaseCodep-> option.LCM_flags and 0x03; workPICaddr = LCMB A S EADDR;

for (i=0;i<nurn_LCMs;i++) {for (i = 0; i <nurn_LCMs; i ++) {

PIC_status[num_PICs++].PIC_addr = work_PIC_addr++; /* LCM's */ }PIC_status [num_PICs ++] PIC_addr = work_PIC_addr ++; / * LCM's * /}

#else#else

ííifdefIS_ST5deifIS_ST5

PIC_status[0].PIC_addr = ST5_MUX_PIC_ADDR; /* If ST5, add mux to PIC table */ ATM_work = releaseCodep->option.couplers_mask; work_PIC_addr = ATM_BASE_ADDR;PIC_status [0] .PIC_addr = ST5_MUX_PIC_ADDR; / * If ST5, add mux to PIC table * / ATM_work = releaseCodep-> option.couplers_mask; work_PIC_addr = ATM_BASE_ADDR;

for (i=0;i<4;i++) {for (i = 0; i <4; i ++) {

if ((ATM_work and 0x08) != 0) { /* Bit is set in mask, add ATM PIC to table */if ((ATM_work and 0x08)! = 0) {/ * Bit is set in mask, add ATM PIC to table * /

PJC_status[numJPICs++].PIC_addr = work_PIC_addr; >PJC_status [numJPICs ++] PIC_addr = work_PIC_addr; >

work_PIÇ_addr++;work_PIÇ_addr ++;

ATMwork = ATM_work « 1; }ATMwork = ATM_work '1; }

#else#else

if (num_pulse_ctrs = 0) numPICs = 0; tfendif #endifif (num_pulse_ctrs = 0) numPICs = 0; tfendif #endif

for Ci=O; i<MAX__PICS; i++)for Ci = O; i <MAX__PICS; i ++)

{ /* Build PlC table */{/ * Build PlC table * /

PIC_status[i].get_semo = TRUE; PIC_status[i].get_version = TRUE; PIC_status[i].get_status = FALSE; . PlCstatusfi] .reset_status = FALSE; PIC_status[i].update_parameter = FALSE; if (! dont__clear_PIC_stats) {"PIC_status [i] .get_semo = TRUE; PIC_status [i] .get_version = TRUE; PIC_status [i] .get_status = FALSE; . PlCstatusfi] .reset_status = FALSE; PIC_status [i] .update_parameter = FALSE; if (! dont__clear_PIC_stats) {"

PIC_status[i].PIC_reset_count = 0; PIC_status[i] .comm_error_count = 0; PlC_status[i]. PIC_data_err__count = O; PIC_status[i].software_type = O; PlC_status[i].software_version = 0;PIC_status [i] .PIC_reset_count = 0; PIC_status [i] .comm_error_count = 0; PlC_status [i]. PIC_data_err__count = O; PIC_status [i] .software_type = O; PlC_status [i] .software_version = 0;

PIC_status[i].serial_number = O; >PIC_status [i] .serial_number = O; >

PIC_status[i].cuir_puIse_reg = O;PIC_status [i] .cuir_puIse_reg = O;

#ifdef IS_MC5#ifdef IS_MC5

if (PIC_status[i] .PICjaddr >= ST5_MUX_PIC_ADDR)if (PIC_status [i] .PICjaddr> = ST5_MUX_PIC_ADDR)

PIC_status[i].repIy_waitJimit = DIRECT_PIC_WAIT_LIMIT; elsePIC_status [i] .repIy_waitJimit = DIRECT_PIC_WAIT_LIMIT; else

PIC_status[i].rep]y_wait_limit = BUFFERED_PIC_WATT_LIMIT;PIC_status [i] .rep] y_wait_limit = BUFFERED_PIC_WATT_LIMIT;

/'else/ 'else

PlC_status[i] .replywaitlimit = DIRECT_PIC_WAIT_LIMIT; #endifPlC_status [i] .replywaitlimit = DIRECT_PIC_WAIT_LIMIT; #endif

if (PIC_status[i].PIC_addr <= MAX_PULSE_PIC_ADDR)if (PIC_status [i] .PIC_addr <= MAX_PULSE_PIC_ADDR)

Pl C_slatus [i ] .num_pu lse_regs = PULSES_PER_PIC; else·Pl C_slatus [i] .num_pu lse_regs = PULSES_PER_PIC; else ·

PIC_status[i].num_pulse_regs = 0;PIC_status [i] .num_pulse_regs = 0;

}}

current_PIC_index = O; rcv_PJC_index = O;current_PIC_index = O; rcv_PJC_index = O;

if (dont_clear_PIC_stats)if (dont_clear_PIC_stats)

dont_clear_PIC_stats = FALSE; /* CIear flag */dont_clear_PIC_stats = FALSE; / * CIear flag * /

else {else {

PIC_bad_addr__count = O; PICrcvBuf.flags = O; PIC^serial_status = do_PIÇ_start;PIC_bad_addr__count = O; PICrcvBuf.flags = O; PIC ^ serial_status = do_PIÇ_start;

PIC_clk state = clk_Iow; ' /* Initialize serial comin variables */PIC_clk state = clk_Iow; '/ * Initialize serial comin variables * /

}}

clear_state = NOGLOB ALSEND;clear_state = NOGLOB ALSEND;

pulseOutMode = releaseCode.option.picMode; /* for compatibility with old code */pulseOutMode = releaseCode.option.picMode; / * for compatibility with old code * /

if (startup.eoldStart) {if (startup.eoldStart) {

pulseColdstartO; } const unsígned char parlty6[32] =pulseColdstartO; } const unsígned char parlty6 [32] =

{1,2,4,7,8,11,13,14,16,19,21,22,25,26,28,31,32,35,37,38,41,42.44,47,49,50,52,55,56,59,61,62 >;{1,2,4,7,8,11,13,14,16,19,21,22,25,26,28,31,32,35,37,38,41,42.44,47,49,50 , 52.55.56.59,61,62>;

void pulseDayO {void pulseDayO {

dont_clear_PIC_stats = TRUE; /* Tell pulseStartup not to clear error counts *f rebuild_timer = REBUILD_DELAY; /* Set up for delayed table rebuild */dont_clear_PIC_stats = TRUE; / * Tell pulseStartup not to clear error counts * f rebuild_timer = REBUILD_DELAY; / * Set up for delayed table rebuild * /

}}

void pulseSecondO {void pulseSecond {

#ifndeflS_ST5# ifndeflS_ST5

pulseServiceO; #endifpulseServiceO; #endif

if (Comm_background_flags.do_rebuild) {if (Comm_background_flags.do_rebuild) {

pulseStartupO;pulseStartupO;

Comm_background_flags. do_rebui 1 d = FALSE; >Comm_background_flags. do_rebui 1 d = FALSE; >

,. if (Cornm_background_flags.do_alarm) . {,. if (Cornm_background_flags.do_alarm). {

putAlarm(andPIC_alarm,4);putAlarm (andPIC_alarm, 4);

Comm_background_flags.do_alarm = FALSE; }Comm_background_flags.do_alarm = FALSE; }

<<

/* set_PLC_relays fimction *// * set_PLC_relays fimction * /

/* Called from PLC routines to request update of */ /* PLC port multíplexer PIC ehíp on ST5 power board *// * Called from PLC routines to request update of * / / * PLC multi-port PIC eip on ST5 power board * /

#ifdefIS_ST5# ifdefIS_ST5

void setJPLC_relays(int xmitRelay,int rcvRelay) {void setJPLC_relays (int xmitRelay, int rcvRelay) {

- while (MUX_controLactivejflag || MUX_control.request_flag) {- while (MUX_controLactivejflag || MUX_control.request_flag) {

ccwaitO; }ccwaitO; }

MUX_oontrol jcmit_mask = xmitRelay; MUX_control.rcv_mask = rcvRelay; MUXjcontrol .done__flag = FALSE; MUX_control.request_flag = TRUE;MUX_oontrol jcmit_mask = xmitRelay; MUX_control.rcv_mask = rcvRelay; MUXjcontrol .done__flag = FALSE; MUX_control.request_flag = TRUE;

if ((MUX_control.xmit_mask != MUX_control.last_xmit_mask) ||if ((MUX_control.xmit_mask! = MUX_control.last_xmit_mask) ||

(MUX_control.rcv_mask != MUX_control.last_rcv_mask)) {(MUX_control.rcv_mask! = MUX_control.last_rcv_mask)) {

•while (!MUX_control.done_flag andand• while (! MUX_control.done_flag andand

!(MUX_controLactive_flag andand (PIC_serial_status === rcving bits)) )! (MUX_controLactive_flag andand (PIC_serial_status === rcving bits)))

{{

ccwaiíOí }ccwaiíOí}

}}

> #endif> #endif

void pulseServiee(void)void pulseServiee (void)

rr

\\

BOOLEAN need_pulse_read, copy_rcvd_data, rcv_buf_err;BOOLEAN need_pulse_read, copy_rcvd_data, rcv_buf_err;

#ifdef IS_MC5 BOOLEAN#ifdef IS_MC5 BOOLEAN

got_ver_3, got_ver_3_3;got_ver_3, got_ver_3_3;

int j;int j;

unsigned char *work_char_jptr; unsigned Iong work_bit_mask; #endifunsigned char * work_char_jptr; unsigned Iong work_bit_mask; #endif

, int \voik_pul se_index;, int \ voik_pul se_index;

phaccum accumXfer; ■ int i;phaccum accumXfer; ■ int i;

if (numJPICs — O)if (numJPICs - O)

PIÇ_serial_status = idle;PIÇ_serial_status = idle;

if (PIC_serial_status = idle) {if (PIC_serial_status = idle) {

if (!WDTpuIseSec)if (! WDTpuIseSec)

WDTpulseSec=I; /*Tell WDT controller that we are OK*/WDTpulseSec = I; / * Tell WDT controller that we are OK * /

}}

if (hoId_num_pulse_ctrs != releaseCodep->option.numPuIseCounters) { /* hdwr -n has changed */if (hoId_num_pulse_ctrs! = releaseCodep-> option.numPuIseCounters) {/ * hdwr -n has changed * /

dont_clear_PIÇ_stats = FALSE;dont_clear_PIÇ_stats = FALSE;

rebuild_timer =1; /* Force immediate table rebuild */ >rebuild_timer = 1; / * Force immediate table rebuild * />

. if ((PIC_serial_status = idle) andand (rebuild_timer != 0) andand. if ((PIC_serial_status = idle) andand (rebuild_timer! = 0) andand

(—rebuild_timer = O)) {(—Rebuild_timer = O)) {

Comm_background_flags.do_rebuild = TRUE; }Comm_background_flags.do_rebuild = TRUE; }

else if ((PIC_serialjjstatus = idle) andand (num PICs !=0) andand (puIseOutMode != PIC_MC_SERIAL) andandelse if ((PIC_serialjjstatus = idle) andand (num PICs! = 0) andand (puIseOutMode! = PIC_MC_SERIAL) andand

(!Comm_backgrotind_f]ags.do_rebuild)) í* Serial processing enabled? +/(! Comm_backgrotind_f] ags.do_rebuild)) í * Serial processing enabled? + /

{{

if (PICrcvBuf.ílags and rcv_data_ready_flag)if (PICrcvBuf.ílags and rcv_data_ready_flag)

{ /* Process received message */{/ * Process received message * /

PICrcvBuf.ílags and= ~rcv_data_ready_flag; rcvjbufjerr — !decade_rcv_buffer();PICrcvBuf.ílags and = ~ rcv_data_ready_flag; rcvjbufjerr -! decade_rcv_buffer ();

if ((PIC_comm_mon.control_flags and RCVDATARDY) = 0) {if ((PIC_comm_mon.control_flags and RCVDATARDY) = 0) {

PIC_comm_mon.rcv_buf = PICrcvBuf;PIC_comm_mon.rcv_buf = PICrcvBuf;

PIC_comm_mon.control_flags |= RCV DATA RDY; }PIC_comm_mon.control_flags | = RCV DATA RDY; }

if ((ext_comm.control_flags and CPY_RCV_DATA) != 0) tif ((ext_comm.control_flags and CPY_RCV_DATA)! = 0) t

\\

extjcomm .rcv_buf=PICrcvBuf; ext_comm.control_fIags and= ~CPY_RCV_DATA;extjcomm .rcv_buf = PICrcvBuf; ext_comm.control_fIags and = ~ CPY_RCV_DATA;

ext_comm.control__flags |= RCV_DATA RDY; >ext_comm.control__flags | = RCV_DATA RDY; >

#ifdefIS_ST5# ifdefIS_ST5

if (ATM_control.active_flag) {if (ATM_control.active_flag) {

ATM__control.result_flags = PICrcvBuf.flags;ATM__control.result_flags = PICrcvBuf.flags;

if (rcv_buf_err) {if (rcv_buf_err) {

if (ATM control.state != WATT ALIGN) {if (ATM control.state! = WATT ALIGN) {

ATM_controI.error_flag = TRUE; ATM_contro].active_flag — FALSE;ATM_controI.error_flag = TRUE; ATM_contro] .active_flag - FALSE;

• ATM_controi.done_flag = TRUE;• ATM_controi.done_flag = TRUE;

• > -•> -

>>

cise { ·cise {·

switch (ATM control.state) {switch (ATM control.state) {

case DOPRESET: {case DOPRESET: {

ATM_control.xmit_IeveI = PICrcvBuf.command_data » 24; ATM_control.coupIer_level = (PICrcvBuf.command_data » 16) and OxOff;ATM_control.xmit_IeveI = PICrcvBuf.command_data »24; ATM_control.coupIer_level = (PICrcvBuf.command_data »16) and OxOff;

ATM_control .acti ve_flag = FALSE; }ATM_control .acti ve_flag = FALSE; }

break;break;

case SET_AL1GN: {case SET_AL1GN: {

ATM_controI. state = WATT_ALIGN; >ATM_controI. state = WATT_ALIGN; >

break:break:

case \VAIT_ALIGN: {case \ VAIT_ALIGN: {

ATM_control.optimum_cap_code = PICrcvB uf.command_data and ATMJRC_CAP_MASK;ATM_control.optimum_cap_code = PICrcvB uf.command_data and ATMJRC_CAP_MASK;

ATM_control.optimum_reading = PICrcvBuf.command_data» 16; ATM_control.result_flags |= (PICrcvBuf.command_data and OxeOOO);ATM_control.optimum_reading = PICrcvBuf.command_data »16; ATM_control.result_flags | = (PICrcvBuf.command_data and OxeOOO);

/* Copy flags from reply */ , if ((ATM_control.result_flags and OxeOOO) != 0)/ * Copy flags from reply * /, if ((ATM_control.result_flags and OxeOOO)! = 0)

{ /* AnaJog leveis out of range */{/ * AnaJog leads out of range * /

ATM_control.error_flag = TRUE; \ if (ATM_control.optimum_reading < ATM_MIN_READTNG) {ATM_control.error_flag = TRUE; \ if (ATM_control.optimum_reading <ATM_MIN_READTNG) {

ATM_contxol.resultJflags |= 0x1000; /* Indicate reading too Iow */ATM_contxol.resultJflags | = 0x1000; / * Indicate reading too Iow * /

ATM_control.error_flag = TRUE; >ATM_control.error_flag = TRUE; >

AlM_controI.active_flag = FALSE; >AlM_controI.active_flag = FALSE; >

break; case DOJPLC_SET:break; case DOJPLC_SET:

case DO_ATM_DISCONNECT: {case DO_ATM_DISCONNECT: {

ATM_controI.active_flag- = FALSE; }ATM_controI.active_flag- = FALSE; }

break;break;

default: {default: {

ATM_control.aclive_flag = FALSE;ATM_control.aclive_flag = FALSE;

ATM_controI.error_flag = TRUE; }ATM_controI.error_flag = TRUE; }

break;break;

}}

>>

if (!ATM_contro1.active_flag) ATM_control.done_flag = TRUE;if (! ATM_contro1.active_flag) ATM_control.done_flag = TRUE;

>>

if (MUX_control.active_flag) {if (MUX_control.active_flag) {

MUX_controI.resuIt_flags = PICrcvBuf.flags;MUX_controI.resuIt_flags = PICrcvBuf.flags;

if (rcv_buf_err) {if (rcv_buf_err) {

MUX_control.error_flag = TRUE; MUX_control.last_xmit_mask = 0;MUX_control.error_flag = TRUE; MUX_control.last_xmit_mask = 0;

MUX_control.last_rcv_mask = 0; }MUX_control.last_rcv_mask = 0; }

cise {cise {

M U X_contro 1.1 ast_xmit_m ask == PICrcvBuf.command_data and Oxfif;M U X_contro 1.1 ast_xmit_m ask == PICrcvBuf.command_data and Oxfif;

MUX_control.last_rcv_mask = (PICrcvBuf.command_data » 8) and OxfF; }MUX_control.last_rcv_mask = (PICrcvBuf.command_data.8) and OxfF; }

MUX_control.active_flag = FALSE;MUX_control.active_flag = FALSE;

MUX_control.done_flag = TRUE; >MUX_control.done_flag = TRUE; >

#endif#endif

if (rcv_buf_err) {if (rcv_buf_err) {

#ifdef IS_ST5#ifdef IS_ST5

if f!ATM_control.active_flag || (ATM_controI.state í= WAIT ALIGN))if f! ATM_control.active_flag || (ATM_controI.state í = WAIT ALIGN))

tfendiftfendif

{{

last_comm_err_flag = PICrcvBuf.flags;last_comm_err_flag = PICrcvBuf.flags;

copymem(sizeof (PICbitBuf), (char *) (andHoldrcvBuf), (char *) (andPICrcvBuf));copymem (sizeof (PICbitBuf), (char *) (andHoldrcvBuf), (char *) (andPICrcvBuf));

if ((PICrcvBuf.flags and rcv_bad_addr_flag) != 0) { /* past end of valid PICs, address error */ PIC_bad_addr_counH-+;if ((PICrcvBuf.flags and rcv_bad_addr_flag)! = 0) {/ * past end of valid PICs, address error * / PIC_bad_addr_counH- +;

set_PIC_alarm(PIC_adderr_OJPICrcvBuf.PIC_addr,set_PIC_alarm (PIC_adderr_OJPICrcvBuf.PIC_addr,

(PICxmitBuf.PICjaddr « 8)+PICxmitBuf.command);(PICxmitBuf.PICjaddr (8) + PICxmitBuf.command);

}}

elseelse

{ /* PIC address was valid, but comm failed */ PIC_status[rcv_PIC_index].comm_error_countr»-+;{/ * PIC address was valid, but failed * / PIC_status [rcv_PIC_index] .comm_error_countr »- +;

if (PIC_status[rcv_PIC_index].comm_error_count> 2) {if (PIC_status [rcv_PIC_index] .comm_error_count> 2) {

set_PIC_aIarm(PIC_coraeiT_0JPIC_status[rcv_PIC_index].PIC_addr, PICrcvBuf.flags);set_PIC_aIarm (PIC_coraeiT_0JPIC_status [rcv_PIC_index] .PIC_addr, PICrcvBuf.flags);

}}

/* Lost contact with PlC, read serial number and software version */ PIC_status[rcv_PIC_index] .get_serno = TRUE;/ * Lost contact with PlC, read serial number and software version * / PIC_status [rcv_PIC_index] .get_serno = TRUE;

PIC_status[rcv_PIÇ_index].get_version = TRUE; }PIC_status [rcv_PIÇ_index] .get_version = TRUE; }

}}

>>

elseelse

{ /* Valid message received */{/ * Valid message received * /

if ((PICrcvBuf.command = READJREGISTER) andand (PÍCrcvBuf.regjnD =if ((PICrcvBuf.command = READJREGISTER) andand (PICrcvBuf.regjnD =

STATUS_REG)) {STATUS_REG)) {

process_status_bits(); >process_status_bits (); >

else if (PTCrcvBufLcommand = SYSTEM_CONTROL) {else if (PTCrcvBufLcommand = SYSTEM_CONTROL) {

if (PlCrcvBuf.regJD == STATUS_REG) { /* Response frome reset status bits cmd */if (PlCrcvBuf.regJD == STATUS_REG) {/ * Response frome reset status bits cmd * /

PIC_status[rcv_PIC_index].reser_status = FALSE;PIC_status [rcv_PIC_index] .reser_status = FALSE;

process_status_b itsÇ); }process_status_b itsÇ); }

/fifdef IS_MC5/ fifdef IS_MC5

else if ( (PIC_status[rcv_PIC_index].softwaretype = 4) andandelse if ((PIC_status [rcv_PIC_index] .softwaretype = 4) andand

((PIC_status[rcv_PICJndex).last_cmd_data and OxffffOOOO) = READ_ENCODER_iD) )((PIC_status [rcv_PICJndex) .last_cmd_data and OxffffOOOO) = READ_ENCODER_iD))

{ /* response from encoder read ID comd */{/ * response from encoder read ID comd * /

work__pulseJndex = (PICrcvBuf.PIC_addr * PULSES_PERJPIC) + PICrcvBuf.regJD;work__pulseJndex = (PICrcvBuf.PIC_addr * PULSES_PERJPIC) + PICrcvBuf.regJD;

i = (PlC_status[rcv_PIC_index].last_cmd_data and OxOOOOffDO) » 8; work_char_ptr = (unsigned char *) andPICrcvBuf.command__data;i = (PlC_status [rcv_PIC_index] .last_cmd_data and OxOOOOffDO) 8; work_char_ptr = (unsigned char *) andPICrcvBuf.command__data;

for (j=0; j<4; j++) · .for (j = 0; j <4; j ++) ·.

{{

if ((*work_char__ptr = O) || (i >= ID_FIELD_LENGTH)> {if ((* work_char__ptr = O) || (i> = ID_FIELD_LENGTH)> {

j = 10; /* indicate end of message found *J }j = 10; / * indicate end of message found * J}

else {else {

pulseData[workjpu!se_index].ID_buffer[í] = *work_char_ptr; i++;pulseData [workjpu! se_index] .ID_buffer [í] = * work_char_ptr; i ++;

work_char_ptr-H-; >work_char_ptr-H-; >

> <table>table see original document page 54</column></row><table> if (work_puIse_index < (NUMPH * 2)) {> <table> table see original document page 54 </column> </row> <table> if (work_puIse_index <(NUMPH * 2)) {

pulseData[work_pulse_index].reading = PlCrcvBuf.command_data; copy_rcvd_data = FALSE; .' ' · · ·pulseData [work_pulse_index] .reading = PlCrcvBuf.command_data; copy_rcvd_data = FALSE; . ' '· · ·

if(PIC_status[rcv_PIC_index].get_version) {if (PIC_status [rcv_PIC_index] .get_version) {

>>

else if (PIC_status[rcv_PIC_index].sofhvare_type = 4) { /* Remote encoder interface module */else if (PIC_status [rcv_PIC_index] .sofhvare_type = 4) {/ * Remote encoder interface module * /

• copy_rcvd_data - TRUE;• copy_rcvd_data - TRUE;

• accumXfer.low = pulseData[work_pulse_index].reading; }• accumXfer.low = pulseData [work_pulse_index] .reading; }

else if (PIC_status[rcvJPJC_index].software_type — 3) { /* Remote pulse counter module */else if (PIC_status [rcvJPJC_index] .software_type - 3) {/ * Remote pulse counter module * /

copy_rcvd_data = TRUE;copy_rcvd_data = TRUE;

if (!PIC_status[rcv_PIC_index].get_serno) {if (! PIC_status [rcv_PIC_index] .get_serno) {

sprmtf((char *) pulseData[work_pulse_index] .ID_field,"S%08 ldP%d", PIC__status[rcv_PTC_index].serial_number, PICrcvBuf.regJD);sprmtf ((char *) pulseData [work_pulse_index] .ID_field, "S% 08 ldP% d", PIC__status [rcv_PTC_index] .serial_number, PICrcvBuf.regJD);

>>

if (releaseCode.option.countEveryEdge) {if (releaseCode.option.countEveryEdge) {

accumXfer.low = pulseData[work_pulse_index].reading; >accumXfer.low = pulseData [work_pulse_index] .reading; >

else { ·else {·

accumXfer.low = pulseData[work_pulse_index].reading » 1; }accumXfer.low = pulseData [work_pulse_index] .reading »1; }

}}

accumXfer.high = OL; #ifhdef VATESTaccumXfer.high = OL; #ifhdef VATEST

if (copy_rcvd_data) {if (copy_rcvd_data) {

#ifhdef IS_MC5#ifhdef IS_MC5

/* It is an RSM or ST5, so mapping for pulse 1 thru 4 is M1Q13, M1Q14, M2Q13,/ * It is an RSM or ST5, so mapping for pulse 1 thru 4 is M1Q13, M1Q14, M2Q13,

M2Q14 */M2Q14 * /

ph[0][workjulse_index/2][(workjpulse_indexand0x0l)?PULSE2:PULSEl].accum =ph [0] [workjulse_index / 2] [(workjpulse_indexand0x0l)? PULSE2: PULSEl] .accum =

ph[ 1 ][work_pulse_index/2][(work_pulse_indexand0x01 )?PULSE2:PULSE 1] .accum = accumXfer;ph [1] [work_pulse_index / 2] [(work_pulse_indexand0x01)? PULSE2: PULSE 1] .accum = accumXfer;

f/e Isef / e Ise

/* It is an MC5, so mapping for pulse 1 thru 48 is M1Q13..M24Q13, M1Q14..M24Q14 V/ * It is an MC5, so mapping for pulse 1 thru 48 is M1Q13..M24Q13, M1Q14..M24Q14 V

ph[0][workjpuIseJndex%l^MPH][(workju!se^ m = <table>table see original document page 56</column></row><table> PICxmitBuf.command = WRITEJREGISTER; PICxmitBuf.reg_ID = OUTPUT_REG;ph [0] [workjpuIseJndex% l ^ MPH] [(workju! se ^ m = <table> table see original document page 56 </column> </row> <table> PICxmitBuf.command = WRITEJREGISTER; PICxmitBuf.reg_ID = OUTPUT_REG ;

PICxmitBuf.command_data = ATM_control.start_cap_code and ATM_RCCAP_MASK;PICxmitBuf.command_data = ATM_control.start_cap_code and ATM_RCCAP_MASK;

PICxmitBuf.command_data |= ATM_PRESET_CODE; " ATM_controI.state = DOJPRESET; break;PICxmitBuf.command_data | = ATM_PRESET_CODE; "ATM_controI.state = DOJPRESET; break;

case DOJaLIQN:case DOJaLIQN:

. PICxmitBuf.command = WRTTE_REGISTER; PICxmitBuf.reglD « CONTROLREG;. PICxmitBuf.command = WRTTE_REGISTER; PICxmitBuf.reglD 'CONTROLREG;

if (ATM_control.start_cap_code > ATM_control.end_cap_code)if (ATM_control.start_cap_code> ATM_control.end_cap_code)

ATM_control.end_cap_code = ATMcontrol .start_cap_code; PICxmitBnf.command_data = ATM__control.start_cap_code and ATM_RC_CAP_MASK;ATM_control.end_cap_code = ATMcontrol .start_cap_code; PICxmitBnf.command_data = ATM__control.start_cap_code and ATM_RC_CAP_MASK;

PICxmitBuf.command_data = (PICxmitBuf.command_data « 12 ) |PICxmitBuf.command_data = (PICxmitBuf.command_data «12) |

(ATM_control .end_cap_code and ATM_RC_CAP_MASK) I (ATM_MEAS_TIME « 24); ATM_control.state = SET_ALIGN;(ATM_control .end_cap_code and ATM_RC_CAP_MASK) I (ATM_MEAS_TIME '24); ATM_control.state = SET_ALIGN;

ATM_control.align_timer = ATM_control.end_cap_code - ATM_control .start_cap_code;ATM_control.align_timer = ATM_control.end_cap_code - ATM_control .start_cap_code;

ATM_control.align_timer *= ((ATM DISC_TIME + ATM_MEAS_TTME + 4) * (1.25/62.5));ATM_control.align_timer * = ((ATM DISC_TIME + ATM_MEAS_TTME + 4) * (1.25 / 62.5));

ATM_control.align_timer +=13; /* Time in 1/64 sec to wait before checkingATM_control.align_timer + = 13; / * Time in 1/64 sec to wait before checking

result *íresult * í

/* Number of steps * time per step + 25% + .2 second *// * Number of steps * time per step + 25% + .2 second * /

break;break;

case SET_NORMAL_PLC: PICxm itBuf.command = WRliEREGXS TER; PICxmitBufregJD = OUTPUT_REG;case SET_NORMAL_PLC: PICxm itBuf.command = WRliEREGXS TER; PICxmitBufregJD = OUTPUT_REG;

PICxm itBuf.command_data = ATM_cojitrol.optimum_cap_code and ATM_JRC_CAP_MASK;PICxm itBuf.command_data = ATM_cojitrol.optimum_cap_code and ATM_JRC_CAP_MASK;

PICxmitBuf.commanddata |= ATM_PLC_CODE;PICxmitBuf.commanddata | = ATM_PLC_CODE;

ATM_control.state = DOPLCJSET;ATM_control.state = DOPLCJSET;

break;break;

case DISCONNECTICOUPLER: PICxmitBuf.command = WRTTER EG1STER; PlCxmitBuf.reg_ID = OUTPUT_REG;case DISCONNECTICOUPLER: PICxmitBuf.command = WRTTER EG1STER; PlCxmitBuf.reg_ID = OUTPUT_REG;

PICxmitBuf.command__data = ATM_eontro!,optimum_cap_code and ATMRCC ΑΡΜΑ SK;PICxmitBuf.command__data = ATM_eontro !, optimum_cap_code and ATMRCC ΑΡΜΑ SK;

PICxmitBuf.command data |= ATM_DISC_CODE; . ATM_control.state = DO_ATM__DISCONNECT; break;PICxmitBuf.command data | = ATM_DISC_CODE; . ATM_control.state = DO_ATM__DISCONNECT; break;

defauJt:defauJt:

case READ_XM1T_LEVEL: . ATM_control.error_flag = TRUE; ATM_control.done_flag = TRUE; ATM_control.active_flag - FALSE; break; if (ATM_confrol.active_flag) {case READ_XM1T_LEVEL:. ATM_control.error_flag = TRUE; ATM_control.done_flag = TRUE; ATM_control.active_flag - FALSE; break; if (ATM_confrol.active_flag) {

formatjxmitJbufferO;formatjxmitJbufferO;

PIC_wait_limit = DIRECT_PIC_WAIT_LIMIT; PIC_serial_status = do_send__cmd; /* Start UART */PIC_wait_limit = DIRECT_PIC_WAIT_LIMIT; PIC_serial_status = do_send__cmd; / * Start UART * /

>>

else if (ATM_control.active_flag) {else if (ATM_control.active_flag) {

if ((ATM_control.state != WAIT ALIGN) ||if ((ATM_control.state! = WAIT ALIGN) ||

(~ATM_control .a) ign_timer <= 0» {(~ ATM_control .a) ign_timer <= 0 »{

ATM_control.error_flag = TRUE; ATM_control.done_flag = TRUE;ATM_control.error_flag = TRUE; ATM_control.done_flag = TRUE;

ATM_control.active_flag = FALSE; >ATM_control.active_flag = FALSE; >

eiseeise

{ /* poli ATM for auto-tune end */{/ * poly ATM for auto-tune end * /

PíCxmitBuf.command = 0;PxmitBuf.command = 0;

format_xmitjbuffer0;format_xmitjbuffer0;

PIC_waitJimit = DIRECTJPICJWAITJLIMIT;PIC_waitJimit = DIRECTJPICJWAITJLIMIT;

PIC_seriaI_status = do_send cmd; J* Start UART */ }PIC_seriaI_status = do_send cmd; J * Start UART * /}

}}

else if (MTJX_controI.request_flag) {else if (MTJX_controI.request_flag) {

MUX_control.request__flag = FALSE; MUX_control.error_flag = FALSE;MUX_control.request__flag = FALSE; MUX_control.error_flag = FALSE;

if ((pulseOutMode = P1C_ST_SERIAL)) {if ((pulseOutMode = P1C_ST_SERIAL)) {

PICximtBuf.bils.bufByte[0] = ((MUX_control.rcv_mask and 0x03) « 5) | ((MUX_control.xmit_mask and 0x7f) » 2);PICximtBuf.bils.bufByte [0] = ((MUX_control.rcv_mask and 0x03) «5) | ((MUX_control.xmit_mask and 0x7f) 2);

PICxmitBuf,bits .bufByte[ 1] = ((MUX_control.xmit_mask and 0x03) « 6);PICxmitBuf, bits .bufByte [1] = ((MUX_control.xmit_mask and 0x03) 6);

bit_count= 11;bit_count = 11;

PIC_serial_status = sending_stS_bits; /* Start UART */ MUX_controI.last_xmit_mask = MUX_control.xmit_n?ask; MUX_control.Iast_rcv_mask = MUX_control. rcv_mask; MUX_control.done_flag = TRUE;PIC_serial_status = sending_stS_bits; / * Start UART * / MUX_controI.last_xmit_mask = MUX_control.xmit_n? Ask; MUX_control.Iast_rcv_mask = MUX_control. rcv_mask; MUX_control.done_flag = TRUE;

else {else {

MUX_controI.active_flag = TRUE; PICxmitBuf.PIC_addr = ST5_MUX_PIC_ADDR; PíCxmitBuf.command = WRITEREG1STER; P ICxm itB uf.reglD = OUTPUT_REG;MUX_controI.active_flag = TRUE; PICxmitBuf.PIC_addr = ST5_MUX_PIC_ADDR; PmitmitBuf.command = WRITEREG1STER; P ICxm itB uf.reglD = OUTPUT_REG;

.PICxmitBuf.command_data = (MUX_controI.rcv_mask « 8) + NlUXcontrol.xmitjmask;.PICxmitBuf.command_data = (MUX_controI.rcv_mask '8) + NlUXcontrol.xmitjmask;

format_xmit_buffer0;format_xmit_buffer0;

PlCjvaitJiroit = DIRECTJPJCWAITJLIMIT; PIC_serial_status = do_send_cmd; · /* Start UART */ >PlCjvaitJiroit = DIRECTJPJCWAITJLIMIT; PIC_serial_status = do_send_cmd; · / * Start UART * />

>>

#endif#endif

else if ((ext_comm.control_flags and (XMIT_DATA_RDY | XMIT_REQUEST» = . (XMIT_DATAJRDY | XMIT REQUEST)) { , /* Send command for externai routine */else if ((ext_comm.control_flags and (XMIT_DATA_RDY | XMIT_REQUEST »=. (XMIT_DATAJRDY | XMIT REQUEST)) {, / * Send command for external routine * /

PICxmitBuf= ext_comm,xmit_buf; ext_comm.control_flags and= ~XMIT_REQUEST; ext_comm.control_flags |= CPY_RCV_DATA;PICxmitBuf = ext_comm, xmit_buf; ext_comm.control_flags and = ~ XMIT_REQUEST; ext_comm.control_flags | = CPY_RCV_DATA;

/* Look up correct PIÇ_status index for reuested PIC *// * Look up correct PIÇ_status index for reuested PIC * /

for (i=0; ((i<MAX_PICS) andand (PIC_status[i].PIC_addr != PICxmitBuf.PIC_addr)); i++); ·for (i = 0; ((i <MAX_PICS) andand (PIC_status [i] .PIC_addr! = PICxmitBuf.PIC_addr)); i ++); ·

if (i < numJPICs) {if (i <numJPICs) {

P ICstatu s[i]. last_cmd_data = PICxm itBuf.command_data;P ICstatu s [i]. last_cmd_data = PICxm itBuf.command_data;

PlCstatusfi]. Iastcommand = PICxmilBuf.command; >Platusatus]. Iastcommand = PICxmilBuf.command; >

#ifdeflS_MC5# ifdeflS_MC5

if (ext_comm.xmit_buf.PIC_addr < ST5_MUX_PIC_ADDR)if (ext_comm.xmit_buf.PIC_addr <ST5_MUX_PIC_ADDR)

PICwaitiimit = BUFFERED_PIC_WAIT_LIMIT; elsePICwaitiimit = BUFFERED_PIC_WAIT_LIMIT; else

ííendifimendif

PIC _vvait_limit = DIRECT_PIC_WAIT_LIMrr; format_xihit_bufferO;PIC _vvait_limit = DIRECT_PIC_WAIT_LIMrr; format_xihit_bufferO;

PlCjserialstatus = do_send_cmd; /* Start UART »/PlCjserialstatus = do_send_cmd; / * Start UART »/

>>

else if ( ((ext_comm.controI_flags and SUPPRESS_NORMAL_COMM) — 0) #ifdefIS_ST5else if (((ext_comm.controI_flags and SUPPRESS_NORMAL_COMM) - 0) # ifdefIS_ST5

andand ST5_PIC_de lay ctr <= 0»andand ST5_PIC_de lay ctr <= 0 »

{{

ST5_PlC_delay_ctr = ST5_P1C_DELAY; /* Slow down routine communications in 1he ST5 +/ #elseST5_PlC_delay_ctr = ST5_P1C_DELAY; / * Slow down routine communications in 1h ST5 + / #else

>>

{{

//endif// endif

PICxmitBuf.PICaddr = PIC_status[current_PIC_index].PIC_addr; need_pulse_read = TRUE; /* Set defaults */PICxmitBuf.PICaddr = PIC_status [current_PIC_index] .PIC_addr; need_pulse_read = TRUE; / * Set defaults * /

#ifdefIS_ST5# ifdefIS_ST5

if ((pulseOutMode = PIC_ST_SERIAL) andandif ((pulseOutMode = PIC_ST_SERIAL) andand

(PlCxn)itBuf.PlC_addr = ST5_MUX_PIC_ADDR» {(PlCxn) itBuf.PlC_addr = ST5_MUX_PIC_ADDR »{

}}

else tfendifelse tfendif

if (PIC_status[current_PIC_index].force_j)ulse_read andand (ÍPIC_status[current_PíC_index].get_version)andandif (PIC_status [current_PIC_index] .force_j) ulse_read andand (PIC_status [current_PíC_index] .get_version) andand

(PIC_status[current_PIC_index].PIC_addr < ST5_MUX_PIC_ADDR) ) {(PIC_status [current_PIC_index] .PIC_addr <ST5_MUX_PIC_ADDR)) {

PIC_status[current_PIC_index].force_puIse_read = FALSE: > ·PIC_status [current_PIC_index] .force_puIse_read = FALSE:> ·

else · ·else · ·

{{

PIC_status[current_PIÇ_index].forcej?ulse_read = TRUE; #ifndefIS_ST5PIC_status [current_PIÇ_index] .forcej? Ulse_read = TRUE; # ifndefIS_ST5

if (PIC_status[current_PTC_index].clear_pulse_regs andand (clearjstate = GLOBALCLRSENT) ) { /* Global clear sent, get status */if (PIC_status [current_PTC_index] .clear_pulse_regs andand (clearjstate = GLOBALCLRSENT)) {/ * Global clear sent, get status * /

need_pulse_read = FALSE; PICxmitBuf.command = READREGISTER; PICxmitBuf.reg_ID = STATUS_REG;need_pulse_read = FALSE; PICxmitBuf.command = READREGISTER; PICxmitBuf.reg_ID = STATUS_REG;

format_xmit_bufferO; }format_xmit_bufferO; }

elseelse

//endif// endif

if (PIÇ_status[carrent_PIC_índex].get_version) { -if (PIÇ_status [carrent_PIC_index] .get_version) {-

need_pulse_read = FALSE; PICxmitBuf.command = READREGISTER; PlCxmitB uf.reg_IE> = VERS_REG;need_pulse_read = FALSE; PICxmitBuf.command = READREGISTER; PlCxmitB uf.reg_IE> = VERS_REG;

format_xmit_buffer(); }format_xmit_buffer (); }

else if (PIC_status[current_PlC_index].get_serno) {else if (PIC_status [current_PlC_index] .get_serno) {

need_pulse_read = FALSE; PICxmitBuf.command = READREGISTER; PICxmitBuf.regJDD .= SERNO_REG;need_pulse_read = FALSE; PICxmitBuf.command = READREGISTER; PICxmitBuf.regJDD. = SERNO_REG;

format_xmit_buirerO; >format_xmit_buirerO; >

else if (PlC_status[current_PIC_index].update_parameter) {else if (PlC_status [current_PIC_index] .update_parameter) {

PICxmitBuf.command = WRITEJREGISTER; if (PIC_status[cuiTent_PIC_index].software_type = 3) { /* Pulse ctr *fPICxmitBuf.command = WRITEJREGISTER; if (PIC_status [cuiTent_PIC_index] .software_type = 3) {/ * Pulse ctr * f

r /* Pulse ctr parameters: */r / * Pulse ctr parameters: * /

/* Power-On sample rate: , 42/sec *í /* Power-ofF sample rate: 1/sec */ /* Days to count if rcving pulses: */ /* . RSM: 5 days ·// * Power-On sample rate:, 42 / sec * í / * Power-ofF sample rate: 1 / sec * / / * Days to count if rcving pulses: * / / *. RSM: 5 days · /

/* PDM: 3 5 days */ /* Days to count if no pulses rcvd: */ /* - RSM: 1 day *// * PDM: 3 5 days * / / * Days to count if no pulses rcvd: * / / * - RSM: 1 day * /

/* PDM: 3 days . *// * PDM: 3 days. * /

/* nn RSM the O. Ishc nf */ ϊ* load_shedjmask[0] are sent to */ /* the PIC output bits *// * nn RSM the O. Ishc nf * / ϊ * load_shedjmask [0] are sent to * / / * the PIC output bits * /

#ifdefIS_RSM#ifdefIS_RSM

PICxmitBuf.commat\d_data = 0x01150507 and (load_shed_state[Ol | OxffiHEfc);PICxmitBuf.commat \ d_data = 0x01150507 and (load_shed_state [Ol | OxffiHEfc);

#else#else

PICxmitBuf.command_data = 0x011523Od;PICxmitBuf.command_data = 0x011523Od;

#endif#endif

>>

#ifdefIS_MC5# ifdefIS_MC5

else if (PTC_status[current_PIC_index].software_type = 4) { /* Remote encoder reader */else if (PTC_status [current_PIC_index] .software_type = 4) {/ * Remote encoder reader * /

PICxmitBuf.command_data = READJENCODER__PARM; if ((releaseCodep->option.couplers_mask and 0x01) = 0) • { /* If mask bit 0 is 0, no touch-pad compatibility */PICxmitBuf.command_data = READJENCODER__PARM; if ((releaseCodep-> option.couplers_mask and 0x01) = 0) • {/ * If mask bit 0 is 0, no touch-pad compatibility * /

PICxmitBuf.co'mmand_data and= OxffOOffít; }PICxmitBuf.co'mmand_data and = OxffOOffít; }

}}

else if (PIC_status[current_PIC_index].software_type = 5) { /* MCS iqux */'else if (PIC_status [current_PIC_index] .software_type = 5) {/ * MCS iqux * / '

got_ver_3 = got_ver_3_3 = FALSE;got_ver_3 = got_ver_3_3 = FALSE;

for (i=0; i<num_PICs; i++) {for (i = 0; i <num_PICs; i ++) {

if (PIC_statusti].get_version) {if (PIC_statusti] .get_version) {

got_ver_3 = TRUE;got_ver_3 = TRUE;

got_ver_3_3 = TRUE; >got_ver_3_3 = TRUE; >

else if (PIC_status[i].software_type = 3) {else if (PIC_status [i] .software_type = 3) {

got_verJ3 = TRUE; if (PIC_status[i].software_version — 3) got_ver_3_3 = TRUE;got_verJ3 = TRUE; if (PIC_status [i] .software_version - 3) got_ver_3_3 = TRUE;

}}

>>

if (got_ver_3)if (got_ver_3)

/ C/ Ç

if (got_ver_3_3 andandif (got_ver_3_3 andand

((releaseCodep->option.couplers_mask and 0x02) != 0)) {((releaseCodep-> option.couplers_mask and 0x02)! = 0)) {

PICxmitBuf.command_data = 0x0c007000; /* 32 bps, periodic wake-up >PICxmitBuf.command_data = 0x0c007000; / * 32 bps, periodic wake-up>

else {else {

PICxmitBuf.commanddata = 0x0c007080; /* 32 bps, no wake-up */PICxmitBuf.commanddata = 0x0c007080; / * 32 bps wake-up * /

ιι

tt

}}

elseelse

PICxmitBuf.command__data = 0x02030080; /* 205 bps, no wake-up */PICxmitBuf.command__data = 0x02030080; / * 205 bps, wake up * /

}}

#endif#endif

Vrifdcf IS_ST5 cise if jCPIC_status[current_PIC_index]. software_type = 8) { l* Auto tune module */Vrifdcf IS_ST5 cise if jCPIC_status [current_PIC_index]. software_type = 8) {l * Auto tune module * /

PICxmitBuf.command data = 0x02030000 | (ATM_DISC__TIME « 8) |· (ATMjRC_XMIT_ON» 8) I ATM_NUM_CAP_BITS; /* xmit offset = 2, cplr offset = 3, */PICxmitBuf.command data = 0x02030000 | (ATM_DISC__TIME '8) | · (ATMjRC_XMIT_ON' 8) I ATM_NUM_CAP_BITS; / * xmit offset = 2, cplr offset = 3, * /

/* relay delay = ATM_DISC_T1ME, Xmit mask = ATM_RC_XMIT_ON, *// * relay delay = ATM_DISC_T1ME, Xmit mask = ATM_RC_XMIT_ON, * /

/* number of capacitar relays = ATM_NUM_CAP_BITS *// * number of enable relays = ATM_NUM_CAP_BITS * /

>>

else if (PIC_status[current_PIC_index].software_type = 6) { /* ST5 mux */else if (PIC_status [current_PIC_index] .software_type = 6) {/ * ST5 mux * /

PICxmitBuf.command data = 0x00000000; } ~PICxmitBuf.command data = 0x00000000; } ~

//endif// endif

else if (PIC_status[current_PIC_index].sofitware_type = 7) { /* Load Control Module */else if (PIC_status [current_PIC_index] .sofitware_type = 7) {/ * Load Control Module * /

PICxmitBuf.command data = 0x00000000; >PICxmitBuf.command data = 0x00000000; >

eise { 'eise {'

PIC_status[current_PIC_index].update_parameter = FALSE;PIC_status [current_PIC_index] .update_parameter = FALSE;

/* unknown software type, cancel command *// * unknown software type, cancel command * /

if (PIC_status[current_PIC index].update_parameter) {if (PIC_status [current_PIC index] .update_parameter) {

need_pulse_read = FALSE; PICxmitBufreglJro = PARMREG;need_pulse_read = FALSE; PICxmitBufreglJro = PARMREG;

format_xmit_buffer0; >format_xmit_buffer0; >

}}

else if (PIC_status[current_PIC_index].reset_status) {else if (PIC_status [current_PIC_index] .reset_status) {

need_pulse_read = FALSE;need_pulse_read = FALSE;

PICxmitBuf.command = SYSTEMCONTROL; PICxmitBuf.command_data =PICxmitBuf.command = SYSTEMCONTROL; PICxmitBuf.command_data =

(PIC status [current_PIC_index] .status_reg_value and Oxffbf); PICxmitBuf.command_data = PICxmitBuf.commandjdata « 16; /* Move status bits to M Sb's */(PIC status [current_PIC_index] .status_reg_value and Oxffbf); PICxmitBuf.command_data = PICxmitBuf.commandjdata «16; / * Move status bits to M Sb's * /

PICxmitBuf.reg_ID = STATUS_REG;PICxmitBuf.reg_ID = STATUS_REG;

form atxm itbu fferO; >form atm itbuferfer; >

else if (PIC_status[current__PlC_index].get_status) {else if (PIC_status [current__PlC_index] .get_status) {

need_pulse_read = FALSE; PICxmitBuf.command = READJREGISTER; PICxmitBuf.reg_ID = STATUSJREG;need_pulse_read = FALSE; PICxmitBuf.command = READJREGISTER; PICxmitBuf.reg_ID = STATUSJREG;

format_xmit_buffer0; }format_xmit_buffer0; }

#ifdefIS_MC5# ifdefIS_MC5

if (need_pulse_read andand (PIC_status[current_PIC_index].software_1ype = 4)) {if (need_pulse_read andand (PIC_status [current_PIC_index] .software_1ype = 4)) {

need_pulse_read = FALSE; PICxmitBuf.command = SYSTEMCONTROL; if (++PIC_status[current__PlC_index] .curr_ID_reg >= PULSES_PER_PIC) PlC_stetus[current_PIC_index].curr_ID_reg = 0;need_pulse_read = FALSE; PICxmitBuf.command = SYSTEMCONTROL; if (++ PIC_status [current__PlC_index] .curr_ID_reg> = PULSES_PER_PIC) PlC_stetus [current_PIC_index] .curr_ID_reg = 0;

If C (((PIC_status[current_PIC_index].PIC_addr * PULSES_PER_PIC) +If C (((PIC_status [current_PIC_index] .PIC_addr * PULSES_PER_PIC) +

PICj_status[current_PIC_index].curr_ID_reg) % 24) >= num_pulse_ctrs) PrC_status[current_PIC_indsxj.curr_ID_reg = 0;PICj_status [current_PIC_index] .curr_ID_reg)% 24)> = num_pulse_ctrs) PrC_status [current_PIC_indsxj.curr_ID_reg = 0;

PICxmitBuf.reglD = PIC_status[current_PIC_index].cnrr_ID_reg·, work_puIse_index = (PIÇ_status[current_PIC_index].PIC_addr * PULSESPERPIC) + PICxmitBuf.regJGD;PICxmitBuf.reglD = PIC_status [current_PIC_index] .cnrr_ID_reg ·, work_puIse_index = (PIÇ_status [current_PIC_index] .PIC_addr * PULSESPERPIC) + PICxmitBuf.regJGD;

for Ci=O; i<lDJFIELD_LENGTH; i++) {for Ci = O; i <lDJFIELD_LENGTH; i ++) {

if (pulseData[work_pulse_index].ID_bu£fer[i] = 0) {if (pulseData [work_pulse_index] .ID_bu £ fer [i] = 0) {

j = i-i;j = i-i;

i = IDFIELDLENGTH; >i = IDFIELDLENGTH; >

>>

if0«>) {if0 «>) {

j = 0; }j = 0; }

else if (j > (ID_FEELD_LENGTH-4)) {else if (j> (ID_FEELD_LENGTH-4)) {

j = TO_FIELDJLENGTH-4; }j = TO_FIELDJLENGTH-4; }

PICxmitBuf.command_data = READJENCODER_ED | 0 « 8);; ·PICxmitBuf.command_data = READJENCODER_ED | O (8); ·

format__xmit_bufferO; }format__xmit_bufferO; }

#endif#endif

>>

if (need_pulse_read) {if (need_pulse_read) {

#ifdefIS_MC5# ifdefIS_MC5

if (PIC_status[current_PICJndex] .softwarejype = 7) {if (PIC_status [current_PICJndex] .softwarejype = 7) {

i = PIC_status[current_PIC_index].PIC_addr - LCM_BASE_ADDR; /* geti = PIC_status [current_PIC_index] .PIC_addr - LCM_BASE_ADDR; / * get

LCM #*/LCM # * /

work_bit_mask = (load_shed_state[01 » (9 ♦ i)) and OxOOOOOlff; PICxmitBuf.conimand_data = 0;work_bit_mask = (load_shed_state [01 »(9 ♦ i)) and OxOOOOOlff; PICxmitBuf.conimand_data = 0;

for (i=0;i<9;i++). {for (i = 0; i <9; i ++). {

if ((work_bit_mask and 0x100) != 0) PICxmitBuf.command_data = (PICxmitBuf.command_data « 2) + 1; /* Isb lurns relay on *f elseif ((work_bit_mask and 0x100)! = 0) PICxmitBuf.command_data = (PICxmitBuf.command_data «2) + 1; / * Isb lurns relay on * f else

PICxmitBuf.command_data = (PICxmitBuf.command__data « 2) + 2; /* msb turns relay on */PICxmitBuf.command_data = (PICxmitBuf.command__data «2) + 2; / * msb turns relay on * /

\vork_bit_mask = woric_bit_mask « 1; >\ vork_bit_mask = woric_bit_mask «1; >

PICxmitBuf.command_data |= 0x32000000; /* Set pulse time = 50 mS */ PICxmitBuf.command = WRITEREGISTER; PlCxmitBuf.reg_ID = OUTPUT_REG; format_xmit_buffer();PICxmitBuf.command_data | = 0x32000000; / * Set pulse time = 50 mS * / PICxmitBuf.command = WRITEREGISTER; PlCxmitBuf.reg_ID = OUTPUT_REG; format_xmit_buffer ();

need_pulse_read = FALSE; }need_pulse_read = FALSE; }

elseelse

ȴendifȴ endif

if (PIC_status[current_PIC_index].nujn_pulse_regs == 0) . {if (PIC_status [current_PIC_index] .nujn_pulse_regs == 0). {

#ifhdef ISST5#ifhdef ISST5

PICxmitBuf.command = READREGISTER; . PICxmitBuf.reg_ID = VERSREG; format_xmit_bufferO; need_pulse_read = FALSE;PICxmitBuf.command = READREGISTER; . PICxmitBuf.reg_ID = VERSREG; format_xmit_bufferO; need_pulse_read = FALSE;

#endif#endif

}}

else {else {

/íifdef IS_MC5/ IFIF IS_MC5

if ( (((PIC_status[current_PICJndex].PIC_addr * PULSES_PER_PIC) + PIC_status[current_PIC_index].curr_pulse_reg) % 24) >=if (((((PIC_status [current_PICJndex] .PIC_addr * PULSES_PER_PIC) + PIC_status [current_PIC_index] .curr_pulse_reg)% 24)> =

num_pulse_ctrs)num_pulse_ctrs)

PTC_status[current_PIC_index].curr_puIse_reg = 0;PTC_status [current_PIC_index] .curr_puIse_reg = 0;

tfendiftfendif

if (PIC_statusfcurrent_PIC_index].curr_pulse_reg <= MAX_FAST_READ) PICxm itB uf. command = PIC_status[current_PIC_index].curr_pulse_reg; elseif (PIC_statusfcurrent_PIC_index] .curr_pulse_reg <= MAX_FAST_READ) PICxm itB uf. command = PIC_status [current_PIC_index] .curr_pulse_reg; else

PICxmitBuf.command = READREGISTER;PICxmitBuf.command = READREGISTER;

PICxmitBuf.regJLD = PIC_status[cuiTent_PIC_index].currjpulse_reg; format_xmit_bufFer(); need_pu lseread = FALSE; . if (++PIC_status[current_PIC_index] .curr_pulse_reg >=PICxmitBuf.regJLD = PIC_status [cuiTent_PIC_index] .currjpulse_reg; format_xmit_bufFer (); need_pu lseread = FALSE; . if (++ PIC_status [current_PIC_index] .curr_pulse_reg> =

PIC_status[current_PIC_index].num_pulsejregs) {PIC_status [current_PIC_index] .num_pulsejregs) {

PIC_status[current_PIC_index].curr_pulse_reg = 0; tfifdef IS_RSMPIC_status [current_PIC_index] .curr_pulse_reg = 0; tfifdef IS_RSM

PIC_status[current_PIC_index].update__parameter = TRUE;PIC_status [current_PIC_index] .update__parameter = TRUE;

UendifUendif

}}

}}

}}

PIC_status[current_PIC_index].last_cmd_data:=PICxinitBuf.comniand_data; PIC_status[current_PIC_index].last_command = PICxmitBuf.command;PIC_status [current_PIC_index] .last_cmd_data: = PICxinitBuf.comniand_data; PIC_status [current_PIC_index] .last_command = PICxmitBuf.command;

PIC_wait_limit = PTC_status[current_PIC_index].reply_wait_Iimit;PIC_wait_limit = PTC_status [current_PIC_index] .reply_wait_Iimit;

rcvJPICjndex = current_PIC_index;rcvJPICjndex = current_PIC_index;

if(++current_PIC_index == numJPICs) ciHTent_PIC_index = 0;if (++ current_PIC_index == numJPICs) ciHTent_PIC_index = 0;

if (!need_pulse_read) PIC_seriM_lstatus. = do^send^cmd; /* Start UART */ <table>table see original document page 65</column></row><table> \vork_status_bits = work status bits » 1;if (! need_pulse_read) PIC_seriM_lstatus. = do ^ send ^ cmd; / * Start UART * / <table> table see original document page 65 </column> </row> <table> \ vork_status_bits = work status bits »1;

work_pulse_index++; >work_pulse_index ++; >

} · . ■ if (((PIC_status[rcv_PIC_index].status_reg_value and 0x20) != 0) andand} ·. ■ if (((PIC_status [rcv_PIC_index] .status_reg_value and 0x20)! = 0) andand

! PIC_status[rcv_PIC_index] .clear_pul se_regs) { ·'! PIC_status [rcv_PIC_index] .clear_pul se_regs) {· '

P]C_status[rcv_PIC_index].comm_error_count++; /* PIC detected comm parityP] C_status [rcv_PIC_index] .comm_error_count ++; / * PIC detected with parity

if (PIC_status[rcv_PTC_index].comm_error_count > 2) {if (PIC_status [rcv_PTC_index] .comm_error_count> 2) {

set_PIC_aIarm(PIC_comerr_0,PIC_status[rcv_PIC_index].PIC_addr, PICrcvBuf.flags | 0x0800);set_PIC_aIarm (PIC_comerr_0, PIC_status [rcv_PIC_index] .PIC_addr, PICrcvBuf.flags | 0x0800);

}}

}}

if ((PIC_statns[rcv_PIC_index].status_reg_value and 0x3080) != 0) {if ((PIC_statns [rcv_PIC_index] .status_reg_value and 0x3080)! = 0) {

PlC_status[rcv_PIC_indexJ.PIC_reset_count++; /'* PIC was reset */PlC_status [rcv_PIC_indexJ.PIC_reset_count ++; / '* PIC was reset * /

if (PIC_status[rcv_PIC_index] .PIC_reset_count >1) Cif (PIC_status [rcv_PIC_index] .PIC_reset_count> 1) C

{{

set_PIC_aIarm(PlC_reset_0,PIC_status[rcv_PIC_index].PIC_addr, PIC_status[rcv_PIC_index].status_reg_vaiue);set_PIC_aIarm (PlC_reset_0, PIC_status [rcv_PIC_index] .PIC_addr, PIC_status [rcv_PIC_index] .status_reg_vaiue);

>>

}}

if (PIC_status[rcv_PIC_index].clear_pulse_regs andandif (PIC_status [rcv_PIC_index] .clear_pulse_regs andand

(clear_state == GLOBAL_CLR_SENT) ) { ·(clear_state == GLOBAL_CLR_SENT)) {·

PIC_sta.tus[rcv_PIC_index].cIear_pulse_regs = FALSE; if ( ((PIC_status[rcv_PIC_index].status_reg_value and OxOf) != OxOf) andand (PIC_status[rcv_PIC_index].sofhvare_type = 3) )PIC_sta.tus [rcv_PIC_index] .cIear_pulse_regs = FALSE; if (((PIC_status [rcv_PIC_index] .status_reg_value and OxOf)! = OxOf) andand (PIC_status [rcv_PIC_index] .sofhvare_type = 3))

{{

PIC_status[rcv_PIC_index].PIC_data_err_countH-t-; /* CIear cmd failed */ set_PIC_alarm(PIC_flags_0,PIC_status[rcv_PIC_index].PIC_addr,PIC_status [rcv_PIC_index] .PIC_data_err_countH-t-; / * CIear cmd failed * / set_PIC_alarm (PIC_flags_0, PIC_status [rcv_PIC_index] .PIC_addr,

PIC_status[rcv_PIC_index].status_regL_value); > · ·PIC_status [rcv_PIC_index] .status_regL_value); > · ·

>>

else if ( ((PIC_status[rcv_PICJmdex].status_reg^jvalue and 0x0f) != 0) andand ((PIC_status[rcv_PIC_index].status_reg_vaIue and Oxfl0) = 0) )else if (((PIC_status [rcv_PICJmdex] .status_reg ^ jvalue and 0x0f)! = 0) andand ((PIC_status [rcv_PIC_index] .status_reg_vaIue and Oxfl0) = 0))

{{

PIC_status[rcv_PICJndex].PIC_data_err_count 100D; /* Spurious clr cmd V set_PIC_alarm(PIC_flags_0,PIC_status[rcv_PIC_index].PIC_addr, PIC_status[rcv_PIC_index].status_reg_value);PIC_status [rcv_PICJndex] .PIC_data_err_count 100D; / * Spurious clr cmd V set_PIC_alarm (PIC_flags_0, PIC_status [rcv_PIC_index] .PIC_addr, PIC_status [rcv_PIC_index] .status_reg_value);

}}

}}

void set_PIC_alarm(alarmcodes pass_alarm_codes, int pass_PIC_addr, unsigned int pass_alarra_data)void set_PIC_alarm (alarmcodes pass_alarm_codes, int pass_PIC_addr, unsigned int pass_alarra_data)

ι »ι »

if (!Comm_background_flags.do_alann) {if (! Comm_background_flags.do_alann) {

PIC_alarm.alarm_codes = pass_alarm_codes + pass_PIC_addr; PIC_alarm.ack = pass_alarm_data;PIC_alarm.alarm_codes = pass_alarm_codes + pass_PIC_addr; PIC_alarm.ack = pass_alarm_data;

Comm_background_flags.do_alann = TRUE; }Comm_background_flags.do_alann = TRUE; }

unsigned char workTpar;unsigned char workTpar;

BOOLEAN decode_rcv_buffer(void) {BOOLEAN decode_rcv_buffer (void) {

int i;int i;

unsigned int worklnt;unsigned int worklnt;

workTpar = Oxl f;workTpar = Oxl f;

if (PICrcvBuf.flags = 0) {if (PICrcvBuf.flags = 0) {

work_PIC_addr = Get5(); if (PíCrcvBuf.flags == 0)work_PIC_addr = Get5 (); if (PíCrcvBuf.flags == 0)

PICrcvBuf.PIC_addr = work_PIC_addr, /* VaIid address received */ PICrcvBuf.command = Get50; if (PICrcvBuf.command > OxOf)PICrcvBuf.PIC_addr = work_PIC_addr, / * VaIid address received * / PICrcvBuf.command = Get50; if (PICrcvBuf.command> OxOf)

PJCrcvBuf.regJD = Get5(); elsePJCrcvBuf.regJD = Get5 (); else

PlCrcvB uf.regJOD = PICrcvBuf.command; PICrcvBuf.command_data = 0; for (i=0; i<6; H-+)PlCrcvB uf.regJOD = PICrcvBuf.command; PICrcvBuf.command_data = 0; for (i = 0; i <6; H- +)

PICrcvBuf.command_data = (PICrcvBuf.command_data « 5) + Get50; worklnt = Get5();PICrcvBuf.command_data = (PICrcvBuf.command_data «5) + Get50; worklnt = Get5 ();

PICrcvBuf.command_data = (PICrcvBuf.command_data « 2) + (worklnt» 3); PTCrcvBuf.flags |= worklnt and 0x07; worklnt = Get50; if (workTpar != 0)PICrcvBuf.command_data = (PICrcvBuf.command_data '2) + (worklnt' 3); PTCrcvBuf.flags | = worklnt and 0x07; worklnt = Get50; if (workTpar! = 0)

PICrcvBuf.flags |= rcv_tpar_error_flag; } .PICrcvBuf.flags | = rcv_tpar_error_flag; }.

/* Look up correct PIC_status index for data in rcv buffer *// * Look up correct PIC_status index for data in rcv buffer * /

for (i=0; ((i<MAX_PICS) andand (PIC_status[i].PIC_addr != PICrcvBuf.PIC_addr»; i++); if (i >= num_PICs)for (i = 0; ((i <MAX_PICS) andand (PIC_status [i] .PIC_addr! = PICrcvBuf.PIC_addr »; i ++); if (i> = num_PICs)

PICrcvBuf.flags |= rcv_bad addr_flag; /* past end of valid PICs, address error */PICrcvBuf.flags | = rcv_bad addr_flag; / * past end of valid PICs, address error * /

if (i =F MAXJPIÇS) rcvJPIC_index = 0; elseif (i = F MAXJPITIONS) rcvJPIC_index = 0; else

rcv_PJC_index = i;rcv_PJC_index = i;

^ifdef VATEST^ ifdef VATEST

#if VATEST==I#if VATEST == I

PICrcvBuf.command = temp_command; PICrcvBuf.reg_JD = temp_reg_ID; PICrcvBuf.command_data = íemp^commanddata; PICrcvBuf.flags = temp_flags;PICrcvBuf.command = temp_command; PICrcvBuf.reg_JD = temp_reg_ID; PICrcvBuf.command_data = time ^ commanddata; PICrcvBuf.flags = temp_flags;

#endif #endif return((PJCrcvBuf.flags and#endif #endif return ((PJCrcvBuf.flags and

~(PIC_error_flag | PIC_need_refresh_flag j PICJnva I id_data_flag» = O);~ (PIC_error_flag | PIC_need_refresh_flag j PICJnva I id_data_flag '= O);

}}

void format_xinit_buffer(void) tvoid format_xinit_buffer (void) t

\\

int ij,ShiftCount;int ij, ShiftCount;

unsigned int Worklnt; unsigncd Iong WorkData;unsigned int Worklnt; unsigncd Iong WorkData;

PICxmitBuf.bitCoünt = Ó;' PICxmitBuf.bits.bufLong[0] ^= O; PlCxmitBu£bits.bufLong[l] - O; ,PICxmitBuf.bitCoünt = Ó; ' PICxmitBuf.bits.bufLong [0] ^ = O; PlCxmitBu £ bits.bufLong [l] - O; ,

PICxmitBuf.bits.bufLong[2] = O; /* Clear xmit bit buffer */PICxmitBuf.bits.bufLong [2] = O; / * Clear xmit bit buffer * /

workTpar = Oxlf; /* Initializa Tpar */workTpar = Oxlf; / * Initializes Tpar * /

StufT6(PICxmitBuf.PIC_addr); Stuff6(PICxmitBuf.comroand);StufT6 (PICxmitBuf.PIC_addr); Stuff6 (PICxmitBuf.comroand);

if (PTCxmitBuf.command > OxOf) {if (PTCxmitBuf.command> OxOf) {

StuffôÇPICxm i tBuf.reg_ED>;StuffôÇPICxm i tBuf.reg_ED>;

if (PiCxmitBuf.command >, 0x17) {if (PiCxmitBuf.command>, 0x17) {

WorkData ~ PICxm itB uf.comm and_data; ShiftCount = 32;WorkData ~ PICxm itB uf.comm and_data; ShiftCount = 32;

for (i - 0,i<7;B-+) {for (i - 0, i <7; B- +) {

WorkIht = O;WorkIht = O;

-for Q=0y<5y-H-) {-for Q = 0y <5y-H-) {

WorkInt = WorkInt« 1; if (WorkData and 0x80000000)WorkInt = WorkInt «1; if (WorkData and 0x80000000)

Worklnt+=.1;Worknt + = .1;

WorkData = WorkData « 1;WorkData = WorkData «1;

if (--ShifiCount = 0) {if (--ShifiCount = 0) {

Worklnt = (Woriclnt« 3) + (PÍCxmitBuf.flags and 0x07);Worklnt = (Woriclnt? 3) + (PICmitmitBuf.flags and 0x07);

- j = S;.. • }·- j = S; .. •} ·

• ·>. * ·• ·>. * ·

"StufT6(Worklnt); • }"StufT6 (Worklnt); •}

·}. -·}. -

>>

iStuff6(workTpar); .iStuff6 (workTpar); .

·., . /* Buffer set, set up UART control */·.,. / * Buffer set, UART control set up * /

PlCrcv BiiEbitCouiit = 66;PlCrcv BiiEbitCouiit = 66;

if ((PIC_comm_mon.control_flags and XMIT_DATA_RDY) = 0) {if ((PIC_comm_mon.control_flags and XMIT_DATA_RDY) = 0) {

PfCcornm_mon.xmit_buf = PICxmitBuf;PfCcornm_mon.xmit_buf = PICxmitBuf;

PIC"corom_mon.control_flags |= XMIT_DATA_RDY; > PICrcvBuf.flags = 0;PIC "corom_mon.control_flags | = XMIT_DATA_RDY;> PICrcvBuf.flags = 0;

PICrcvBufJ>IC_addr = PICxmitB uf.PIC_addr; /* preset address of remote PIC */PICrcvBufJ> IC_addr = PICxmitB uPIC_addr; / * preset address of remote PIC * /

}}

unsigned int Get5(void) {unsigned int Get5 (void) {

int byte_index, bitjndex;int byte_index, bitjndex;

unsigned int work_result;unsigned int work_result;

workresult = 0; if ((PICrcvBuf.flags andworkresult = 0; if ((PICrcvBuf.flags and

~<PIC_error_flag | PIC need refresh flag | PIC_inval!d_data_flag)) = 0) {~ <PIC_error_flag | PIC need refresh flag | PIC_inval! D_data_flag)) = 0) {

byte_index = 96 - PICrcvBuf.bitCount; bit_index = byte_index and 0x07; byte_index = byte_index » 3;byte_index = 96 - PICrcvBuf.bitCount; bit_index = byte_index and 0x07; byte_index = byte_index »3;

work_result = (PICrcvBuf.bits.bufByte[byte_index] « 8) + PICrcvBuf.bits.bufByte[byte_index+l];work_result = (PICrcvBuf.bits.bufByte [byte_index] '8) + PICrcvBuf.bits.bufByte [byte_index + 1];

work_result = work_result» (10 - bit_index); work_result and= 0x3 f,work_result = work_result »(10 - bit_index); work_result and = 0x3 f,

if (parity6[work_result» 1] != workresult) {if (parity6 [work_result »1]! = workresult) {

work_result = 0;work_result = 0;

PICrcvBuf.flags |= rcv_parity_err_flag; >PICrcvBuf.flags | = rcv_parity_err_flag; >

else {else {

work_result = work_result» 1; workTpar Λ= work_result; PICrcvBuf.bitCount -= 6; if (PICrcvBuf.bitCount < 0)work_result = work_result »1; workTpar Λ = work_result; PICrcvBuf.bitCount - = 6; if (PICrcvBuf.bitCount <0)

PICrcvBuf.flags |= rcv_bad_length_flag;PICrcvBuf.flags | = rcv_bad_length_flag;

}}

}}

return(work_resu!t);return (work_resu! t);

>>

void Stuff6(int pass_data) {void Stuff6 (int pass_data) {

int bytejndex, bit_index;int bytejndex, bit_index;

workTpar pass_data;workTpar pass_data;

byte_index = PICxmitBuf.bitCount» 3;byte_index = PICxmitBuf.bitCount »3;

bit index = PICxmitBuf.bitCount and 0x07;bit index = PICxmitBuf.bitCount and 0x07;

pass_data = parity6[pass_data] « (10 - bit_index);pass_data = parity6 [pass_data] «(10 - bit_index);

PICxmitBuf.bits.bufByte[byte_mdex] j= pass_data» 8;PICxmitBuf.bits.bufByte [byte_mdex] j = pass_data »8;

PICxmitBuf.bits.bufByte[byte_index+l] ]= pass_data and Oxff;PICxmitBuf.bits.bufByte [byte_index + l]] = pass_data and Oxff;

PICxmitBuf.bitCount += 6;PICxmitBuf.bitCount + = 6;

> PULSE.H> PULSE.H

/* *// * * /

#ifndef BOOLEANJDEFINED #define BOOLEAN_DEFINED typedef int B OOLEAN; #endif#ifndef BOOLEANJDEFINED #define BOOLEAN_DEFINED typedef int B OOLEAN; #endif

/* subsecond processing for pulse counters */ void pulseSubsecond(void);/ * subsecond processing for pulse counters * / void pulseSubsecond (void);

/* Daily PIC table rebuild */ void pulseDay(void);/ * Daily PIC table rebuild * / void pulseDay (void);

/* Main PIC communication routine *f void pu!seService(void);/ * Main PIC communication routine * void pu! SeService (void);

/* PIC comm routine - once-per-second code */ void pulseSecond(void);/ * PIC comm routine - once-per-second code * / void pulseSecond (void);

/* Subroutines for PIC communication *! void Stuff6(int pass data); void format_xmit_buffer(void); BOOLEAN decode_rcv_buffer(void); void process_status_bits(void); unsigned int Get5(void);/ * Subroutines for PIC communication *! void Stuff6 (int pass data); void format_xmit_buffer (void); BOOLEAN decode_rcv_buffer (void); void process_status_bits (void); unsigned int Get5 (void);

void set_PIC_aIarm(alarmcodes pass_alarm_type, int pass_PIC_addr, unsigned int pass_alarm_data);void set_PIC_aIarm (alarmcodes pass_alarm_type, int pass_PIC_addr, unsigned int pass_alarm_data);

/* Startup code for PIC communication */ void pulseStartup (void);/ * Startup code for PIC communication * / void pulseStartup (void);

/* Routine to c]ear pulse registers after cold start */ void pulseColdstart(void);/ * Routine to c] ear pulse registers after cold start * / void pulseColdstart (void);

i* defíned in pt.c */ #define RJELAYA O #define RELAY_B 1i * defined in pt.c * / #define RJELAYA The #define RELAY_B 1

void pulseOut(int picNbr,int relayNbr,int ONoff); void ptEvetyMinute(void); void ptEverySecond(void);void pulseOut (int picNbr, int relayNbr, int ONoff); void ptEvetyMinute (void); void enEverySecond (void);

void set_PLC_relays(int xmitRelay,int rcvRelay); PICEND JDEFvoid set_PLC_relays (int xmitRelay, int rcvRelay); PICEND JDEF

/*/ *

include file at end of mtrsamp to control MC and ST pie chips from mtrsamp interrupt */include file at end of mtrsamp to control MC and ST pie chips from mtrsamp interrupt * /

#ifdef IS_MC5#ifdef IS_MC5

if (puiseOutMode=PIC_MC_SERIAL) {if (puiseOutMode = PIC_MC_SERIAL) {

asm (" MOVE.L #Ox80400E,AO");asm ("MOVE.L # Ox80400E, AO");

asm (" AND.W #0xFCFF,(A0)"); /* Clear clock and data ports */ }asm ("AND.W # 0xFCFF, (A0)"); / * Clear clock and data ports * /}

#endif#endif

#ifdefIS_ST5# ifdefIS_ST5

asm(" MOVE.L #Ox80400E,AO">;asm ("MOVE.L # Ox80400E, AO">;

asm (" AND.W #0xFEFF,(A0)"); /* Insert clock falling edge Vasm ("AND.W # 0xFEFF, (A0)"); / * Insert clock falling edge V

if (PIC_seriaI_status — sending st5 bits) {if (PIC_seriaI_status - sending st5 bits) {

asm (" NOP"); asm (" NOP"); asm (" NOP")·, asm (" NOP"); asm (" NOP"); asm (" NOP"); asm (" NOP"); asm (" NOP"); asm (" NOP"); asm (" NOP"); asm (" NOP"); asm (" NOP"); asm (" NOP");asm ("NOP"); asm ("NOP"); asm ("NOP") ·, asm ("NOP"); asm ("NOP"); asm ("NOP"); asm ("NOP"); asm ("NOP"); asm ("NOP"); asm ("NOP"); asm ("NOP"); asm ("NOP"); asm ("NOP");

asm (" MOVE.L #0x80400E,A0">;asm ("MOVE.L # 0x80400E, A0">;

asm (" OR.W #0x01 OOj(AO)"); /* Ksending bits, activate clock*/ >asm ("OR.W # 0x01 OJ (AO)"); / * Ksending bits, activate clock * />

#endif#endif

PIC VARS .DEFPIC VARS .DEF

/*/ *

local variables to control MC and ST pie chips from mtrsamp interrupt meter/c/lib/picvars.deflocal variables to control MC and ST pie chips from mtrsamp interrupt meter / c / lib / picvars.def

iinsigned Iong bitOneFlag; PULSELJNK.DEFiinsigned Iong bitOneFlag; PULSELJNK.DEF

/* determine if variables are externai or deflned here */ #undefref/ * determine if variables are external or defined here * / #undefref

#ifdef PSTRU_DEFINED#ifdef PSTRU_DEFINED

#defíne ref# define ref

#else#else

#define ref extern #endif#define ref extern #endif

#if (NUMPH > 6) #deflne IS_MC5 #else#if (NUMPH> 6) #deflne IS_MC5 #else

#ifdefMAX_SCAN_METERS#ifdefMAX_SCAN_METERS

#define IS_ST5#define IS_ST5

#else#else

//define IS_RSM// define IS_RSM

#endif#endif

#endif#endif

í* Values for hdwr -p (pulseOutMode) */í * Values for hdwr -p (pulseOutMode) * /

#define STANDARD_PIC_COMM 0#define STANDARD_PIC_COMM 0

#if 0 /* remove these equates from mtrlink.def */#if 0 / * remove these equates from mtrlink.def * /

#define PICJPULSESERIAL 1#define PICJPULSESIAL 1

#define PIC_MC_SERIAL 2#define PIC_MC_SERIAL 2

#define PIC_ST_SERIAL 3#define PIC_ST_SERIAL 3

#endif /* then uncomment them here */#endif / * then uncomment them here * /

J* tfdefine VATEST 1 */J * tfdefine VATEST 1 * /

#ifdef VATEST#ifdef VATEST

#undef IS_MC5 #undefIS_RSM #undefIS_ST5#undef IS_MC5 #undefIS_RSM # undefIS_ST5

#define IS_RSM#define IS_RSM

#undef NUMPH#undef NUMPH

tfdefine NUMPH 3tfdefine NUMPH 3

#undef MAX_SCAN_METERS#undef MAX_SCAN_METERS

#endif#endif

/* Uncomment for water meters (Oakville Hydro) */ Mefme READJENCODERJD 0x49ff0000 #define READ ENCODER PARM 0x0312500c/ * Uncomment for water meters (Oakville Hydro) * / Mefme READJENCODERJD 0x49ff0000 #define READ ENCODER PARM 0x0312500c

/* Uncomment for gas meters (Sonix) #define READ ENCODER ID 0x49fe0389 ,Vdeflne READ_BNCODER_PARM 0x0300500c #define ID FIELD LENGTH 13/ * Uncomment for gas meters (Sonix) #define READ ENCODER ID 0x49fe0389, Vdeflne READ_BNCODER_PARM 0x0300500c #define ID FIELD LENGTH 13

#defíne PULSES_PER_PIC 4 #ifdef ISMC5# set PULSES_PER_PIC 4 #ifdef ISMC5

#define BITS_PER_SEC 822 tfdefine MAX_PICS 16 #else#define BITS_PER_SEC 822 tfdefine MAX_PICS 16 #else

#ifdefIS_ST5# ifdefIS_ST5

#define BITS_PER_SEC 942#define BITS_PER_SEC 942

#define MAX_PICS 5#define MAX_PICS 5

#else#else

#define BITS_PER_SEC 32 #def!ne MAX_PICS 1 #endif tfendif#define BITS_PER_SEC 32 #def! ne MAX_PICS 1 #endif tfendif

#defíne DIRECT PIC WAIT LIMIT 24#define DIRECT PIC WAIT LIMIT 24

#define BUFFERED PIC WAIT LIMIT 10 * BITS_PER#define BUFFERED PIC WAIT LIMIT 10 * BITS_PER

#define NXJM_STARTJBITS 12#define NXJM_STARTJBITS 12

#ifdefIS_ST5# ifdefIS_ST5

#define REBUILD_DELAY 30000 tfelse#define REBUILD_DELAY 30000 tfelse

#defíne REBUILDJDELAY 1000 tfendif# define REBUILDJDELAY 1000 tfendif

xypcdefxypcdef

struct {struct {

unsigned Iong serial_number; unsigned long last_cmd_data; unsigned char PIC_addr;unsigned Iong serial_number; unsigned long last_cmd_data; unsigned char PIC_addr;

unsigned char software_type;unsigned char software_type;

unsigned char software version;unsigned char software version;

unsigned char loop_rate; unsigned int status_reg_value; unsigned char time since global; unsigned char num_pulse_regs; unsigned char curr_pulse_reg; unsigned char curr ID reg; unsigned char last_command;unsigned char loop_rate; unsigned int status_reg_value; unsigned char time since global; unsigned char num_pulse_regs; unsigned char curr_pulse_reg; unsigned char curr ID reg; unsigned char last_command;

unsigned int reply_wait_limit; unsigned int PIC_data__err_count; unsigned int PIC_reset_count; unsigned int comm_error_count; unsigned force_pulse_read: 1;unsigned int reply_wait_limit; unsigned int PIC_data__err_count; unsigned int PIC_reset_count; unsigned int comm_error_count; unsigned force_pulse_read: 1;

unsigned get_serno : 1;unsigned get_serno: 1;

unsigned get_version : 1; unsigned get_status : 1;unsigned get_version: 1; unsigned get_status: 1;

unsigned resetjstatus : 1; unsigned update_parameter: 1unsigned resetjstatus: 1; unsigned update_parameter: 1

unsigned clear_pulse_regs: 1;unsigned clear_pulse_regs: 1;

}}

PICstatust;PICstatust;

typedeftypedef

enum { sending bits, sendingL.st5_bits,enum {sending bits, sendingL.st5_bits,

rcvingbits,rcvingbits,

doPICstart,doPICstart,

sendingJPICjstart,sendingJPICjstart,

do_send_cmd,do_send_cmd,

sending_start,sending_start,

sending_start_l,sending_start_l,

sending_stop,sending_stop,

waiting_for_start,waiting_for_start,

rcving^stop,rcving ^ stop,

idlc >idlc>

PIC_s_stat_t;PIC_s_stat_t;

typedeftypedef

enum { SET_PRE_ALIGN, DO_ALIGN, SETNORMALPLC, DISCONNECT_COUPLER,enum {SET_PRE_ALIGN, DO_ALIGN, SETNORMALPLC, DISCONNECT_COUPLER,

READ_XMIT_LEVEL >READ_XMIT_LEVEL>

ATM_op_t;ATM_op_t;

typedeftypedef

enum { DOJPRESET, DO_PLC_SET, SET_ALIGN, WAIT_ALIGN, DO_ATM_DISCONNECT,enum {DOJPRESET, DO_PLC_SET, SET_ALIGN, WAIT_ALIGN, DO_ATM_DISCONNECT,

ATMJDONE >ATMJDONE>

ATM_state_t;ATM_state_t;

typedef struct{typedef struct {

unsigned char unsigned char unsigned char unsigned Iongunsigned char unsigned char unsigned char

PIC_addr, command;PIC_addr, command;

regJDD;regJDD;

command_data; unsigned int bitCount;command_data; unsigned int bitCount;

flags;flags;

int union {int union {

unsigned Iong bufLong[3]; unsigned char bufByte[12]; > bits;unsigned Iong bufLong [3]; unsigned char bufByte [12]; > bits;

}}

PICbitBuf;PICbitBuf;

#ifhdef BOOLEAN_DEFINED #defíne BOOLEAN_DEFINED typedefint BOOLEAN ; #endif#ifhdef BOOLEAN_DEFINED # set BOOLEAN_DEFINED typedefint BOOLEAN; #endif

/* Definition of bits in Flags field of PIC comm buffers *// * Definition of bits in Flags field of PIC with buffers * /

/* NOTE- Top 4 bits (OxfDOO) reserved for use by ATM code *// * NOTE- Top 4 bits (OxfDOO) reserved for use by ATM code * /

#define rcv_bad_addr_flag OxO 1OO #define rcv_tpar_error_flag 0x0080 #define rcv_data_ready_flag 0x0040 #define rcv_bad_length_flag 0x0020 ^define rcv_timeout_flag 0x0010 #define rcv_parity_err_flag 0x0008 #define PlC_error_flag 0x0004 #define PIC_need_refresh_flag 0x0002 #defme PIC_invaIid_data_flag 0x0001#define rcv_bad_addr_flag OxO 1OO #define #define rcv_data_ready_flag rcv_tpar_error_flag 0x0080 0x0040 0x0020 #define rcv_bad_length_flag ^ 0x0010 defines rcv_timeout_flag #define rcv_parity_err_flag 0x0008 0x0004 #define #define PlC_error_flag PIC_need_refresh_flag 0x0002 0x0001 #defme PIC_invaIid_data_flag

/* Command codes for PIC communication *// * Command codes for PIC communication * /

#define MAX_FAST_READ 0x07#define MAX_FAST_READ 0x07

^define CLEAR_PULSE_REGISTERS 0x08 ^define READREGISTER 0x10^ define CLEAR_PULSE_REGISTERS 0x08 ^ define READREGISTER 0x10

#defme WRITE_REGISTER 0x18#defme WRITE_REGISTER 0x18

#define SYSTEMjCONTROL 0x19#define SYSTEMjCONTROL 0x19

/* Register ID codes for PIC communication *// * Register ID codes for PIC communication * /

#define MAX_PULSE_REG 15#define MAX_PULSE_REG 15

#define CONTROL_REG 16 tfdefine ERRORREG 26 tfdefine OUTPUT_REG 27 #define PARMREG 28#define CONTROL_REG 16 tfdefine ERRORREG 26 tfdefine OUTPUT_REG 27 #define PARMREG 28

#defme VERS_REG 29#defme VERS_REG 29

#define SERNO REG 30#define SERNO REG 30

#define STATUSJREG 31#define STATUSJREG 31

/* Special-purpose PIC addresses *// * Special-purpose PIC addresses * /

#define GLOBALJPICADDR 31 #define MC5_MUX_PIC_ADDR 30 #defõne ST5_MUX_PIC_ADDR 29#define GLOBALJPICADDR 31 #define MC5_MUX_PIC_ADDR 30 #define ST5_MUX_PIC_ADDR 29

#defrae LCMJB ASE_ADDR 16 /* First LCM is at address 16 *f #define ATMJB ASE_ADDR 201* First ATM is at address 20 */ #define MAX_PULSE_PIC_ADDR 15 /* pulse couters are from Oto 15 */#defrae LCMJB ASE_ADDR 16 / * First LCM is at address 16 * f #define ATMJB ASE_ADDR 201 * First ATM is at address 20 * / #define MAX_PULSE_PIC_ADDR 15 / * pulse couters are from Oto 15 * /

/* Bit usage in the ATM relay control word */ #defme ATM_RC_XMIT_ON 0x00008000 #define ATM_RC_MEAS_XMIT 0x00004000 #define ATM_RC_MEAS_CPLR 0x00002000 #define ÀTM_RC_RES_SHORTED 0x00001000/ * Bit usage in the ATM relay control word * / #defme ATM_RC_XMIT_ON 0x00008000 #define ATM_RC_MEAS_XMIT 0x00004000 #define ATM_RC_MEAS_CPLR 0x00002000 #define ÀTM_RC_RES_SHORTED 0x00001000

#defme ATM_RC_CAP_MASK 0x000003ff #define ATM_NUM_CAP_BITS 10#defme ATM_RC_CAP_MASK 0x000003ff #define ATM_NUM_CAP_BITS 10

#defme ATM PRESET CODE ATM_RC_XMIT_ON | ATM_RC_MEAS_XMIT | ATM_RC_MEAS_CPLR#defme ATM PRESET CODE ATM_RC_XMIT_ON | ATM_RC_MEAS_XMIT | ATM_RC_MEAS_CPLR

tfdefine ATM_PLC_CODE ATM RC XMIT ON | ATM_RC_RES_SHORTED #define ATM_DISC_CODE 0tfdefine ATM_PLC_CODE ATM RC XMIT ON | ATM_RC_RES_SHORTED #define ATM_DISC_CODE 0

/* Other ATM control equates *// * Other ATM control equates * /

#define ATM_MEAS_TIME 20L /* mSec to wait between cap change and ADC reading */#define ATM_MEAS_TIME 20L / * mSec to wait between cap change and ADC reading * /

#defme ATM_DISC_TIME 20L /* mSec to wait before switching cap relays */ #defme ATM_MIN_READING 0x0038 /* If reading at end of autotune Iess than this, fail */#defme ATM_DISC_TIME 20L / * mSec to wait before switching cap relays * / #defme ATM_MIN_READING 0x0038 / * If reading at end of autotune Iess than this, fail * /

/* Equates for ST5 comm */ #define ST5_P1C_DELAY 66 ^pragma region ("ram=ram")/ * Equates for ST5 comm * / #define ST5_P1C_DELAY 66 ^ pragma region ("ram = ram")

ref unsigned short current_PlC_index, rcv_PIC_index;ref unsigned short current_PlC_index, rcv_PIC_index;

ref PIC_status_t PIC_status[MAX_PICS];ref PIC_status_t PIC_status [MAX_PICS];

struct {struct {

unsigned Iong reading; int error_cnt;unsigned Iong reading; int error_cnt;

unsigned char ID_field[ID_FIELD_LENGTH]; unsigned char ED_bufFer[ID_FlELD_LENGTH]; } ref PulseDatapiltNUMPH];unsigned char ID_field [ID_FIELD_LENGTH]; unsigned char ED_bufFer [ID_FlELD_LENGTH]; } ref PulseDatapiltNUMPH];

struct {struct {

PICbitBuf xmitbuf; PICbitBuf rcvbuf; int control_flags;PICbitBuf xmitbuf; PICbitBuf rcvbuf; int control_flags;

} ref ext comm, PIC_comm_mon;} ref ext comm, PIC_comm_mon;

struct {struct {

ATMopt operation; unsigned int ATM_number; ATM_state_t state; unsigned request_flag: l; unsigned done_flag: 1; unsigned error_flag: 1; unsigned active_flag: 1; unsigned int start_cap_code; unsigned int end_cap_code; unsigned int optimum_cap_code; unsigned int optimum_read ing;ATMopt operation; unsigned int ATM_number; ATM_state_t state; unsigned request_flag: l; unsigned done_flag: 1; unsigned error_flag: 1; unsigned active_flag: 1; unsigned int start_cap_code; unsigned int end_cap_code; unsigned int optimum_cap_code; unsigned int optimum_read ing;

unsigned int xmit_Ievel;unsigned int xmit_Ievel;

unsigned int coupler_level;unsigned int coupler_level;

unsigned int result_flags;unsigned int result_flags;

Iong int align_timer;Iong int align_timer;

} ref ATM control;} ref ATM control;

struct {struct {

unsigned request_flag : 1; unsigned donejflag: 1; unsigned error_flag: 1; unsigned active_flag: 1; unsigned int xmit_mask; unsigned int rcv_mask; unsigned int result_flags; unsigned int last_xmit_mask; unsigned int last rcv mask;unsigned request_flag: 1; unsigned donejflag: 1; unsigned error_flag: 1; unsigned active_flag: 1; unsigned int xmit_mask; unsigned int rcv_mask; unsigned int result_flags; unsigned int last_xmit_mask; unsigned int last rcv mask;

} ref MUX_control;} ref MUX_control;

struct {struct {

unsigned do_rebuiId: 1; unsigned do_alarm : 1;unsigned do_rebuiId: 1; unsigned do_alarm: 1;

} ref Comm_background_flags;} ref Comm_background_flags;

/* Bit definitions in exl_buf.control_flags */ #defíne SUPPRESS_NORMAL_COMM OxOOOl/ * Bit definitions in exl_buf.control_flags * / # define SUPPRESS_NORMAL_COMM OxOOOl

ffdefíne XMIT_REQUEST 0x0002 Λ Externai routine requests send of xmit_buf */ffdefin XMIT_REQUEST 0x0002 Λ External routine requests send of xmit_buf * /

#defíne CPY_RCV_DATA 0x0004 /* Externai cmd was sent, copy rcvd buffer to# set CPY_RCV_DATA 0x0004 / * External cmd was sent, copy rcvd buffer to

rcv_buf */rcv_buf * /

#define RCV_DATA_RDY 0x0008 /* Got reply from externai cmd, reply is in#define RCV_DATA_RDY 0x0008 / * Got reply from external cmd, reply is in

rcv_buf */rcv_buf * /

#defíne XMTT DATA RDY 0x0010 /* xmit buf has copy of Iast cmd sent */# set XMTT DATA RDY 0x0010 / * xmit buf has copy of Iast cmd sent * /

ref PICbitBuf PICxmitBuf, PICrcvBuf, HoldrcvBuf;ref PICbitBuf PICxmitBuf, PICrcvBuf, HoldrcvBuf;

ref PIC_s_stat_t PIC_serial_status;ref PIC_s_stat_t PIC_serial_status;

ref unsigned int num_PICs;ref unsigned int num_PICs;

ref unsigned int num_LCMs;ref unsigned int num_LCMs;

ref unsigned int rebuild_timer;ref unsigned int rebuild_timer;

ref unsigned int ATM_work;ref unsigned int ATM_work;

ref unsigned int work_PIC_addr;ref unsigned int work_PIC_addr;

ref unsigned int num_pulse_ctrs;ref unsigned int num_pulse_ctrs;

ref unsigned int hoId_numjpulse_ctrs;ref unsigned int hoId_numjpulse_ctrs;

ref unsigned int bit_count;ref unsigned int bit_count;

ref unsigned int out_bit_value;ref unsigned int out_bit_value;

ref unsigned char *shift_LSB_ptnref unsigned char * shift_LSB_ptn

ref unsigned char ín_bit_value;ref unsigned char ín_bit_value;

ref unsigned int PIC_wait_Iimit;ref unsigned int PIC_wait_Iimit;

ef unsigned int zerojcount;ef unsigned int zerojcount;

ref unsigned int last_comm_err_flag;ref unsigned int last_comm_err_flag;

ref BOOLEAN dont_clear_PIC_stats;ref BOOLEAN dont_clear_PIC_stats;

ref int ST5_PIÇ_delay_ctr,ref int ST5_PIÇ_delay_ctr,

ref unsigned int PICJbad addr count;ref unsigned int PICJbad addr count;

ref alarmstru PIC_alarm;ref alarmstru PIC_alarm;

#ifdef VATEST /* testüü */#ifdef VATEST / * testüü * /

ref int tef int refIong ref intref int tef int refIong ref int

temp_command; tempjregJOD;temp_command; tempjregJOD;

temp_command_data; temp_flags;temp_command_data; temp_flags;

/♦testüü */ tfendif/ ♦ testüü * / tfendif

ref enum {ref enum {

clkjhigh, clk_lowclkjhigh, clk_low

> PIC_clk_state;> PIC_clk_state;

ref enum {ref enum {

NOGLOBALSEND, SEND_GLOBAL_CLR, SENDING_GLOBAL_CLR, GLOBAL_CLR_SENT } clearjstate;NOGLOBALSEND, SEND_GLOBAL_CLR, SENDING_GLOBAL_CLR, GLOBAL_CLR_SENT} clearjstate;

/* Old equates maintained for compatibílity */ #if O/ * Old equates maintained for compatibility * / #if O

#define RELAY_A_BIT 1 #define RELAYJB_BIT 2 #def!ne DDLE O tfdefine TX 1 #defíne RX 2 #define DATA READY 3 #define WAKE 4 ^define PIC_RESET 5#define RELAY_A_BIT 1 #define RELAYJB_BIT 2 #def! ne DDLE tfdefine TX 1 # define RX 2 #define DATA READY 3 #define WAKE 4 ^ define PIC_RESET 5

#define WAKE_COUNT_RELOAD (64*4) /* Four Seconds */#define WAKE_COUNT_RELOAD (64 * 4) / * Four Seconds * /

#define RESET_COUNT_RELOAD 10 /* 1/4 Seconds */#define RESET_COUNT_RELOAD 10 / * 1/4 Seconds * /

#define RELAY_A_OFF_CMD 5 /*active Iow trigger*/#define RELAY_A_OFF_CMD 5 / * active Iow trigger * /

tfdefine RELAY_A_ON_CMD 4tfdefine RELAY_A_ON_CMD 4

#defme RELAY_B_OFF_CMD 7#defme RELAY_B_OFF_CMD 7

#define RELAY_B_ON_CMD 6#define RELAY_B_ON_CMD 6

#define CLEA R_ACC_CMD 8#define CLEA R_ACC_CMD 8

#def!ne SUBACC_CMD 12#def! ne SUBACC_CMD 12

#define ECHO_CMD 14#define ECHO_CMD 14

#defíne SLEEP_CMD 15# set SLEEP_CMD 15

#defme PULSE_SERIAL_COM_MAX 15#defme PULSE_SERIAL_COM_MAX 15

#define WAKE CMD 16#define WAKE CMD 16

#define RESET_CMD 17#define RESET_CMD 17

#defínePULSE_COM_NUM 18#definePULSE_COM_NUM 18

#define NO_PULSEJBIT_DATA OxFFFFFFFF#define NO_PULSEJBIT_DATA OxFFFFFFFF

#define RELAY_CMD_MTN 4#define RELAY_CMD_MTN 4

#define RELAY_CMD_MAX 7#define RELAY_CMD_MAX 7

tfendif PULSEOUTM.DEFtfendif PULSEOUTM.DEF

rfinclude "clklink.def' #include "mtrlink.def'rfinclude "clklink.def '#include" mtrlink.def'

#include "plc.def' #include "serlink.def' #include "pulselink.def"#include "plc.def '#include" serlink.def' #include "pulselink.def"

#ifhdefNO_PULSES#ifhdefNO_PULSES

#include "scan.h" #include "pulse.h" #include "log.h"#include "scan.h" #include "pulse.h" #include "log.h"

void pulseovrt__second_back(void);void pulseovrt__second_back (void);

void pulseout_ram_init1(void);void pulseout_ram_init1 (void);

ADDRFN pulseoutaddrfn ;ADDRFN pulseoutaddrfn;

#pragma region ("data=ramlnitl")#pragma region ("data = ramlnitl")

void (*pulseout_ram_init 1 p)(void)=puIseout_ram_initl;void (* pulseout_ram_init 1 p) (void) = puIseout_ram_initl;

#pragma region ("data=data,,)#pragma region ("data = data ,,)

#pragma region ("data=secondBack")#pragma region ("data = secondBack")

void (*puIseout_second_backp)(void)=pulseout_second_back; #pragma region ("data=data")void (* puIseout_second_backp) (void) = pulseout_second_back; #pragma region ("date = date")

ADDRFNRET pulscoutaddr£h(reg8stru reg8) {ADDRFNRET pulscoutaddr £ h (reg8stru reg8) {

/*iwrite the Ioad shed event to flash */ putEvent(LOAD_SHED_EVENT,l,andreg8.ulong);/ * iwrite the Ioad shed event to flash * / putEvent (LOAD_SHED_EVENT, 1, andreg8.ulong);

retum(O);retum (O);

>>

void pulseout_ram_initl0 {void pulseout_ram_initl0 {

addrfn_tbI[GET_FROM_SLAVE]DPULSEOUT_STATE] = pulseoutaddrfnaddrfn_tbI [GET_FROM_SLAVE] DPULSEOUT_STATE] = pulseoutaddrfn

>>

void pu!seout_second_back()void pu! seout_second_back ()

r <r <

}}

sfendifsfendif

Claims (37)

1. Aparelho para medição de multi-canal de eletricidade, caracterizado pelo fato de que compreende: uma cabeça de medidor que compreende um ou mais pontos medidores, a cabeça de medidor operável para medir uso de eletricidade para uma pluralidade de linhas de consumidor de eletricidade; um transponder em comunicação por comunicação de linha de potência com dita cabeça de medidor e operável para transmitir dados recebidos de dita cabeça de medidor para um computador localizado remotamente, e para transmitir à cabeça de medidor, por comunicação de linha de potência, dados recebidos do dito computador localizado remotamente; e um ou mais módulos de controle de carga em comunicação com dita cabeça de medidor e operáveis para atuar cada um de uma pluralidade de relês, cada relê de dita pluralidade de relês operável para serviço de conectar e desconectar em uma da pluralidade de linhas de consumidor de eletricidade.1. Multi-channel electricity meter, characterized in that it comprises: a meter head comprising one or more meter points, the meter head operable for measuring electricity usage for a plurality of electricity consumer lines ; a power line communication transponder with said meter head and operable for transmitting data received from said meter head to a remotely located computer, and for transmitting to the meter head, data received from the said remotely located computer; and one or more load control modules in communication with said meter head and operable to actuate each of a plurality of relays, each relay of said plurality of relays operable to connect and disconnect service on one of the plurality of consumer lines. of electricity. 2. Aparelho de acordo com reivindicação 1, caracterizado pelo fato de que compreende ainda um detector de fraude em comunicação com dita cabeça de medidor.Apparatus according to claim 1, characterized in that it further comprises a fraud detector in communication with said meter head. 3. Aparelho de acordo com reivindicação 2, caracterizado pelo fato de que dito detector de fraude inclui uma luz e uma superfície reflexiva, e em que dita cabeça de medidor é operável para instruir dito um ou mais módulos de controle de carga para desconectar todas de ditas linhas de cliente se dito detector de fraude prover notificação que dita luz não é detectada refletindo de dita superfície reflexiva.Apparatus according to claim 2, characterized in that said fraud detector includes a light and a reflective surface, and wherein said meter head is operable to instruct said one or more load control modules to disconnect all of them. said customer lines if said fraud detector provides notification that said light is not detected reflecting said reflective surface. 4. Aparelho de acordo com reivindicação 2, caracterizado pelo fato de que compreende ainda uma caixa contendo dita cabeça de medidor, dito um ou mais módulos de controle de carga, e ditos relês, e em que dito detector de fraude inclui um detector de luz ambiente entrando na caixa.Apparatus according to claim 2, characterized in that it further comprises a housing containing said meter head, said one or more charge control modules, and said relays, and wherein said fraud detector includes a light detector. environment entering the box. 5. Aparelho de acordo com reivindicação 1, caracterizado pelo fato de que compreende ainda um dispositivo para comparar energia de transformador à energia total usada por ditas linhas de consumidor.Apparatus according to claim 1, characterized in that it further comprises a device for comparing transformer energy to the total energy used by said consumer lines. 6. Aparelho de acordo com reivindicação 1, caracterizado pelo fato de que compreende ainda um dispositivo para detectar fluxo de corrente inversa por ditas linhas de consumidor.Apparatus according to claim 1, characterized in that it further comprises a device for detecting reverse current flow by said consumer lines. 7. Aparelho de acordo com reivindicação 1, caracterizado pelo fato de que compreende ainda uma memória legível por computador em comunicação com dita cabeça de medidor e um contador em comunicação com dita cabeça de medidor, dito contador correspondendo a uma linha de cliente e operável para contar regressivamente uma quantidade de energia armazenada em dita memória, e dita cabeça de medidor operável para enviar um sinal de desconexão para um módulo de controle de carga correspondente para desconectar dita linha de cliente quando dito contador alcança zero.Apparatus according to claim 1, characterized in that it further comprises a computer readable memory in communication with said meter head and a counter in communication with said meter head, said counter corresponding to a customer line and operable for count down an amount of energy stored in said memory, and said operable meter head to send a disconnect signal to a corresponding load control module to disconnect said customer line when said counter reaches zero. 8. Aparelho de acordo com reivindicação 1, caracterizado pelo fato de que compreende ainda uma memória legível por computador em comunicação com dita cabeça de medidor, dita memória operável para armazenar um limite de carga para uma linha de cliente, e dita cabeça de medidor operável para enviar um sinal de desconexão para um módulo de controle de carga correspondente para desconectar dita linha de cliente quando dito limite de carga é excedido.Apparatus according to claim 1, characterized in that it further comprises a computer readable memory in communication with said meter head, said operable memory for storing a load limit for a customer line, and said operable meter head. to send a disconnect signal to a corresponding load control module to disconnect said customer line when said load limit is exceeded. 9. Aparelho de acordo com reivindicação 1, caracterizado pelo fato de que compreende ainda uma memória legível por computador em comunicação com dita cabeça de medidor, dita memória operável para armazenar um limite de uso para uma linha de cliente, e dita cabeça de medidor operável para enviar um sinal de desconexão para um módulo de controle de carga correspondente para desconectar dita linha de cliente quando dito limite de uso é excedido.Apparatus according to claim 1, further comprising a computer readable memory in communication with said meter head, said operable memory for storing a usage limit for a customer line, and said operable meter head. to send a disconnect signal to a corresponding load control module to disconnect said customer line when said usage limit is exceeded. 10. Aparelho de acordo com reivindicação 1, caracterizado pelo fato de que dito transponder é operável para se comunicar com dito computador localizado remotamente através de linhas de potência de média tensão.Apparatus according to claim 1, characterized in that said transponder is operable to communicate with said remotely located computer via medium voltage power lines. 11. Aparelho de acordo com reivindicação 1, caracterizado pelo fato de que compreende ainda uma unidade de exibição em comunicação com dita cabeça de medidor e operável para exibir dados recebidos de dita cabeça de medidor.Apparatus according to claim 1, characterized in that it further comprises a display unit in communication with said meter head and operable to display data received from said meter head. 12. Aparelho de acordo com reivindicação 11, caracterizado pelo fato de que dita unidade de exibição é operável para exibir informação relativa a consumo de energia de um cliente.Apparatus according to claim 11, characterized in that said display unit is operable to display information relating to a customer's energy consumption. 13. Aparelho de acordo com reivindicação 11, caracterizado pelo fato de que dita unidade de exibição é operável para exibir advertências relativas a uso de energia de um cliente ou a suspeito roubo de energia.Apparatus according to claim 11, characterized in that said display unit is operable to display warnings concerning a customer's energy use or suspected power theft. 14. Aparelho de acordo com reivindicação 11, caracterizado pelo fato de que dita unidade de exibição é operável para transmitir para dita cabeça de medidor informação entrada por um cliente.Apparatus according to claim 11, characterized in that said display unit is operable to transmit to said meter head information entered by a customer. 15. Aparelho para medição remota de multi-canal de eletricidade usando comunicação de linha de potência, caracterizado pelo fato de que compreende: uma pluralidade de pontos medidores localizados em um lado secundário de um transformador e operáveis para medir separadadamente uso de eletricidade para cada uma de uma pluralidade de linhas de consumidor de eletricidade; o aparelho em comunicação direta com um transponder localizado em um lado primário do transfornmador e operável para transmitir dados para e receber dados do transponder por comunicação de linha de potência direta, o transponder operável para transmitir dados para e para receber dados de um computador localizado remotamente; o aparelho operável para controlar um ou mais módulos de controle de carga operáveis para atuar conexão e desconexão de cada um de uma pluralidade de relês, cada relê da pluralidade de relês correspondendo a uma da pluralidade de linhas de consumidor de eletricidade; e uma caixa contendo a pluralidade de pontos medidores, o módulo de controle de carga, e os relês, em que o transformador de distribuição converte voltagens de distribuição de média tensão em voltagens de baixa tensão apropriadas para fornecer energia aos consumidores, e em que o aparelho é operável para injetar sinais em e receber sinais de linhas de potência de baixa tensão que abastecem consumidores com energia elétrica; ditos sinais provendo comunicação de via dupla entre a cabeça de medidor e o transponder, e atravessando o transformador de distribuição.15. Apparatus for remote multi-channel electricity metering using power line communication, characterized in that it comprises: a plurality of metering points located on a secondary side of a transformer and operable to separately measure electricity usage for each of a plurality of electricity consumer lines; the apparatus in direct communication with a transponder located on a primary side of the transformer and operable to transmit data to and receive data from the transponder by direct power line communication, the transponder operable to transmit data to and to receive data from a remotely located computer. ; apparatus operable to control one or more load control modules operable to connect and disconnect each of a plurality of relays, each relay of the plurality of relays corresponding to one of the plurality of electricity consumer lines; and a box containing the plurality of meter points, the load control module, and the relays, wherein the distribution transformer converts medium voltage distribution voltages to low voltage voltages suitable for supplying power to consumers, and wherein the The device is operable to inject signals into and receive signals from low voltage power lines that supply consumers with electricity; said signals providing two-way communication between the meter head and the transponder, and traversing the distribution transformer. 16. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de que compreende ainda um detector de fraude em comunicação com dita cabeça de medidor.Apparatus according to claim 15, characterized in that it further comprises a fraud detector in communication with said meter head. 17. Aparelho de acordo com reivindicação 16, caracterizado pelo fato de que dito detector de fraude inclui uma luz e uma superfície reflexiva, e em que dita cabeça de medidor é operável para instruir dito módulo de controle de carga para desconectar todas de ditas linhas de cliente se dito detector de fraude prover notificação que dita luz não é detectada refletindo de dita superfície reflexiva.Apparatus according to claim 16, characterized in that said fraud detector includes a light and a reflective surface, and wherein said meter head is operable to instruct said load control module to disconnect all of said lines. If said fraud detector provides notice that said light is not detected reflecting said reflective surface. 18. Aparelho de acordo com reivindicação 16, caracterizado pelo fato do dito detector de fraude incluir um detector de luz ambiente entrando na caixa.Apparatus according to claim 16, characterized in that said fraud detector includes an ambient light detector entering the housing. 19. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de que compreende ainda um dispositivo para comparar energia de transformador à energia total usada por ditas linhas de consumidor.Apparatus according to claim 15, further comprising a device for comparing transformer energy to the total energy used by said consumer lines. 20. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de que compreende ainda um dispositivo para detectar fluxo de tensão inversa por ditas linhas de consumidor.Apparatus according to claim 15, characterized in that it further comprises a device for detecting reverse voltage flow by said consumer lines. 21. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de que compreende ainda uma memória legível por computador em comunicação com dita cabeça de medidor e um contador em comunicação com dita cabeça de medidor, dito contador correspondendo a uma linha de cliente e operável para contar regressivamente uma quantidade de energia armazenada em dita memória, e dita cabeça de medidor operável para enviar um sinal de desconexão ao módulo de controle de carga para desconectar dita linha de cliente quando dito contador alcança zero.Apparatus according to claim 15, characterized in that it further comprises a computer readable memory in communication with said meter head and a counter in communication with said meter head, said counter corresponding to a customer line and operable for count down an amount of energy stored in said memory, and said operable meter head to send a disconnect signal to the load control module to disconnect said customer line when said counter reaches zero. 22. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de que compreende ainda uma memória legível por computador em comunicação com dita cabeça de medidor, dita memória operável para armazenar um limite de carga para uma linha de cliente, e dita cabeça de medidor operável para enviar um sinal de desconexão para o módulo de controle de carga para desconectar dita linha de cliente quando dito limite de carga é excedido.Apparatus according to claim 15, further comprising a computer readable memory in communication with said meter head, said operable memory for storing a load limit for a customer line, and said operable meter head. to send a disconnect signal to the load control module to disconnect said customer line when said load limit is exceeded. 23. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de que compreende ainda uma memória legível por computador em comunicação com dita cabeça de medidor, dita memória operável para armazenar um limite de uso para uma linha de cliente, e dita cabeça de medidor operável para enviar um sinal de desconexão para o módulo de controle de carga para desconectar dita linha de cliente quando dito limite de uso é excedido.Apparatus according to claim 15, characterized in that it further comprises a computer readable memory in communication with said meter head, said operable memory for storing a usage limit for a customer line, and said operable meter head. to send a disconnect signal to the load control module to disconnect said customer line when said usage limit is exceeded. 24. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de que dito transponder é operável para se comunicar com dito computador localizado remotamente através de linhas de potência de média tensão.Apparatus according to claim 15, characterized in that said transponder is operable to communicate with said remotely located computer via medium voltage power lines. 25. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de que compreende ainda uma unidade de exibição em comunicação com dita cabeça de medidor e operável para exibir dados recebidos de dita cabeça de medidor.Apparatus according to claim 15, further comprising a display unit in communication with said meter head and operable for displaying data received from said meter head. 26. Aparelho de acordo com reivindicação 25, caracterizado pelo fato de que dita unidade de exibição é operável para exibir informação relativa a consumo de energia de um cliente.Apparatus according to claim 25, characterized in that said display unit is operable to display information relating to a customer's energy consumption. 27. Aparelho de acordo com reivindicação 25, caracterizado pelo fato de que dita unidade de exibição é operável para exibir advertências relativas a uso de energia de um cliente ou a suspeito roubo de energia.Apparatus according to claim 25, characterized in that said display unit is operable to display warnings concerning a customer's energy use or suspected power theft. 28. Aparelho de acordo com reivindicação 25, caracterizado pelo fato de que dita unidade de exibição é operável para transmitir para dita cabeça de medidor informação entrada por um cliente.Apparatus according to claim 25, characterized in that said display unit is operable to transmit to said meter head information entered by a customer. 29. Aparelho de acordo com reivindicação 15, caracterizado pelo fato do transponder ser operável para se comunicar com o computador localizado remotamente via pelo menos um de: comunicações de rádio, fibra óptica, e linhas telefônicas.Apparatus according to claim 15, characterized in that the transponder is operable to communicate with the remotely located computer via at least one of: radio communications, fiber optics, and telephone lines. 30. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de ser operável para transmitir dados diretamente ao transponder a freqüências dentro da faixa de 10 a 25 kHz.Apparatus according to claim 15, characterized in that it is operable to transmit data directly to the transponder at frequencies within the range of 10 to 25 kHz. 31. Aparelho de acordo com reivindicação 15, caracterizado pelo fato de ser operável para transmitir dados diretamente ao transponder a freqüências correspondendo a harmônicos meio ímpares de 60 Hz.Apparatus according to claim 15, characterized in that it is operable to transmit data directly to the transponder at frequencies corresponding to half odd 60 Hz harmonics. 32. Aparelho para medição de multi-canal de eletricidade, caracterizado pelo fato de que compreende: um módulo de controle em comunicação com um circuito secundário de um transformador de distribuição, em que o transformador de distribuição converte voltagens de distribuição de média tensão em voltagens de baixa tensão apropriadas para fornecer energia aos consumidores; o módulo de controle em comunicação direta com um transponder em comunicação com um circuito primário do transformador e operável para transmitir dados para e receber dados do transponder por comunicação de linha de potência direta, através do transformador de distribuição, o transponder operável para transmitir dados para e para receber dados de um computador localizado remotamente; uma pluralidade de módulos de medição em comunicação com o módulo de controle, cada módulo de medição operável para medir uso de eletricidade em uma de uma pluralidade de linhas de consumidor de eletricidade alimentadas pelo circuito secundário do transformador de distribuição; um ou mais relês em comunicação com o módulo de controle e operáveis para atuar conexão e desconexão de eletricidade às linhas de consumidor de eletricidade; e uma caixa contendo o módulo de controle, os módulos de medição e os relês, em que o aparelho é operável para injetar sinais em e receber sinais de linhas de potência de baixa tensão que abastecem consumidores com energia elétrica; ditos sinais provendo comunicação de via dupla entre a cabeça de medidor e o transponder, e atravessando o transformador de distribuição para se comunicar, pelo menos parcialmente, sobre linhas de potência de média tensão, com o computador localizado remotamente.32. Multi-channel electricity measuring apparatus, characterized in that it comprises: a control module in communication with a secondary circuit of a distribution transformer, wherein the distribution transformer converts medium voltage distribution voltages into voltages. low voltage switches suitable for providing power to consumers; the control module in direct communication with a transponder in communication with a transformer primary circuit and operable to transmit data to and receive data from the transponder by direct power line communication through the distribution transformer, the transponder operable to transmit data to and to receive data from a remotely located computer; a plurality of metering modules in communication with the control module, each metering module operable to measure electricity usage on one of a plurality of electricity consuming lines powered by the secondary circuit of the distribution transformer; one or more relays in communication with the control module and operable to actuate connection and disconnection of electricity to the consumer electricity lines; and a box containing the control module, measuring modules, and relays, in which the apparatus is operable to inject signals into and receive signals from low voltage power lines that supply consumers with electricity; said signals providing two-way communication between the meter head and the transponder, and traversing the distribution transformer to communicate at least partially over medium voltage power lines with the remotely located computer. 33. Aparelho de acordo com reivindicação 32, caracterizado pelo fato do um ou mais relês serem operáveis para controlar cada fase das linhas de consumidor de eletricidade.Apparatus according to claim 32, characterized in that one or more relays are operable to control each phase of the power consumer lines. 34. Aparelho de acordo com reivindicação 32, caracterizado pelo fato do transponder ser operável para transmitir dados para e receber dados de um computador localizado remotamente via um ou mais transponders intermediários.Apparatus according to claim 32, characterized in that the transponder is operable to transmit data to and receive data from a remotely located computer via one or more intermediate transponders. 35. Aparelho para medição remota de multi-canal de eletricidade usando comunicação de linha de potência, caracterizado pelo fato de que compreende: uma pluralidade de pontos medidores localizados em um lado secundário de um transformador e operáveis para medir separadadamente uso de eletricidade para cada uma de uma pluralidade de linhas de consumidor de eletricidade; o aparelho em comunicação com um transponder localizado em um lado primário do transfornmador e operável para transmitir dados para e receber dados do transponder por comunicação de linha de potência, o transponder operável para transmitir dados para e para receber dados de um computador localizado remotamente; um ou mais módulos de controle de carga em comunicação com a cabeça de medidor e operáveis para atuar cada um de uma pluralidade de relês, cada relê da pluralidade de relês operável para serviço de conectar e desconectar em uma da pluralidade de linhas de consumidor de eletricidade; e uma caixa contendo a pluralidade de pontos medidores, o módulo de controle de carga, e os relês, em que o transformador de distribuição converte voltagens de distribuição de média tensão em voltagens de baixa tensão apropriadas para fornecer energia aos consumidores, e em que o aparelho é operável para injetar sinais em e receber sinais de linhas de potência de baixa tensão que abastecem consumidores com energia elétrica; ditos sinais provendo comunicação de via dupla entre a cabeça de medidor e o transponder, e atravessando o transformador de distribuição.35. Remote multi-channel electricity meter using power line communication, comprising: a plurality of meter points located on a secondary side of a transformer and operable to separately measure electricity usage for each of a plurality of electricity consumer lines; apparatus in communication with a transponder located on a primary side of the transformer and operable for transmitting data to and receiving data from the transponder by power line communication, the transponder operable for transmitting data to and for receiving data from a remotely located computer; one or more load control modules in communication with the meter head and operable to actuate each of a plurality of relays, each relay of the plurality of relays operable for on and off service on one of the plurality of electricity consumer lines ; and a box containing the plurality of meter points, the load control module, and the relays, wherein the distribution transformer converts medium voltage distribution voltages to low voltage voltages suitable for supplying power to consumers, and wherein the It is operable to inject signals into and receive signals from low voltage power lines that supply consumers with electricity; said signals providing two-way communication between the meter head and the transponder, and traversing the distribution transformer. 36. Aparelho para medição de multi-canal de eletricidade, caracterizado pelo fato de que compreende: uma cabeça de medidor localizada em um lado secundário de um transformador e operável para medir separadadamente uso de eletricidade para cada uma de uma pluralidade de linhas de consumidor de eletricidade; a cabeça de medidor em comunicação direta com um transponder localizado em um lado primário do transfornmador operável para transmitir dados para e receber dados do transponder por comunicação de linha de potência direta, o transponder operável para transmitir dados para e para receber dados de um computador localizado remotamente; um módulo de controle de carga em comunicação com a cabeça de medidor e operável para atuar conexão e desconexão de cada um de uma pluralidade de relês, cada relê da pluralidade de relês correspondendo a uma da pluralidade de linhas de consumidor de eletricidade; e uma caixa contendo a cabeça de medidor, o módulo de controle de carga, e os relês.36. Multi-channel electricity measuring apparatus, characterized in that it comprises: a meter head located on a secondary side of a transformer and operable to separately measure electricity usage for each of a plurality of consumer lines of electricity; the meter head in direct communication with a transponder located on a primary side of the operable transformer to transmit data to and receive data from the transponder by direct power line communication, the transponder operable to transmit data to and to receive data from a localized computer remotely; a charge control module in communication with the meter head and operable to connect and disconnect each of a plurality of relays, each relay of the plurality of relays corresponding to one of the plurality of electricity consumer lines; and a box containing the meter head, load control module, and relays. 37. Aparelho para medição de multi-canal de eletricidade, caracterizado pelo fato de que compreende: um módulo de controle em comunicação com um circuito secundário de um transformador de distribuição; o módulo de controle em comunicação direta com um transponder em comunicação com um circuito primário do transformador e operável para transmitir dados para e receber dados do transponder por comunicação de linha de potência direta, através do transformador de distribuição, o transponder operável para transmitir dados para e para receber dados de um computador localizado remotamente; uma pluralidade de módulos de medição em comunicação com o módulo de controle, cada módulo de medição operável para medir uso de eletricidade em uma de uma pluralidade de linhas de consumidor de eletricidade alimentadas pelo circuito secundário do transformador de distribuição; um ou mais relês em comunicação com o módulo de controle e operáveis para atuar conexão e desconexão de eletricidade para as linhas de consumidor de eletricidade; e uma caixa contendo o módulo de controle, os módulos de medição, e os relês.37. Multi-channel electricity measuring apparatus, characterized in that it comprises: a control module in communication with a secondary circuit of a distribution transformer; the control module in direct communication with a transponder in communication with a transformer primary circuit and operable to transmit data to and receive data from the transponder by direct power line communication through the distribution transformer, the transponder operable to transmit data to and to receive data from a remotely located computer; a plurality of metering modules in communication with the control module, each metering module operable to measure electricity usage on one of a plurality of electricity consuming lines powered by the secondary circuit of the distribution transformer; one or more relays in communication with the control module and operable to actuate connection and disconnection of electricity to the consumer electricity lines; and a box containing the control module, measuring modules, and relays.
BRPI0806143-2A 2008-06-27 2008-06-27 MULTI-CHANNEL ELECTRICITY MEASURING APPLIANCES BRPI0806143B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
BRPI0806143-2A BRPI0806143B1 (en) 2008-06-27 2008-06-27 MULTI-CHANNEL ELECTRICITY MEASURING APPLIANCES

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
BRPI0806143-2A BRPI0806143B1 (en) 2008-06-27 2008-06-27 MULTI-CHANNEL ELECTRICITY MEASURING APPLIANCES

Publications (2)

Publication Number Publication Date
BRPI0806143A2 true BRPI0806143A2 (en) 2012-05-08
BRPI0806143B1 BRPI0806143B1 (en) 2019-04-30

Family

ID=46001902

Family Applications (1)

Application Number Title Priority Date Filing Date
BRPI0806143-2A BRPI0806143B1 (en) 2008-06-27 2008-06-27 MULTI-CHANNEL ELECTRICITY MEASURING APPLIANCES

Country Status (1)

Country Link
BR (1) BRPI0806143B1 (en)

Also Published As

Publication number Publication date
BRPI0806143B1 (en) 2019-04-30

Similar Documents

Publication Publication Date Title
US7596459B2 (en) Apparatus and methods for multi-channel electric metering
EP1805523B1 (en) Method and apparatus for an electric meter
US5994892A (en) Integrated circuit design automatic utility meter: apparatus &amp; method
US8378844B2 (en) Utility meter with external signal-powered transceiver
US20110181438A1 (en) Meter device with supporting communications
US8253585B2 (en) Three-phase multifunction verifier
ES2441617T3 (en) System and method for monitoring and billing in line of power consumption
Ngamchuen et al. Smart anti-tampering algorithm design for single phase smart meter applied to AMI systems
GB2379993A (en) Electrical energy consumption and generation metering arrangement
CN118837599A (en) Multifunctional small intelligent electric energy meter based on dual-mode communication
JP2006284382A (en) Electronic energy meter
CN101351803B (en) Apparatus and method for multi-channel power metering
BRPI0806143A2 (en) multi-channel electricity measuring apparatus
CA2527068C (en) Apparatus and methods for multi-channel metering
CA2567955A1 (en) Apparatus and methods for multi-channel metering
KR100316485B1 (en) The electronic watt-hour metter for multiple house hold
MX2008007018A (en) Apparatus and methods for multi-channel metering
RU2234707C1 (en) Device for measuring electrical energy with protection from thefts
EP0742442A2 (en) Improvements in or relating to modulised utility meters
BR202023010862U2 (en) WIRELESS COMMUNICATION DEVICE FOR ELECTRICITY METERS EQUIPPED WITH AN ASYNCHRONOUS UNIDIRECTIONAL SERIAL PORT.
RU117013U1 (en) DIGITAL ELECTRIC ENERGY METER
TR2025013271U5 (en) AN ELECTRICAL ENERGY MEASURING METER
US10051348B2 (en) Power metering devices, methods, and systems
TR2021021340U5 (en) Electricity Meter That Can Continue to Measure Although Neutral Is Not Connected

Legal Events

Date Code Title Description
B06G Technical and formal requirements: other requirements [chapter 6.7 patent gazette]

Free format text: SOLICITA-SE A REGULARIZACAO DA PROCURACAO, UMA VEZ QUE BASEADO NO ARTIGO 216 1O DA LPI, O DOCUMENTO DE PROCURACAO DEVE SER APRESENTADO NO ORIGINAL, TRASLADO OU FOTOCOPIA AUTENTICADA.

B03A Publication of a patent application or of a certificate of addition of invention [chapter 3.1 patent gazette]
B06T Formal requirements before examination [chapter 6.20 patent gazette]
B06F Objections, documents and/or translations needed after an examination request according [chapter 6.6 patent gazette]
B09A Decision: intention to grant [chapter 9.1 patent gazette]
B16A Patent or certificate of addition of invention granted [chapter 16.1 patent gazette]

Free format text: PRAZO DE VALIDADE: 10 (DEZ) ANOS CONTADOS A PARTIR DE 30/04/2019, OBSERVADAS AS CONDICOES LEGAIS. (CO) 10 (DEZ) ANOS CONTADOS A PARTIR DE 30/04/2019, OBSERVADAS AS CONDICOES LEGAIS