Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

LUA, Time function and other scripts impact

SpaceLogic KNX Forum

Schneider Electric SpaceLogic KNX forum to get support and share knowledge including selection, installation and troubleshooting for spaceLYnk, Wiser for KNX, eConfigure KNX, SpaceLogic KNX Hybrid module and other topics.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • EcoStruxure Building
  • Light and Room Control
  • SpaceLogic KNX Forum
  • LUA, Time function and other scripts impact
Options
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
Thomas_Rohde
Sisko Thomas_Rohde Sisko
121
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
54
Heribert_Dölger
Lt. Commander Heribert_Dölger Lt. Commander
30
FZetina
Lt. Commander FZetina Lt. Commander
27
View All
Related Products
product field
SpaceLogic KNX - 4ʺ Touch Unit
product field
KNX Push Button Dynamic Labeling, universal
product field
Wiser for KNX : logic controller

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Back to SpaceLogic KNX Forum
jorge_marti
Ensign jorge_marti
Ensign

Posted: ‎2014-10-21 04:52 AM . Last Modified: ‎2024-07-15 12:04 AM

1 Like
5
864
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-10-21 04:52 AM

LUA, Time function and other scripts impact

Dear all,

I am playing a bit with HomeLYnk and have a question about scripting.

I have a resident event script getting values from iem3150. When total power reach an upper limit I want to deactivate loads in different steps. flow would be as follow:

Power limit reached

Deactivate Load 1

Wait some seconds

Refresh Power value

If power still over limit deactivate Load 2

Wait some seconds

Refresh power value

If power still over limit deactivate Load N

My question is what happens to the complete system during this wait time... are the other event scripts still running?

Other option would be to use global internal variable (that can be used in different scritps) as gate. Is it possible?

Other option then (worst one) would be to use a group address as this global variable... terrible but functional.

Thanks for hints!

  • Thumbnail of SpaceLogic KNX - 4ʺ Touch Unit
    SpaceLogic KNX - 4ʺ Touch Unit
  • Thumbnail of KNX Push Button Dynamic Labeling, universal
    KNX Push Button Dynamic Labeling, universal
  • Thumbnail of Wiser for KNX : logic controller
    Wiser for KNX : logic controller
View products (3)
Reply
  • All forum topics
  • Previous Topic
  • Next Topic
Replies 5
lfiat
Ensign lfiat
Ensign

Posted: ‎2014-10-21 05:56 AM

1 Like
3
786
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-10-21 05:56 AM

Hello Jorge,

>> I have a resident event script getting values from iem3150:

in homeLYnk, you have 2 types of scripts:

* Resident script is cyclic script with a timer you can set: 0 to 60s

* Event script is triggerred by a value change of one or more KNX objects


According what you want I think you use a resident script (=to read IEM3150)


To build the algorithm you want to carry out I advise you to use a resident script with a timer = the minimum granularity  of your algoritm (for instance 10 seconds)

and to use for your different load deactivation: a counter +  a condition : if (myCounter > n) {  n =0   deactivation } else { n = n + 1} => n= 5 => you go through deactivation each 50 seconds.


but if you want to use sleep(), you can; other scripts (resident or event ones) are not interrupted, still running when an other script uses sleep().


If you want to share data between 2 scripts use storage.set() in script 1 and storage.get() in script 2 => you retrieve the data in script 2 from script 1


Regards


Lionel

Reply
jorge_marti
Ensign jorge_marti
Ensign

Posted: ‎2014-10-21 06:25 AM

0 Likes
2
786
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-10-21 06:25 AM

Thanks for the hint. The counter is good solution, but I still need then to wait some time as I assume code execution is much faster than the power meter to refresh the value.

Reply
lfiat
Ensign lfiat
Ensign

Posted: ‎2014-10-21 06:36 AM

0 Likes
0
786
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-10-21 06:36 AM

You are right code execution may be instantaneous for instance if you have a homeLYnk only with your script.

The power meter you choose may be also 'instantaneous" (= update measurement each 1 ms).

The reason to wait in homeLYnk is the interface with the power meter you use: with IEM 3150 it is Modbus, so to avoid overloading homeLYnk Modbus stack (and you may have others Modbus slaves too), better is to read IEM 3150 each 5 seconds.

Reply
sesa299442
sesa299442 Schneider Alumni (Retired)
Schneider Alumni (Retired)

Posted: ‎2014-10-22 11:47 PM

0 Likes
0
786
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2014-10-22 11:47 PM

You can use event-script controlled by the grp.address of the power value,which is read from modbus.

When the value is updated the script is executed and you can perform your conditional actions.

Reply
sesa299442
sesa299442 Schneider Alumni (Retired)
Schneider Alumni (Retired)

Posted: ‎2015-01-07 06:24 AM

0 Likes
0
786
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2015-01-07 06:24 AM

Jorge,

if you want to use global variable, which can be used in all the scripts, you can use storage function.


--Sets new value for the given key. Old value is overwritten. Returns Boolean as the result and an optional error string.

storage.set(key, value)

--Gets value for the given key or returns default value (nilif not specified) if key is not found in the data storage.

storage.get(key, default)

There is quite detailed description of this function in the User Guide.

Reply
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of