设为首页收藏本站

最大的系统仿真与系统优化公益交流社区

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 5544|回复: 0

[求助] 【求助! Equation公式】关于多品类补货的公式编写

  [复制链接]
发表于 2011-12-4 21:25:53 | 显示全部楼层 |阅读模式
求助高手啊~!!! 感激不尽!% {5 }; h( L4 i+ L) d
8 d; Y5 J& O# U" j- R( d
如果我需要判断3种货物分别是否需要补货,并且设置其对应的补货量, 而由于模块容量限制, 我希望能用一个Equation来编辑公式从而达到目的, 用如下公式能否实现:
& S% _: Z/ R- c0 e. \5 |3 r***********其中inv1,2,3分别表示3种货品各自的库存量,  ss1,2,3分别表示各自的安全库存 ***********
7 H% L, r6 N1 R" ?***********S1,2,3分别表示各自的最大库存,  out1,2,3分别为各自的补货量***********
; o% @9 M& r8 q& B; Y' {; T% o* m  A" o( `
9 v# N* E7 T2 K' s0 E* c1 `
if (inv1<=ss1 and inv2>ss2 and inv3>ss3)
/ F6 R2 C2 t& d& V5 Dout1=S1-inv1;
0 A, ?# m0 ?3 ^, C" E4 gout2=0;
& v: D2 I+ s' M" i7 ^" P4 hout3=0; /货品1需要补货/
, v2 i6 k( q; }. b( |8 i# l* ~7 V
else if (inv1>ss1 and inv2<=ss2 and inv3>ss3)
6 h1 g' l$ W! Q; b4 o) Jout1=0;
7 o6 O7 A( a1 U# F2 qout2=S2-inv2;% y( ~! J: H8 n: I% t
out3=0; /货品2需要补货/
) L2 d! p/ _# g, m( l+ f4 Z! B6 V  z
else if (inv1>ss1 and inv2>ss2 and inv3<=ss3)4 w0 i! `$ t' E; i& Y' M" y
out1=0;
" f: }/ R" m* w# Y; nout2=0;
) i6 V7 P9 O) K: ~+ ?; l( `out3=S3-inv3; /货品3需要补货/% L1 w* V" ~" t
9 a3 L" S  s- a
else if (inv1<=ss1 and inv2<=ss2 and inv3>ss3)
( i2 z7 I. f4 aout1=S1-inv1;+ f4 A+ i* X1 h4 q* t+ ~4 z
out2=S2-inv2;
2 L% D4 S, z: y" {- [/ xout3=0; /货品1,2需要补货/' N6 R) \- D: P; d+ J% V3 e

3 ~& M! d: \8 \) l* C1 p( lelse if (inv1<=ss1 and inv2>ss2 and inv3<=ss3)0 |4 ^2 j/ l7 G1 d2 V0 t
out1=S1-inv1;9 L  d  S  J! C+ z- |
out2=0;
. `' t2 i1 I8 H# O- v2 `out3=S3-inv3; /货品1,3需要补货/- c2 l5 D7 Y/ D! m4 K! s( q' B
' R  _$ q0 y: I! [4 ^# _
else if (inv1>ss1 and inv2<=ss2 and inv3<=ss3)
5 W5 I2 _, C8 e* i! }! i( eout1=0;7 _' x$ L, C2 h
out2=S2-inv2;! y  [' @* y5 H/ V" T& Y9 O/ l
out3=S3-inv3; /货品2,3需要补货/: Y# }' b. _! M5 V  ], {. \: i

- T! e* _6 R0 X& Q  R% xelse if (inv1<=ss1 and inv2<=ss2 and inv3<=ss3)4 X2 r0 l! ~6 L5 c1 o2 n
out1=S1-inv1;
6 w" V* o9 F' _1 E% b' u! oout2=S2-inv2;* `# @6 g0 ~, H9 i3 l+ G
out3=S3-inv3; /货品1,2,3需要补货/
! B5 D# G0 Z. |. ?/ r' Y) m. M) T2 {' C& f  x% _
问题1: 我用上述公式写入Equation模块,提示错误,"Found ELSE, expecting: ++ -- <identifier> ABORT BREAK CONTINUE...",
8 L; [% F; j' Q. U* C% ~& u但是如果把所有的else if 中的else去掉, 即没有提示错误. 不过我新建了一个简易的模型测试了一下, 上述公式不能达到我想要的效果.
( Y3 ?& o5 Y% i1 U1 n% [7 P, H4 }* [, o, B; a
请问,需要如何编写公式才能达到实时判断, 3种产品分别需要多少补货量呢?7 n/ A+ m3 _. c9 _& J' }1 ^  v
谢谢~!!!!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|SimulWay 道于仿真   

GMT+8, 2026-6-12 04:07 , Processed in 0.157077 second(s), 15 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表