請求幫助設定並最大化功能內的可取性。大家好,我正在嘗試編寫一個函數,用於在裝置中達到使用者指定的目標值。提供的參數包括需要匹配的目標指標名稱、需要匹配的值、設備名稱以及目標設備的重量。
我希望透過使用響應限值和匹配目標來設定合意性曲線來實現這一點。我測試了程式碼,當我將列和函數外部指定為獨立程式碼片段時,程式碼可以正常運作。現在我嘗試將其包裝到函數中,但設定響應限值的特定程式碼部分不起作用。有人能幫我找出我做錯的地方嗎?謝謝!
我得到的圖形輸出如下。所需的反應指標、因子值和鎖都運作良好,但可取性曲線沒有改變。

dt = currentdatatable();
// FindMatchingAgiSpeed is a function that finds the agitation speed in Brx_B that will
// match the hydrodynamic quantity requested as the input
FindMatchingAgiSpeed = Function( {dt, HydyMetricMixing, valueOfHydyMetric, Brx_Name_B, Brx_Volume_B},
// HydyMetricMixing is a string and can be either "P/V (W/m^3)" or "Top 10% EDR (W/kg)" or "Tip Speed (m/s)" and so on
// valueOfHydyMetric is a float that is the value of the chosen HydyMetricMixing that we want to achieve in Brx_B
// Brx_Name_B is a string which is our target production bioreactor we want to find the agitation setpoint for
// Brx_Volume_B is the amount of liquid in the bioreactor
HydyMetricMixing_col = Column (dt, HydyMetricMixing);
// this part of the code works perfectly
profiler = dt << Profiler(
Y( HydyMetricMixing_col ),
Confidence Intervals( 1 ),
Desirability Functions( 1 ),
Term Value(
:"Bioreactor"n( Brx_Name_B, Lock( 1 ), Show( 1 ) ),
:"Volume (L)"n( Brx_Volume_B, Lock( 1 ), Show( 1 ) ),
:"Agitation (RPM)"n(50, Min(12), Max(263), Lock(0), Show(1))
),
);
// This part of the code does not work at all
profiler << Response Limits(
Eval( Parse( ":" || Char(HydyMetricMixing) ) ), // Convert string to symbol
{
Lower( valueOfHydyMetric*0.8, 0.0183 ),
Middle( valueOfHydyMetric, 1 ),
Upper( valueOfHydyMetric*1.2, 0.0183 ),
Goal( "Target" ), Importance( 1 )
}
);
// Maximize desirability
profiler << Maximize and Remember;<BR /><BR /> // "Agitation (RPM)" obtained after maximization is the result we want to return from this function
);
// call the function to find the optimized value
FindMatchingAgiSpeed(dt, "P/V (W/m^3)", 93.0, "SSB_10kL_ABEC", 9000);
自動化和腳本視窗回覆:請求幫助設定和最大化功能內的可取性。不確定你會如何以這種方式使用回應限制,因為文件缺乏,而且我認為所選的語法很糟糕,與Profiler無關……我知道你可以建立整個Profiler表達式並將回應限制包含在其中。另一個選擇是使用回應限制列屬性,但我認為這些屬性必須在運行Profiler之前設定。查看你的函數,將其構建到Profiler中應該沒問題,這篇文章確實提供了使用JSL擬合模型、最大化期望值以及使用用戶可選列提取結果的基本思路。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Tiretread.jmp");
lval = 150;
mval = 200;
uval = 300;
col = "Pred Formula ABRASION";
pf = Eval(Substitute(
Expr(dt << Profiler(
Y(_col_),
_colw_ << Response Limits(
{Lower(_lval_, 0.9819), Middle(_mval_, 0.5), Upper(_uval_, 0.066),
Goal(Maximize), Importance(1)}
)
)),
Expr(_col_), Name Expr(As Column(dt, col)),
Expr(_colw_), Parse(col),
Expr(_lval_), lval,
Expr(_mval_), mval,
Expr(_uval_), uval
));
您只需執行 Substitute 部分(無需 Eval)即可檢查正在使用的表達式

回覆:請求幫助設定和最大化功能內的可取性。你好,Jarmo,
感謝您的建議。我會按照您的建議重寫分析器。但是,文法方面仍然有些問題。我重寫了函數,在分析器中設定“響應限制”,而不是單獨設定一個步驟。但仍然無法正常工作。如果我替換列變數名,並用列名進行硬編碼,就可以正常工作了。能分享一下我可能做錯了什麼嗎?
在函數內部定義的分析器中,當我執行此操作時,它會起作用:
"P/V (W/m^3)"n << Response Limits(
{
Goal("Match Target"),
Importance( 1 ),
Lower(valueOfHydyMetric*0.8, 0.0183),
Middle(valueOfHydyMetric, 1),
Upper(valueOfHydyMetric*1.2, 0.0183)
}
),
但是當我這樣做時,它不起作用
Column (dt, HydyMetricMixing) << Response Limits(
{
Goal("Match Target"),
Importance( 1 ),
Lower(valueOfHydyMetric*0.8, 0.0183),
Middle(valueOfHydyMetric, 1),
Upper(valueOfHydyMetric*1.2, 0.0183)
}
),
I tried everything, parsing, eval, expr, etc. I just want the column name stored as a string to work with the Response Limits message. Here HydyMetricMixing is just a variable that stores the string "P/V (W/m^3)".
回覆:請求幫助設定和最大化功能內的可取性。回應限制實際上並非發送到列,而是發送到 JMP 名稱。這就是為什麼我使用 Parse() 而不是 Column()/AsColumn()。不知道為什麼要這樣實現。
在您的情況下,由於您的列名需要特殊語法(「n」),請嘗試使用 As Name() 而不是 Parse()。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Tiretread.jmp");
Column(dt, "Pred Formula ABRASION") << Set Name("Pred Formula ABRASION/123-");
lval = 120;
mval = 150;
uval = 190;
col = "Pred Formula ABRASION/123-";
pf = Eval(Substitute(
Expr(dt << Profiler(
Y(_col_),
_colw_ << Response Limits(
{Lower(_lval_, 0.9819), Middle(_mval_, 0.5), Upper(_uval_, 0.066),
Goal(Maximize), Importance(1)}
)
)),
Expr(_col_), Name Expr(As Column(dt, col)),
Expr(_colw_), As Name(col),
Expr(_lval_), lval,
Expr(_mval_), mval,
Expr(_uval_), uval
));
pf << Desirability Functions(1);
我建議檢查你正在建立的表達式,使用 Substitute 和 EvalExpr 只需運行突出顯示的部分就很容易了

我也將開始使用它,因為它更加強大,並且很可能是解決此類問題的正確方法。
回覆:請求幫助設定和最大化功能內的可取性。你好,Jarmo,
完美!將 Parse() 改為 As Name() 解決了所有問題,現在可以正確地將變數中儲存的名稱字串指派為必須傳遞回應限制的資料列。
再次感謝您的幫忙!