npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jumo.net/varitron-process-values

v1.0.20

Published

Node.js module to browse, read and write JUMO variTRON process values.

Downloads

32

Readme

JUMO variTRON process values

The JUMO variTRON process value module allows you to read and write process values on the JUMO variTRON system. It provides functions for retrieving a list of available process values, reading values from specific selectors, writing values to specific selectors, and setting the PlcActive flags.

read(input)

The read(input) function is an asynchronous function that reads data from a given selector. The input can be either a single string or an array of strings.

Parameters

  • input (Array|String): The input to read from. It can be a single string or an array of strings. Each string should be an selector of the JUMO variTRON system.

Returns

  • A Promise that resolves with the read data. If the input was a single string, the Promise resolves with a single object. If the input was an array, the Promise resolves with an array of results.
  • The result is an object with the following properties:
    • selector
    • value
    • type: type of the process value
    • readOnly: true if the process value is read only
    • unit: measuring unit of the process value
    • error: code and text of the process value error (for example overrange, underrange, etc.)

Errors

  • If the function encounters an error while reading from an item, it rejects the Promise with an Error object. The error message includes the stringified item and the original error message.

Example

read(['selector1', 'selector2'])
    .then(results => console.log(results))
    .catch(error => console.error(error));

In this example, read is called with an array of selectors as string. The function reads from each selector and logs the results. If an error occurs while reading from a URL, the function logs the error.

write(input)

The write(input) function is an asynchronous function that writes data to a given selector. The input can be either a single object or an array of objects. Each object should have a selector property and a value property.

Parameters

  • input (Array|Object): The input to write to. It can be a single object or an array of objects. Each object should have a selector property (string) and a value property (string, number, or boolean).

Returns

  • A Promise that resolves with the write operation's result. If the input was a single object, the Promise resolves with a single object. If the input was an array, the Promise resolves with an array of results. Each result object has a done property that indicates whether the write operation was successful.

Errors

  • If the function encounters an error while writing to an item, it rejects the Promise with an Error object. The error message includes the stringified item and the original error message.

Example

write([{selector: 'selector1', value: 'newValue1'}, {selector: 'selector2', value: 'newValue2'}])
    .then(results => console.log(results))
    .catch(error => console.error(error));

In this example, write is called with an array of objects. Each object has a selector property that specifies the selector to write to and a value property that specifies the new value. The function writes the new value to each selector and logs the results. If an error occurs while writing to a URL, the function logs the error.

getList()

The getList() function is a asynchronous function that retrieves a list of all available process values of each module of the JUMO variTRON system.

Parameters

  • None

Returns

  • An array of objects, each representing a module. Each object contains either a flat list or a tree of process values. Each process value has the following properties:
    • name: A string that identifies the process value.
    • selector: A string that uniquely identifies the process value.
    • type: The type of the process value.
    • readOnly: A boolean indicating whether the process value is read-only.
    • unit: The unit of the process value if available.

Errors

  • If the function encounters an error while retrieving the process values, it throws an Error.

Example

const processValues = getList()
    .then(results => console.log(results))
    .catch(error => console.error(error));

In this example, getList is called. The function retrieves a list of all available process values and logs them. If an error occurs while retrieving the process values, the function logs the error.

setPlcActiveFlags()

The setPlcActiveFlags() function is an asynchronous function that sets the PlcActive flags by retrieving all existing PlcActive selectors, creating a list of selector-value pairs, and writing them to true. This is necessary to enable controller modules, placed on the JUMO variTRON system via EtherCAT. The function should be called only once after the system is started.

Parameters

  • None

Returns

  • A Promise that resolves when the flags are set.

Errors

  • If the function encounters an error while setting the flags, it rejects the Promise with an Error object.

Example

setPlcActiveFlags()
    .then(() => console.log('PlcActive flags set successfully'))
    .catch(error => console.error(error));

In this example, setPlcActiveFlags is called. The function sets the PlcActive flags and logs a success message. If an error occurs while setting the flags, the function logs the error.