1. Catalogs
  2. movizon GmbH
  3. movizon CONTROL Script API
video corpo

movizon CONTROL Script API

movizon CONTROL Script API

movizon CONTROL Script API

Product catalog summary
Overview: The movizon CONTROL Script API provides a framework for managing resource data access and persistence, offering a sandboxed environment for script execution using JavaScript. It emphasizes high performance and efficient data exchange through REST requests.
Data Exchange: Scripts operate within their own context, active only during execution. Data exchange is performed via REST requests in string format, requiring serialization and deserialization. To optimize performance, it is recommended to minimize string size and serialization/deserialization processes, and to filter GET requests to reduce parsing overhead.
Resource Locking: Scripts can lock resources to prevent data overwrites during concurrent access. A single manager task per resource type is recommended to handle entire resource writes, while other tasks should modify single fields without locking.
Field Reservation: Scripts can reserve fields to maintain resource integrity, ensuring only the reserving script can modify them. This is useful for managing critical data, such as vehicle positions, to prevent unintended changes.
Host Functions: The API provides several host functions for Java interoperability, including methods for reserving fields, locking/unlocking resources, including other scripts, running tasks, and processing REST requests. These functions facilitate efficient script management and resource handling.
Best Practices: Organize scripts and field reservations according to their purpose, use single-purpose scripts for specific tasks, and ensure efficient resource management through proper locking and reservation strategies.
See more

Catalog excerpts

movizon CONTROL Script API-1

movizon CONTROL Script API Version 2022-10-27 movizon CONTROL Script API movizon CONTROL (mC) without script is only a framework. The software manages access and persistence of resource data and provides a sandboxed environment for scripts to implement logic and logistic. Scripts can utilize the latest JavaScript language standards and benefit from a high-performance engine in the background. Data Exchange Each script task has its own context that lives only as long as the script is running. The running state is different to the activation state. An activated script of type INTERVAl set to a one second interval will be triggered once each second but runs according to its load hopefully only some milliseconds. So the lifetime of any JavaScript object created during runtime is also only some milliseconds. Scripts can not memorize anything (this solves some data integrity problems of the old nashorn script engine). Any data exchange must be done via REST request in string format as this is the common understanding of resource data for scripts, JAVA core, browser UI and database. That requires constant serialization and deserialization. Overall, the scripter's design choices affect performance to a much greater extent than in previous versions of mC. The recommended approach is to keep string size and serialization/deserialization minimal. Avoid too long strings both in the keys and in the values of a resource, round numbers (2.8786511298432165 to 2.88), store values only if necessary and in just one place inside a resource object. Retrieve and parse resources once in your code. Always filter your GET requests to reduce parsing overhead (see REST API documentation for details). Intentionally there are no negated filters (like "get all fields except abc") because you never know what unwanted giant objects you might end up catching. Write single fields instead of the whole resource whenever possible. Also organize your resources into logical resource types in terms of size and task access (e.g. dedicated route resources in contrast to job resources with route field). Resource Locking Each script has one or multiple tasks that execute the code. A task for its own is always single-threaded, but all tasks together form a system where multiple threads attempt to access the same resources at constantly shifting times. The JAVA core synchronizes modifying REST requests within the same resource type, but that doesn't solve the following problem: Task A retrieves a state of a resource via GET, then after changing some fields writes is back to the core via PUT. Changes that are made to a single field of the same resource from task B after the GET request from A will be overwritten when executing the PUT request from task A. This can be solved by locking: Task A locks the resource before the GET request. All modification requests from other tasks/threads are queued now, including the change request from task B. Task A performs the PUT request and unlocks the resource. Now the queued change request from task B can be executed. But if task B would also want to change the entire resource, its PUT request would overwrite the carefully locked change from task A completely. Task B could take the changes of A into account also by locking, but this would slow things down unnecessarily.

 Open the catalog to page 1
movizon CONTROL Script API-2

movizon CONTROL Script API Version 2022-10-27 moi/izon The recommended approach is to have only one manager task per resource type, the only one that writes entire resources. This manager does the locking. All other tasks that interact with the same resource type only write single fields without locking. In addition to locking, there is a second technique to ensure resource integrity: With field reservation a script can specify that only itself can change certain fields of a resource. Imagine a vehicle manager script that cyclically retrieves raw data from an interface and calculates the position...

 Open the catalog to page 2
movizon CONTROL Script API-3

movizon CONTROL Script API Version 2022-10-27 moi/izon Example String getType()

 Open the catalog to page 3
movizon CONTROL Script API-4

movizon CONTROL Script API Version 2022-10-27 moi/izon Description

 Open the catalog to page 4

All Movizon GmbH catalogs and technical brochures

*Prices are pre-tax. They exclude delivery charges and customs duties and do not include additional charges for installation or activation options. Prices are indicative only and may vary by country, with changes to the cost of raw materials and exchange rates.