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 - Rethinking

Pages: [1]
1
General Board / Re: State Model Simulation
« on: December 31, 2021, 08:13:17 am »
I got no replies discussing simulation, so I downloaded a trial version to include Executable State Machines. I've worked through all of the examples, but I can't find a way to create two instances of an object with a state model, which can act independently. I can only get broadcast events to switch between states - so both instances are impacted in the same way. I can't make %SEND_EVENT ....% work, as I don't understand the CONTEXT_REF. Can anyone send any pointers ?

TIA,

Rethinking

2
General Board / State Model Simulation
« on: December 06, 2021, 04:08:00 am »
Hello fellow Sparxians, :)

Without using Executable State Machine functionality (I only have Corporate license), can I create a simulation of a state model, whereby when I dynamically create an object of a particular class via sim.Product=CreateObject("ClassA"); where Class A is Class in the model, it automatically picks up that State Machine from "under" that class in the Project Browser and starts modelling the state behaviour of that class in the simulation i.e. the model starts at the initial control node and progresses to the first allowable state, when there is one clear pathway ?

I suspect the problem might be to do with "scopes", but I don't really understand scope; can someone provide a good reference?


Many thanks, in advance for your help.

3
General Board / EA v15.2 - Potential bugs
« on: September 05, 2021, 05:05:31 am »
I recently "upgraded" to EA v15.2, but it has created a whole load of bugs in my existing simulation model which was working without errors in v15.1 (but wasn't complete yet). The majority were to do with v15.2 appearing to be stricter in its use of strings, especially within Trace statements, and I needed to add a whole load of .toString() functions on numeric variables. (Is this documented anywhere ? Does it perhaps use a newer Javsacript engine ?) However, there are a lot of introduced errors outstanding:

1. Trace no longer appears to work in the simulation window, even one as simple as Trace("Hello"); unless the Trace output has now ended up somewhere else ???
2. I have a lot of errors introduced, which luckily don't seem to abort the program, but log "Invalid assignment left-hand side" - what are these likely to refer to ? (There is another thread on this topic at https://www.sparxsystems.com/forums/smf/index.php/topic,45324.msg270311.html#msg270311, but no-one from Support seems to have replied.)
3. The new look Locals window now includes this variable, with dialogs as well as scripts; but it always hangs when I go into a nested array of objects ? Any ideas ??? Combined with the lack of Trace, this will make it hard to de-bug any changes to the model.
4. Is the size limit on the length of Javascript in a guard different, as my code seems to be truncated, but I can't add any code to the end of the line ?
5. This may be a resultant error from the above, but my function object.OP16() is no longer being recognised as a function. (I did have this as a problem before, but managed to resolve it; but it appears to have re-surfaced with the move to v15.2.)

The good news is that the dynamic charting library in v15.2 is rather cool and it would be a shame to lose that. However, I might be forced to downgrade back to v15.1 - is there an easy way to downgrade back to v15.1 and keep my settings (such as window configuration, server connection) etc.?


Many thanks, in advance for your help;


Rethinking Transport

4
Did you ever get a reply to this, as I have just come across the same error in my simulation model, when I upgraded from version 15.1 to 15.2 ? Any ideas ?

5
General Board / Re: Visualisation using d3.js and EA simulations
« on: August 25, 2021, 01:00:16 am »
Geert (or anyone else),

I am a bit confused by the difference between behaviours, scripts and code, which presumably could each or all be written in Javascript.

Can anyone explain the difference to me simply, or point me in the right direction ?

Many thanks,

Rethinking

6
General Board / Re: Visualisation using d3.js and EA simulations
« on: August 24, 2021, 05:48:29 pm »
Thanks, Geert.

I will have a play around and report back.

P.S. I was just watching one of your YouTube videos on scripting, so thanks for the prompt reply.

Rethinking.

7
General Board / Visualisation using d3.js and EA simulations
« on: August 24, 2021, 04:33:06 pm »
I see that you can include Javascript libraries using a standard INC command, but I don't really understand how to.

I was wondering "Can you use standard Javascript libraries such as d3.js - in order to visualise the output of an EA simulation ?".

Is there a tutorial or a blog-post that would help point me in the right direction ?

I think the combination of EA and d3.js would be very powerful together. However, it appears that some standard Javascript functionality such as .forEach() is locked down, so I suspect that a detailed library like d3.js would struggle.

Thanks,
Rethinking

8
What about Array.length ?

In the following Javascript behaviour, it appears that Array.length is a valid property, but it also appears to always be 1 ??

sim.Array = [];
sim.Array[0] = new sim.CreateObject("Object");
sim.Array[1] = new sim.CreateObject("Object");
sim.Array[2] = new sim.CreateObject("Object");
Trace("Hello");
Trace(Array.length.toString());
sim.Array[Array.length]=new sim.CreateObject("Object");
Trace(Array.length.toString());
sim.Array[Array.length]=new sim.CreateObject("Object");
Trace(Array.length.toString());
Trace("Goodbye");

9
General Board / Can you use .forEach() in Javascript simulations in EA ?
« on: August 23, 2021, 06:22:57 am »
Can you use .forEach() in Javascript simulations in EA ?

10
Uml Process / Re: Specific Format of State Machine Diagram
« on: August 09, 2021, 02:51:08 am »
Saniea,

I followed your instructions and it works well. Glad that you worked it out !!!

Rethinking

11
Uml Process / Re: Specific Format of State Machine Diagram
« on: August 06, 2021, 04:09:27 am »
Saniea,


How are you getting on with EA and your State Models ?

I think I understand what you're trying to do better now - you're just using EA to draw your state model diagram, right ? In which case, I think I see the problem - as far as I can see, there appears to be a limit of three actions on a state diagram. So, I think you have two choices as illustrated by this diagram:https://pasteboard.co/KevQarG.png.


Hope that helps.


Rethinking Transport

12
General Board / Looping within an Activity Model (2)
« on: July 31, 2021, 06:04:12 am »
Hi,

I'd really appreciate your help to un-block a problem with my EA model. I'd like to add a loop to my Activity Diagram, but I can't make sense of the help topic at: https://sparxsystems.com/enterprise_architect_user_guide/15.2/model_domains/loop_and_conditional_nodes2.html. Usually, I can work through an example and make it work in EA, but not with Loop Nodes !


Can anyone provide any general guidance on how to make them work, or ideally provide a worked example of a really basic loop which models what can simply be implemented in Javascript as:for (var i=0; i<10; i++) {console.log("This will print 10 times);}, where the console log is replaced with a Trace.


I want to replace the console.log with another more detailed Activity Diagram that I have already modelled in EA, so I don't think I can use straight Javascript (but please correct me if I am wrong) and so I think I am forced to try and understand Loop Nodes.


Many thanks, in advance for your help,


Rethinking Transport

13
Uml Process / Nested State Machines
« on: July 30, 2021, 05:56:15 pm »
Hi Sparxians,

Whilst being a novice at EA, I've created quite a complex State Machine model for the interaction of a smartcard with a smartcard reader. However, my model has a problem, which I am trying to de-bug.

I've only got the Corporate edition - what I am trying to do might be easier as an Executable State Machine, but instead I have got a nested set of things that I am modelling, nested within what I call my "Super State" model, which simply uses concurrent sub-states to contain the State Models for each of the components within my system, which each have their own State Models.

I've recently learnt that you don't have to have the Super State Model diagram open in order to run the simulation, that you just have to have it selected in the Project Browser and then the model will open automatically. However, in my case (at about the same time as I ran into my bug), I get a dialog called "Element Usage" which pops up asking me to select which statechart to use. Two, not all of the State Machines, are shown. My question is how are these two diagrams chosen ?.

I suspect that I have done something wrong in the set-up of my "super state" and that somehow I have 'promoted' one of my sub-states to the top-level and this is causing the bug.

I hope that makes sense and I look forward to your thoughts ...


Thanks in advance,


Rethinking Transport


14
Uml Process / Re: Specific Format of State Machine Diagram
« on: July 28, 2021, 11:18:20 pm »
Hi Saniea,


Not sure if you've had any replies to your post. I'm relatively new to EA too, but am playing with simulations based on State Machines. I think we might have quite similar requirements.


To add multiple actions as an Effect, simply type something like: sim.var1.foo; sim.var1.bar; as Javascript into the Effect box on the Transitions. You can press Enter to get a new line. You don't need to click on "Effect is a Behaviour" - this is if you want to re-use some behaviours from your model itself and then you can link off to a behaviour that you've already modelled.


There are good resources on the Sparx website, such as:


https://sparxsystems.com/enterprise_architect_user_guide/14.0/model_simulation/dynamic_simulation_with_javasc.html
Scott has done a number of videos such as: https://www.youtube.com/watch?v=0SFuzrVvL_A This one is quite a short, basic one. About three minutes in, it gets to an example of how to use State Models within simulations.


Hope this helps ...


Best Regards,


Rethinking Transport

Pages: [1]