Book a Demo

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DaVos

Pages: [1]
1
Hej everyone

I am using the model from the EA examples called Entering A State.

It is a class with a state machine attached to the class.

There is also a executable statemachine artifact to build the model.

I am using Visual Studio 2019 to build the model.

I have written the following script (batch) on the execution analyzer.

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" x86
if not exist SimulationOutput mkdir SimulationOutput
 
cl.exe /Od /Zi /EHsc /Fo".\SimulationOutput/" /Fd".\SimulationOutput/" *.cpp /link /out:".\SimulationOutput\Artifact1.exe"

I do not get any errors when I am building the application.

Although nothing is generated inside the path folder.

Any ideas why ?

Thanks



 

2
Hi gents

I am trying to simulate an executable state machine with java script.

The java script code that I want to simulate with EA is the following

class Operation {
 
  // Method
  Add(a,b) {
    this.a = a;
    this.b = b;
    return this.a + this.b;
  }
 
}

 // Create object
 operation1 = new Operation;

result=operation1.Add(10,10)

console.log("Addition is " + result);

For the equivalent response from the EA I did the following steps:
1. Define a Class called Operation.
2. Define an operation called Add(int, int) with the following code on the behavior
this.a=a;
this.b=b;
return a+b;
3. I drag and drop the Class as an object into the state machine and call the object as operation1:Operation
4. I create a simple state machine and call the operation on the entry of the state machine but as well as on a transition connector (code added on the effect tab)
I have used the following code variations
sim.result=sim.operation1.Add(10,10)
sim.result=sim.operation1.Add()
sim.Add(10,10)
this.Add()
etc...

The initialization of the variables a and b have been done with different ways, on the object, on the state machine on the execution analyzer script etc.

I am always get the same error : sim.Add is not a function.

Any ideas why ?

Is it a simulation configuration error ?

I can see on the local variables that the Add() function is not called and not even existed on the object.

Any help appreciated  8)

Thank you





3
Hi everyone

I am trying to simulate an executable state machine that calls an operation. The operation returns a value and it is defined on a class.

As a first step I have used the EA example CD Player.

By running the simulation on interpreted mode I got the following error

\\sim.next is not a function.\\ The simulation is running on java.

The same error I got on my simulation.

I have followed all the guidelines described on EA dynamic simulation guidelines.

Did anyone faced the same problems with dynamic simulation ?

Regarding technicalities
1. How EA defines an operation on a class ?
for example if I define the following
this.a=a
this.b=b
return a+b

Is this enough or I have to define a method based on Java ? Define public or state keywords for the method definition etc

2. How I call this operation from a class ?
I have to define an object or just a simple call will do the job ? For example this.result=add(1,2)

Any help appreciated

 









Pages: [1]