12-06-2014 08:52 AM
Hello everyone
I would like use attached algorithm in my model. I use this code
if some condition then
if lastCycle=1 then
@.move(machine2);
lastCycle:=0;
print lastCycle;
elseif lastCycle=0 then
@.move(machine1);
lastCycle:=1;
print lastCycle;
end;
else
@.move(machine1)
end;
Is see in consol thet lastCycle is 1, but condition: if lastCycle=1 then, don't execute. Could You help Me?
12-08-2014 02:33 AM
Hi WD,
maybe the movement was not possible.
Please use the instruction
print @.move(machine2);
Regards,
Peter
12-08-2014 06:36 AM
Hi,
I try this but nothin is change. Movement is possible, I swapped machine (singProc) on line and problem still exist. I print lastCycle and is 1 all time.
12-08-2014 06:55 AM
Hi
therefore it must be the external condition.
Please equip the else-branch with a corresponding print instruction.
When the else-branch is taken the exchange mechanism is not used.
Regards,
Peter
12-08-2014 01:55 PM
12-12-2014 12:20 PM
Hello,
yes LastCycle is an object Variable on the toolbox Information Flow.
Sometimes the movement is impossible, like in your model.
The move method has a boolean result. You can use it:
if somecondition.value then
if lastCycle=1 then
if @.move(machine2) then
lastCycle:=0;
print lastCycle;
end;
elseif lastCycle=0 then
if @.move(machine1) then
lastCycle:=1;
print lastCycle;
end;
end;
else
@.move(machine1)
end;
12-16-2014 04:11 AM
Hello,
I use a global variable LastCycle and now condition work correctlu.
Thank You for help
WD