Cancel
Showing results for 
Search instead for 
Did you mean: 

A few general questions

Pioneer
Pioneer

Hello everyone,

 

I'm currently finishing my simlation for a beerbrewery with some great help from Mr. Bangsow and Siemens.

 

I'd like to put I few things in it, I am not that good in PlantSim as you are. Here are the things I'd like to put in it:

 

- A counter that counts the times the drain has to work (the batches made).

- A button that starts the simulation and a Textbox in which I can fill in the simulation time, also a button that stops and resets the simulation so I don't need to use the EventController. 

- A counter that shows me the simulated time and the amount produced.

 

See the image for my model.Model.PNG

 

How do I make this?

 

Thanks in advance!

 

Paul Simonis

6 REPLIES

Betreff: A few general questions

Gears Phenom Gears Phenom
Gears Phenom

Hi Paul,

 

not exactly sure about the 1st question, but here are some hints:

 

  1. Put a display in your model, activate it and parametrise it:
    • Path:
      myFluidDrain1.statWorkingTime
    • Comment (without the quotation marks): "Working time of drain #1: "
  2. Put buttons in your model, adjust their labels as desired and create OnClicked-controls for them:
    • Start the model:
      root.eventController.start;
    • Stop the model:
      root.eventController.stop;
    • Not sure about the textbox; how about a button that prompts for the simulation time? Do you want to enter the simulation start-date or the simulation-duration? You could do something like this in a OnClicked-control of a button (checking that the user enters a valid date is a bit tricky Smiley Happy ):
      is
      	strInput 	: string;
      do
      	-- prompt for simulation start-date
      	strInput 	:= prompt("Please input simulation start-date: ");
      	if executeSilent("(p: string): boolean is do result := isDate(str_to_date(p)); end;",strInput) then
      		root.eventController.date := str_to_date(strInput);
      	else
      		promptMessage("Invalid date was entered. No changes made.");
      	end;
      end;
  3. Place 2 more displays in your model
    • Simulated time: Drag-drop the eventController on the display; now it will show the simulation time (in 1 min-intervals)
    • Amount produced: Activate the display, enter
      myFluidDrain.statThroughput
      as Path and "Throughput of drain #1: " as Comment (without quotation marks).

 

Hope this helps, regards:

Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: A few general questions

Pioneer
Pioneer

Hello Alex,

 

Thanks for your help. What I meant by the textbox is a box where I can fill in for example 120 hours. The simulation duration will be 120 hours, just like I put in the text box. Is this maybe easier to make?

 

Is there also maybe a control that executes the simulation very fast, maybe even without animation? So you don't have to speed up the eventcontroller?

 

Greetings,

 

Paul Simonis

 

 

Betreff: A few general questions

Gears Phenom Gears Phenom
Gears Phenom

Hi Paul,

 

to speed up the simulation, you could add buttons to do the following:

  • turn off animation (also speeds up the simulation): 
    animMU(false);
    animIcon(false);
  • speed up (don't use real-time factor):
    root.EventController.realTime := false;
    root.EventController.speed := 100;
  • As far as I know, there is no textbox-object for the user-interface, so I would still suggest a button that will prompt the user for the simulation duration (note that I use a variable to display the simulation duration set by the user):
    is
    	strInput	: string;
    do
    	-- prompt user for simulation duration
    	strInput 					:= prompt("Please enter simulation duration in hours:");
    	v_simDuration				:= str_to_num(strInput);
    	root.eventController.end 	:= 60*v_simDuration;	
    end;

Does that work for you?

Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: A few general questions

Pioneer
Pioneer

Hi Alex,

 

I think I'll use the second option, the speed up option. But is it also possible to do this with a check box. When I press on the check box and see the green sign the model speeds up. And when I click again on the check box the normal time starts again. Because when I use the button I can't go back to the normal speed without opening the eventcontroller.

 

Greetings,

 

Paul

Betreff: A few general questions

Gears Phenom Gears Phenom
Gears Phenom

Hi Paul,

 

yes you can also use a checkbox, where you can also define a (OnClicked)-Control. If you want to switch between "Highspeed (no animation)" and "Realtime (with animation)" you could do this:

is
do
	-- Checkbox active = Highspeed mode
	if ?.value then eventController.speed := 100; end;
	eventController.realTime := not ?.value;
	animMU(not ?.value);
	animIcon(not ?.value);
end;

Regards,
Alex

____________________________________________________________
Alex Dilg, Consultant at SimPlan AG (www.SimPlan.de)
This post was good and/or helpful to you? Please provide some Kudos, thank you!

Betreff: A few general questions

Pioneer
Pioneer

Hi Alex,

 

That is exaclty what I needed, than you very much for you help!

 

Greetings,

 

Paul