Gestion des volets
SCÉNARIO 1 : Ouverture des stores d'une pièce.
// Some code
private bool x0v = true;
private bool x1v = false;
private bool x2v = false;
private bool x3v = false;
private bool ft1v = false;
private bool ft2v = false;
private bool ft3v = false;
private bool ft4v = false;
private bool ft5v = false;
private bool boutonMonterPrec = false;
private bool boutonMonter = false;
private bool boutonDescendrePrec = false;
private bool boutonDescendre = false;
private bool frontMonter = false;
private bool frontDescendre = false;
private bool capteurHaut = false;
private bool capteurBas = false;
private MemoryBit actMonter;
private MemoryBit actDescendre;
private void runCycleVolet()
{
MemoryMap.Instance.Update();
boutonMonterPrec = boutonMonter;
boutonDescendrePrec = boutonDescendre;
boutonMonter = MemoryMap.Instance.GetBit(3, MemoryType.Input).Value;
boutonDescendre = MemoryMap.Instance.GetBit(4, MemoryType.Input).Value;
capteurHaut = MemoryMap.Instance.GetFloat(3, MemoryType.Input).Value == 10.0;
capteurBas = MemoryMap.Instance.GetFloat(3, MemoryType.Input).Value == 0.0;
frontMonter = !boutonMonterPrec && boutonMonter;
frontDescendre = !boutonDescendrePrec && boutonDescendre;
ft1v = (x0v || x2v) && frontMonter && !capteurHaut;
ft2v = x1v && capteurHaut;
ft3v = (x0v || x1v) && frontDescendre && !capteurBas;
ft4v = x2v && capteurBas;
ft5v = x3v;
x0v = ft5v || x0v && !(ft1v || ft3v);
x1v = ft1v || x1v && !(ft2v || ft3v);
x2v = ft3v || x2v && !(ft4v || ft1v);
x3v = (ft2v || ft4v) || x3v && !ft5v;
actMonter = MemoryMap.Instance.GetBit(1, MemoryType.Output);
actDescendre = MemoryMap.Instance.GetBit(2, MemoryType.Output);
actMonter.Value = x1v;
actDescendre.Value = x2v;
MemoryMap.Instance.Update();
}Last updated
Was this helpful?