如何在一个CPN处使用UNION类型接收不同的类型?

How to use UNION type to receive different types in one CPN place?

我想在我的彩色 Petri 网模型中以一个地方可以接收两种不同类型 "request" 的方式使用联合。

我有以下声明:

colset AUTHENTICATION = product INT * STRING;
colset REQUEST_PUB = product AUTHENTICATION * STRING * REAL;
colset REQUEST_SUB = product AUTHENTICATION * STRING * INT;
colset REQUEST_PUBSUB = union REQUEST_PUB + REQUEST_SUB;

我有以下配置:

过渡 ------> 放置 (REQUEST_PUBSUB) <------ 过渡

右转正在发送 ((int, string), string, real),左转正在发送 ((int, string), string, int)。由于该位置是 REQUEST_PUBSUB 类型,它是 REQUEST_PUBREQUEST_SUB 的联合,理论上这应该有效,一旦 ((int, string), string, real) 显然是有效的 REQUEST_PUB 并且((int, string), string, int) 显然是有效的 REQUEST_SUB.

但这不起作用,我收到以下错误:

Error: expression doesn't match constraint [tycon mismatch]
expression: (INT * STRING) * STRING * REAL
constraint: REQUEST_PUBSUB ms
in expression ((int, string), string, real): REQUEST_PUBSUB ms
Elaborate failure

Error: expression doesn't match constraint [tycon mismatch]
expression: (INT * STRING) * STRING * INT
constraint: REQUEST_PUBSUB ms
in expression ((int, string), string, int): REQUEST_PUBSUB ms
Elaborate failure

谁能帮我解决这个问题?我认为描述很清楚,但如有必要,我可以补充更多信息。

我通过指定联合类型的标识符解决了这个问题:

colset REQUEST_PUBSUB = union pub_req:REQUEST_PUB + sub_req:REQUEST_SUB;

然后,对于右过渡弧,我使用了 pub_req((int, string), string, real),对于左过渡弧,我使用了 sub_req((int, string), string, int)