Advertisement
agmike

A little magic (LSE basic setup principle)

Aug 10th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. static class DRelayClass isclass LseDeviceClass
  2. {
  3.     public string GetName() { return "DRelay"; }
  4.  
  5.     public LseDevice Create() { return new DRelay(); }
  6.  
  7.     public Soup GetQueries() { return queries; }
  8.  
  9.     define public QueryState = QueryUser + 1;
  10.     define public QueryOnDelay = QueryUser + 2;
  11.     ...
  12.  
  13.     Soup queries = Queries();
  14.    
  15.     Soup Queries()
  16.     {
  17.         Soup ret = Constructors.NewSoup();
  18.         properties.SetNamedTag("state", QueryState);
  19.         properties.SetNamedTag("on-delay", QueryOnDelay);
  20.         return ret;
  21.     }
  22. }
  23.  
  24.  
  25. void InitClasses()
  26. {
  27.     DevMgr().Factory().AddClass(DRelayClass);
  28. }
  29.  
  30. void Init()
  31. {
  32.     // Задаем используемые типы устройств
  33.     DevMgr().Factory().CreateType("R-50", "DRelay", "coil-resistance: 50, on-current: 0.4");
  34.    
  35.     // Собираем схему
  36.     SchemeMgr().SetCircuit("4/1, RDM4, RU14");
  37.     SchemeMgr().SetCircuit("4/1, RU14.1, 1115, BGP, RU7.2, 1108, MR6");
  38.    
  39.     // Устанавливаем устройства
  40.     DevMgr().SetDevice("RU14", "R-50", "any: 'additional properties'");
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement