question

crzdada avatar image
0 Likes"
crzdada asked Jeanette F commented

what is the meaning of parsedRequestNode ?

I realy want to know the meaning in these code sentence

<?flexscript
treenode parsedRequestNode = c; // what is the parameter c ? where it come from ?
treenode serverInterface = i; // what is the parameter i ? where it come from ?
int precision = maintenance(2); // what is the function maintenance?

treenode instanceNode = parsedRequestNode.find("/GET/queryinstance");
string instanceName;
int instanceNum;
if (instanceNode) {
instanceName = parsedRequestNode.find("/GET/queryinstance").value;
instanceNum = parsedRequestNode.find("/GET/instancenum").value.toNum();
}
treenode experimenter = Model.find("Tools/Experimenter");
Array jobs = getvarnode(experimenter, "jobs").subnodes.toArray();
int hasExperiment = 0;
int hasOptQuest = 0;
for (int i = 1; i <= jobs.length; i++) {
if (isclasstype(jobs[i], "ExperimenterBasicJob")) {
hasExperiment = 1;
}

if (isclasstype(jobs[i], "ExperimenterOptQuestJob")) {
hasOptQuest = 1;
}

if (hasExperiment && hasOptQuest) {
break;
}
}

treenode streammodenode = Model.find("Tools/serverinterface/streammode");
if (!streammodenode) {
streammodenode = serverInterface.find("streammode");
}
int streammode = streammodenode.value;
?>
FlexSim 23.1.0
flexsim webserverwebpage
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeanette F avatar image Jeanette F ♦♦ commented ·
Hello @Crzdada,

It might be helpful knowing where this code came from. Is this from within FlexSim object, process flow activity, treenode, etc?

1 Like 1 ·
crzdada avatar image crzdada Jeanette F ♦♦ commented ·

it come from:

MAIN:/project/exec/globals/serverinterface/pagetemplates/default
0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ crzdada commented ·

When a FlexScript function is called via executefsnode(), three parameters can be passsed: c, i, and eventdata. This function pre-dates FlexScript having local variables of arbitrary names, and it pre-dates the nodefunction() and param() commands which can pass and access arbitrary parameters by index.

The maintenance() command is from a time when FlexSim's Engine (core application logic) and its Content (simulation objects and UI) were developed by separate development teams. The maintenance() command gave library object developers access to call functions in the Engine designed for them rather than for end-users (in this case, getting the application's current number precision setting). The modern, more flexible equivalent is the applicationcommand() command. It is designed for application developer use, not modeler use; so the particulars for how any given command works aren't extensively documented. The assumption for the intended users of those commands (FlexSim developers, not model builders) is that they can follow the example of other locations where the functions are used and the source code for how they work without relying on external documentation.

As you tread into the territory of developing custom webserver interfaces using the defaultpage as an example, you will be looking at code written by FlexSim library developers with an extensive understanding of web development methodologies and the application's internals, not just a user-level understanding of the software's features. It may be a steep learning curve for those unfamiliar with FlexSim's architecture and history.

The defaultpage is a complex server-side http response with a flexible UI that transforms the model's open views, dashboard charts/widgets, experimenter, and optimizer into a usable html/javascript web page. Many features have been added to it over many years to provide a web experience that covers 95% of the needs of a user who wants to run a model online. It won't be a simple, fast task to understand it.

4 Likes 4 ·

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Jeanette F commented

I think you start with a visit of FlexSim command manual section. There you find command descriptions for “c” and “i”. It seems you explore a part of the experimenter. This is an internal feature. You need a lot of experience about internal model behavior to deal with such an important feature of the FlexSim engine. I wish you success to customize this internal tool.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

crzdada avatar image crzdada commented ·

thank you, Joerg, another question is how to create a custom web page that like the defalutpage, i know how to replace the defalutpage, but the question is i don't know how to create the 3d view, controler on my custom page, all these elements like defalutpage the flexsim provided.

0 Likes 0 ·
Jeanette F avatar image Jeanette F ♦♦ crzdada commented ·
Hello @Crzdada,

Please follow our best practices and post your question in a new post.

1 Like 1 ·