hi all,
can you help me with a script that takes a jmp table like this
and automatic generate RBD in the Repairable Systems Simulation like this:
When the MTBF values are inserted into the Theta value under the exponential distribution
thank you very much!
Have you checked what the script looks like which is used in the example? https://www.jmp.com/support/help/en/18.1/#page/jmp/example-using-the-repairable-systems-simulation-p... or what the scripts looks like if you save your version?
This is still most likely somewhat broken, but with small modifications it most likely can be improved and made more robust
Names Default To Here(1);
dt = New Table("My system",
Add Rows(2),
Compress File When Saved(1),
New Column("Column 1",
Numeric,
"Ordinal",
Format("Best", 12),
Set Values([1, 2, 3, 4])
),
New Column("Column 2", Character, "Nominal", Set Values({"A", "B", "C", "D"})),
New Column("Column 3",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([7500, 13000, 333, 2357])
)
);
rss_expr = Expr(Repairable Systems Simulation());
system_item_expr = EvalExpr(System Item(Expr(dt << get name)));
Insert Into(system_item_expr, NameExpr(Reliability Block("Start", Position(0, 5))));
end_block = Expr(Reliability Block("End"));
position_expr = EvalExpr(Position(Expr(N Rows(dt) + 1),5));
Insert Into(end_block, Name Expr(position_expr), 2);
Insert Into(system_item_expr, NameExpr(end_block));
create_reliabilty_block = function({name, pos, theta}, {Default Local},
block_expr = EvalExpr(Reliability Block(Expr(name)));
position_expr = EvalExpr(Position(Expr(pos),5));
configuration_expr = EvalExpr(Configuration(Basic(Exponential(Expr(theta)), Time Unit(Hour))));
Insert Into(block_expr, Name Expr(position_expr));
Insert Into(block_expr, Name Expr(configuration_expr));
return(Name Expr(block_expr));
);
For Each Row(dt,
r_block = create_reliabilty_block(:Column 2, Row(), :Column 3);
Insert Into(system_item_expr, Name Expr(r_block));
);
connections = :Column 2 << get values;
Insert Into(connections, "Start", 1);
Insert Into(connections, "End");
connections_list = {};
For(i = 1, i < N Items(connections), i++,
Insert Into(connections_list, Eval List({Eval List({connections[i], connections[i+1]})}));
);
block_connections_expr = EvalExpr(Block Connections(Expr(connections_list)));
Insert Into(system_item_expr, NameExpr(block_connections_expr));
For Each Row(dt,
event_expr = EvalExpr(Add Event(
Block Name(Expr(:Column 2)),
Event Name("Block Failure"),
Configuration(Block Failure)
));
process_expr = EvalExpr(Add Process(
Block Name(Expr(:Column 2)),
Process Name("Turn Off System"),
Configuration(Turn Off System, Completion Time(Immediate))
));
link_expr = EvalExpr(Link Event and Process(
Event(Block Name(Expr(:Column 2)), Event Name("Block Failure")),
Process(Block Name(Expr(:Column 2)), Process Name("Turn Off System"))
));
Insert Into(system_item_expr, Name Expr(event_expr));
Insert Into(system_item_expr, Name Expr(process_expr));
Insert Into(system_item_expr, Name Expr(link_expr));
);
Insert Into(system_item_expr, NameExpr(Simulation Settings(
Duration(100),
Time Unit(Hour),
N Simulations(1),
Seed(0)
)));
Insert Into(rss_expr, Name Expr(system_item_expr));
system_item_expr = EvalExpr(Open System Item(Expr(dt << get name)));
Insert Into(rss_expr, Name Expr(system_item_expr));
rss = Eval(rss_expr);
wait(0);
/*
// Comments at the start of file do not seem to be necessary, but if you wish to have a "simulation" file, then you could add these
sb = Script Box("//!
//!STANDALONEPLATFORM
//WARNING: DO NOT CHANGE THE FIRST TWO LINES OF THIS FILE.
" ||
Char(NameExpr(rss_expr)), 800, 800);
sb << Reformat;
rss_script = sb << Get Text;
Save Text File("$TEMP/demo.jsl", rss_script);
Open("$TEMP/demo.jsl");
*/
Thank you very much for your response, but what I meant is that I want to take a similar table to this example, of course with different values, and use it to build an RBD table in the RSS module.
You did not provide a table so I did create example which follows similar structure. You can go through the provided script and make the required changes.
Hi,
I actually wrote a script to automate just what you're suggesting. I presented it at the 2021 JMP Discovery event and you can find the JMP journal and all the scripts here,