📄 liftsystem.pr
字号:
/*#include 'u2ctypes.sdl'*/
/*#include 'u2ExtraOps.pr'*/
use U2ctypes;
use U2ExtraOps;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#zRvkSLRMT7FLqUDaHEv9jjGE")*/
package Interfaces;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#tIclqI6Jr10LSs6foEEk1F0I")*/
synonym MAX_TIME Integer= 999;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#IMptNVSqh-5LL2ibAVpdV-RL")*/
newtype Request struct
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#qtEK3VM01sFLCa8bRE-oWlVI")*/
direction DirectionKind;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#JRnY6LYLKMlLixW9jEmFQCZV")*/
targetFloor Integer;
operators
@NewRequest: -> @ptr_Request;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#hXIfBVDsc1CLkPpaGIF-VICL")*/
operator @NewRequest; returns /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#WThZ7EIifDlLAMGYbEkqutjV")*/
result @ptr_Request;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#3Om0TV439gELT0F6PI5QzNlI")*/
start;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#Y6anTEsRNECLidWaULalpDiL")*/
task result:=Alloc;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#BIISrVvDfbVLgvegREi9hbOL")*/
return;
endoperator;
endnewtype;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#wL2KUVZy-jiLcbOhPEnpl2AE")*/
newtype LiftInfo struct
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#H54A2EEw-NELb*P9wIOuoaQI")*/
currentFloor Integer;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#NUQvcVEFpG5LAmjdVL6sfLaE")*/
doorStatus DoorStatus;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#y70drL9s*pDLPd0Z0VfxshOI")*/
isMoving Boolean;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#CKSbDEcA6SLLWyMWGIccXQXE")*/
direction DirectionKind;
operators
LiftInfo: in/out LiftInfo; /*#CONSTRUCTOR*/
@NewLiftInfo: -> @ptr_LiftInfo;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#wL2KUVZy-jiLcbOhPEnpl2AE")*/
operator LiftInfo; fpar /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#a9xiGIPrKplLLENbpECicQrV")*/
in/out itself LiftInfo;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#wL2KUVZy-jiLcbOhPEnpl2AE")*/
start;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#CKSbDEcA6SLLWyMWGIccXQXE")*/
task /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#CKSbDEcA6SLLWyMWGIccXQXE")*/
itself! direction := down;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#y70drL9s*pDLPd0Z0VfxshOI")*/
task /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#y70drL9s*pDLPd0Z0VfxshOI")*/
itself! isMoving := false;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#NUQvcVEFpG5LAmjdVL6sfLaE")*/
task /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#NUQvcVEFpG5LAmjdVL6sfLaE")*/
itself! doorStatus := closed;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#H54A2EEw-NELb*P9wIOuoaQI")*/
task /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#H54A2EEw-NELb*P9wIOuoaQI")*/
itself! currentFloor := 0;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#6pYdUIGfoOVLJ0qkCIoPbhRI")*/
return;
endoperator;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#d*2LVEeiZeVL5j5k8VvvkZfV")*/
operator @NewLiftInfo; returns /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#jOPZqV0W6MILYBA7FVX-ZELE")*/
result @ptr_LiftInfo;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#LSer8Vy-tteLDQKbuVn9thUL")*/
start;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#T9jcpIEML0VLElxkhIuynM6L")*/
task result:=Alloc;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#yXjudVuBlDlLiDXj3Ez6Gc3V")*/
task LiftInfo(result*>);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#b4JbtVdTKueLDsbdALbL16TL")*/
return;
endoperator;
endnewtype;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#SYr87V03pvILCOkZSIpjEOAE")*/
newtype DirectionKind
literals /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#1AU*uVk5zTSL9FCfHL3h8BWE")*/
up, /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#92GpiE3D-AILOs9XiLbAHwUI")*/
down;
endnewtype;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#T5RnfL50vNELCOkkgEZtOcEL")*/
newtype DoorStatus
literals /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#UkP5gEjsFjSL4-7WeEUHVAbV")*/
open, /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#QPHcMIyf3WSL57dkUV9VZgMI")*/
closed;
endnewtype;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#uTUrpVssQnILkAmWxIKpHw*E")*/
signal requestLift ( Integer, DirectionKind);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#tjTMKLPTttCL9w992EqlTQlI")*/
signallist IFromFloorPanel = requestLift;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#HyOvDI59Bn5LU48b-VdKsHIE")*/
signal addLift;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#xcCSzV4fT1vL87Q92E214AMV")*/
signallist IFromServicePanel = addLift;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#ytjuiVNeQtDLmewg-IRorZEV")*/
signal gotoFloor ( Integer);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#zURmMIrt9LLLjTzX7VpMbx6V")*/
signallist IFromLiftPanel = gotoFloor;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#k52OMVj-0ZALsL5jjLOzYGRV")*/
signal directionLight ( DirectionKind);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#TZSN3I11uwBLmfxZOVmzoekL")*/
signallist IToFloorPanel = directionLight;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#fyw3gLjuyiFLvSsjNLMY940I")*/
signal confirmAdd;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#qydbPExyz*eLsmV7eLRtIugL")*/
signallist IToServicePanel = confirmAdd;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#2f76TL5ZAWeLBT1bQI1-03UV")*/
signal floorLight ( Integer);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#QTjcPVyndDILPXcavEbVp34V")*/
signallist IToLiftPanel = floorLight;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#7DH0rLkE1aVLQywhBLfchWOI")*/
signal notify ( @ptr_LiftInfo);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#ZjTrpE0cbV5LvCJZ2I01BnpI")*/
signal associate ( Pid);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#8nMsNV8waDALeavkREdC5x7E")*/
signallist ILiftObserver = notify, associate;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#cpDD9EfpNxlL*DEZYVriBp-V")*/
signal moveToFloor ( Integer);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#PSVe-LA7LRSLX13aWI4Rk2ML")*/
signallist ILift = moveToFloor;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#bXSm0I-lqoVLnqmd5IT7ulQV")*/
signal serviceTime ( ServiceTime);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#wvOeALrvE9CLtiHdiIygzaiI")*/
signallist IResponse = serviceTime;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#y*IlLEZrLG5LbT8aVIlllS1I")*/
signal requestServiceTime ( @ptr_Request);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#yLiQnVjoi9SLysj7TL52d*0E")*/
signal handleRequest ( @ptr_Request);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#Qzs-cIGMCCCLpaXbXVi*JieL")*/
signallist IRequest = requestServiceTime, handleRequest;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#Ga4IhVn-zsVLrTmatLJPeoJE")*/
syntype ServiceTime = Integer
constants 0: MAX_TIME
endsyntype;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#Sa128EJ0V1VLMJYW-EtKYGzE")*/
newtype @AK@Reference@RequestList String ( @ptr_Request, s_empty_string)
endnewtype;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#wL2KUVZy-jiLcbOhPEnpl2AE")*/
newtype @String_ptr_LiftInfo String( @ptr_LiftInfo, s_empty_string)
endnewtype;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#IMptNVSqh-5LL2ibAVpdV-RL")*/
newtype @String_ptr_Request String( @ptr_Request, s_empty_string)
endnewtype;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#wL2KUVZy-jiLcbOhPEnpl2AE")*/
newtype @ptr_LiftInfo Ref( LiftInfo)
endnewtype;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#IMptNVSqh-5LL2ibAVpdV-RL")*/
newtype @ptr_Request Ref( Request)
endnewtype;
endpackage;
use Interfaces;
use U2ctypes;
use U2ExtraOps;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#QhMwHE2LcZEL2vKbPI9OUZrE")*/
package LiftComponents;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#izLc2IWf8ZDLv*-k-VcmIr*V")*/
process type LiftManager;
signalset;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#RtmxzLZr1lSLuYR6cIyS2QWI")*/
gate P1
in with ( IFromFloorPanel);
out with ( IToFloorPanel);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#6cpOTVviVBCL-aqd2EMb2kDL")*/
gate P2
in with ( IFromServicePanel);
out with ( IToServicePanel);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#9kFyYERqDOILKqJjLE*gYBAE")*/
gate P3
in with ( IResponse);
out with ( IRequest);
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#gjEOoVaFXJALwPIgoEwghMsL")*/
dcl newRequest @ptr_Request;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#PUqBgEA8GbFLokedkVsE*dkL")*/
dcl controllers @AK@Reference@ControllerList;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#JcRSWLP4M2ELFR37lLwTsGvE")*/
procedure add;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#D6Q0NVz04zBLN85hRVkjqNnI")*/
dcl tmpCtrl_1 Pid;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#qTME3Ekb0feLd4AZXLfOeYOI")*/
dcl newLift Pid;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#sTL3CEXphrSLPjA7SIqqcPkV")*/
start;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#1aUTHVs83xILrhH6KVOEgf2I")*/
create LiftController;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#J2G0EIIeywVLH6TWdIJ45jrV")*/
task /*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#J2G0EIIeywVLH6TWdIJ45jrV")*/
tmpCtrl_1 := offspring;
/*#SDTREF(U2,"u2:F:\UML\LiftManagement20\SystemDesign\LiftManagement.u2#N5Eg9Vii*kvL7C-9*VMamFgI")*/
task append( controllers, tmpCtrl_1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -