Menu

Tree [0ad67d] default tip /
 History

Read Only access


File Date Author Commit
 administration_tools 2025-10-12 Goetz Pfeiffer Goetz Pfeiffer [d3cfe3] Some administration scripts were added.
 include 2025-03-19 Goetz Pfeiffer Goetz Pfeiffer [2c3cc5] A speed multiplier was implemented.
 src 2025-03-19 Goetz Pfeiffer Goetz Pfeiffer [2c3cc5] A speed multiplier was implemented.
 .hgignore 2025-01-09 Goetz Pfeiffer Goetz Pfeiffer [1aa7de] All core functions are now in the library libvd...
 .hgtags 2025-10-12 Goetz Pfeiffer Goetz Pfeiffer [3f74f7] Added tag 1.5.1 for changeset d3cfe375d352
 LICENSE 2025-03-12 Goetz Pfeiffer Goetz Pfeiffer [79206d] A README file was added and the project is now ...
 Makefile 2025-01-09 Goetz Pfeiffer Goetz Pfeiffer [1aa7de] All core functions are now in the library libvd...
 README.rst 2025-10-12 Goetz Pfeiffer Goetz Pfeiffer [0ad67d] Fix of some typos in README.rst.
 run.sh 2025-01-09 Goetz Pfeiffer Goetz Pfeiffer [1aa7de] All core functions are now in the library libvd...

Read Me

vdrive - a motor drive emulation

About

vdrive provides virtual drives. These are simulated motor drives that can be used in an application that simulates devices that have motors that need to be controlled.

vdrives

A vdrive has the following basic properties:

  • position
  • velocity
  • status: stopped or moving
  • destination

and the following extra properties:

  • a brake that is activated or released
  • an activation flag, only an activated vdrive will move
  • a maximum movement time
  • a name

A vdrive can receive a command. These commands are currently known:

  • STOP : stop the vdrive
  • START: start moving to destination
  • SETBRAKE

vdrive properties

brake

This is a very simple brake simulation. A brake can be activated or released. A drive can only move when the brake is released. If you try to move a vdrive when the brake is activated, you get an error. Also, you cannot activate a brake while the vdrive is moving.

Changing the state of the brake requires calling two functions, vdrive_single_set_flag to provide the state of the brake and vdrive_single_cmd with the command SETBRAKE to actually change the state of the brake.

activation

The activation property may be true or false. If a vdrive is not activated, it will ignore the start command.

max_time

This is the time the next movement should take. If the current set velocity is too high so the vdrive would arrive at the destination too early, the vdrive velocity is reduced to match the max_time. Note that the current set velocity can only be decreased with this mechanism, never increased.

If you have a group of vdrives, giving all of them the same max_time ensures that when they start a movement at the same time they will all arrive at the destination at the same time, regardless of the distance they have to move.

vdrive group

This is a structure that contains vdrives. Some operations can be applied to a vdrive group and affect all vdrives in that group or only some that are selected by a bit mask.

Time

This module contains no real-time task. Instead, many functions get the current time as a parameter. Two functions that get the same time as a parameter are treated as if they were called at the same time.

The module tracks for each vdrive when a movement was started and provides a function that calculates for any given time the state of the vdrive at that time.

Parameters

Parameters that are of type floating point are read and written with the functions vdrive_single_get_double and vdrive_single_set_double.

Parameters that are of type boolean are read and written with the functions vdrive_single_get_flag and vdrive_single_set_flag.

The specific parameter for the functions is given with a c enumeration data type.

Physical units

The module makes no assumption about the physical units of position, time and velocity. It is in the responsibility of the application to use the same units when calling functions of this module.

Further documentation

Currently there is none. This is a very early version of this module. It is well tested but clearly still lacks documentation.

If you want to know more look at the file include/vdrive.h or src/vdrive.c

src/vdrivetest.c is a very simple example how to use this module.

Author

Goetz Pfeiffer <Goetz.Pfeiffer@helmholtz-berlin.de>

License

vdrive is licensed under GNU GPL v.3.